Class: Motion::HTTP::Request
- Inherits:
-
Object
- Object
- Motion::HTTP::Request
- Defined in:
- lib/common/http/request.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#callback ⇒ Object
readonly
Returns the value of attribute callback.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(method, url, headers = nil, params = nil, &callback) ⇒ Request
constructor
A new instance of Request.
Constructor Details
#initialize(method, url, headers = nil, params = nil, &callback) ⇒ Request
Returns a new instance of Request.
6 7 8 9 10 11 12 |
# File 'lib/common/http/request.rb', line 6 def initialize(method, url, headers = nil, params = nil, &callback) @method = method @url = url @headers = headers || Headers.new @body = params # TODO: turn params into body and set content-type? @callback = callback || ->(response) {} end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
4 5 6 |
# File 'lib/common/http/request.rb', line 4 def body @body end |
#callback ⇒ Object (readonly)
Returns the value of attribute callback.
4 5 6 |
# File 'lib/common/http/request.rb', line 4 def callback @callback end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
4 5 6 |
# File 'lib/common/http/request.rb', line 4 def headers @headers end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
4 5 6 |
# File 'lib/common/http/request.rb', line 4 def method @method end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
4 5 6 |
# File 'lib/common/http/request.rb', line 4 def url @url end |
Instance Method Details
#call ⇒ Object
14 15 16 17 |
# File 'lib/common/http/request.rb', line 14 def call # TODO: maybe pass self instead of args Adapter.request(method, url, headers, body, &callback) end |