Class: PolicyMap::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/policymap_wrap/connection.rb

Constant Summary collapse

HTTP_RESPONSES =
{ '100' => 'Continue', '101' => 'SwitchProtocol', '200' => 'OK', '201' => 'Created', '202' => 'Accepted', '203' => 'NonAuthoritativeInformation',
'204' => 'NoContent', '205' => 'ResetContent', '206' => 'PartialContent', '300' => 'MultipleChoice', '301' => 'MovedPermanently',
'302' => 'Found', '303' => 'SeeOther', '304' => 'NotModified', '305' => 'UseProxy', '307' => 'TemporaryRedirect', '400' => 'BadRequest',
'401' => 'Unauthorized', '402' => 'PaymentRequired', '403' => 'Forbidden', '404' => 'NotFound', '405' => 'MethodNotAllowed',
'406' => 'NotAcceptable', '407' => 'ProxyAuthenticationRequired', '408' => 'RequestTimeOut', '409' => 'Conflict', '410' => 'Gone',
'411' => 'LengthRequired', '412' => 'PreconditionFailed', '413' => 'RequestEntityTooLarge', '414' => 'RequestURITooLong',
'415' => 'UnsupportedMediaType', '416' => 'RequestedRangeNotSatisfiable', '417' => 'ExpectationFailed', '500' => 'InternalServerError',
'501' => 'NotImplemented', '502' => 'BadGateway', '503' => 'ServiceUnavailable', '504' => 'GatewayTimeOut', '505' => 'VersionNotSupported' }

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client_id, username, password, proxy_url) ⇒ Connection

Returns a new instance of Connection.



8
9
10
11
12
13
14
# File 'lib/policymap_wrap/connection.rb', line 8

def initialize(client_id, username, password, proxy_url)
  @client_id = client_id
  @username = username
  @password = password
  @proxy_url = proxy_url
  @debug = false
end

Instance Attribute Details

#client_idObject (readonly)

Returns the value of attribute client_id.



6
7
8
# File 'lib/policymap_wrap/connection.rb', line 6

def client_id
  @client_id
end

#debugObject

Returns the value of attribute debug.



5
6
7
# File 'lib/policymap_wrap/connection.rb', line 5

def debug
  @debug
end

Instance Method Details

#get(endpoint, data = nil) ⇒ Object



16
17
18
# File 'lib/policymap_wrap/connection.rb', line 16

def get(endpoint, data=nil)
  request :get, endpoint, data
end