Class: Transport::Base
- Inherits:
-
Object
- Object
- Transport::Base
- Defined in:
- lib/transport/base.rb
Overview
Common transport layer for http transfers.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(http_method, url, options = { }) ⇒ Base
constructor
A new instance of Base.
- #perform ⇒ Object
Constructor Details
#initialize(http_method, url, options = { }) ⇒ Base
Returns a new instance of Base.
12 13 14 15 16 17 18 |
# File 'lib/transport/base.rb', line 12 def initialize(http_method, url, = { }) @request_builder = Request::Builder.new http_method, url, @uri = @request_builder.uri @request = @request_builder.request @expected_status_code = [:expected_status_code] end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
10 11 12 |
# File 'lib/transport/base.rb', line 10 def response @response end |
Class Method Details
.request(http_method, url, options = { }) ⇒ Object
25 26 27 28 29 |
# File 'lib/transport/base.rb', line 25 def self.request(http_method, url, = { }) transport = new http_method, url, transport.perform transport.response end |
Instance Method Details
#perform ⇒ Object
20 21 22 23 |
# File 'lib/transport/base.rb', line 20 def perform perform_request check_status_code end |