Class: AllegroGraph::Transport

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

Overview

Common transport layer for http transfers.

Direct Known Subclasses

ExtendedTransport

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Transport.



18
19
20
21
22
23
24
# File 'lib/allegro_graph/transport.rb', line 18

def initialize(http_method, url, options = { })
  @http_method  = http_method
  @uri          = URI.parse url
  @headers      = options[:headers]     || { }
  @parameters   = options[:parameters]  || { }
  @body         = options[:body]
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



15
16
17
# File 'lib/allegro_graph/transport.rb', line 15

def body
  @body
end

#headersObject (readonly)

Returns the value of attribute headers.



13
14
15
# File 'lib/allegro_graph/transport.rb', line 13

def headers
  @headers
end

#http_methodObject (readonly)

Returns the value of attribute http_method.



10
11
12
# File 'lib/allegro_graph/transport.rb', line 10

def http_method
  @http_method
end

#optionsObject (readonly)

Returns the value of attribute options.



12
13
14
# File 'lib/allegro_graph/transport.rb', line 12

def options
  @options
end

#parametersObject (readonly)

Returns the value of attribute parameters.



14
15
16
# File 'lib/allegro_graph/transport.rb', line 14

def parameters
  @parameters
end

#responseObject (readonly)

Returns the value of attribute response.



16
17
18
# File 'lib/allegro_graph/transport.rb', line 16

def response
  @response
end

#urlObject (readonly)

Returns the value of attribute url.



11
12
13
# File 'lib/allegro_graph/transport.rb', line 11

def url
  @url
end

Instance Method Details

#performObject



26
27
28
29
30
31
32
# File 'lib/allegro_graph/transport.rb', line 26

def perform
  initialize_request_class
  initialize_request_path
  initialize_request
  initialize_request_body
  perform_request
end