Class: AllegroGraph::ExtendedTransport

Inherits:
Transport
  • Object
show all
Defined in:
lib/allegro_graph/extended_transport.rb

Overview

Extended transport layer for http transfers. Basic authorization and JSON transfers are supported.

Defined Under Namespace

Classes: UnexpectedStatusCodeError

Instance Attribute Summary collapse

Attributes inherited from Transport

#body, #headers, #http_method, #options, #parameters, #response, #url

Instance Method Summary collapse

Constructor Details

#initialize(http_method, url, options = { }) ⇒ ExtendedTransport

Returns a new instance of ExtendedTransport.



30
31
32
33
34
35
36
# File 'lib/allegro_graph/extended_transport.rb', line 30

def initialize(http_method, url, options = { })
  super http_method, url, options
  @expected_status_code = options[:expected_status_code]
  @auth_type            = options[:auth_type]
  @username             = options[:username]
  @password             = options[:password]
end

Instance Attribute Details

#auth_typeObject (readonly)

Returns the value of attribute auth_type.



26
27
28
# File 'lib/allegro_graph/extended_transport.rb', line 26

def auth_type
  @auth_type
end

#expected_status_codeObject (readonly)

Returns the value of attribute expected_status_code.



25
26
27
# File 'lib/allegro_graph/extended_transport.rb', line 25

def expected_status_code
  @expected_status_code
end

#passwordObject (readonly)

Returns the value of attribute password.



28
29
30
# File 'lib/allegro_graph/extended_transport.rb', line 28

def password
  @password
end

#usernameObject (readonly)

Returns the value of attribute username.



27
28
29
# File 'lib/allegro_graph/extended_transport.rb', line 27

def username
  @username
end

Instance Method Details

#performObject



38
39
40
41
42
43
# File 'lib/allegro_graph/extended_transport.rb', line 38

def perform
  initialize_headers
  super
  check_status_code
  parse_response
end