Class: RoadForest::HTTP::Request
- Defined in:
- lib/roadforest/http/message.rb
Instance Attribute Summary collapse
-
#method ⇒ Object
Returns the value of attribute method.
-
#url ⇒ Object
Returns the value of attribute url.
Attributes inherited from Message
Instance Method Summary collapse
-
#initialize(method, url) ⇒ Request
constructor
A new instance of Request.
- #inspect ⇒ Object
- #inspection_payload ⇒ Object
- #needs_body? ⇒ Boolean
Methods inherited from Message
#body, #body=, #body_string, #body_string=, #empty?, #inspection_stream
Constructor Details
#initialize(method, url) ⇒ Request
Returns a new instance of Request.
77 78 79 80 81 |
# File 'lib/roadforest/http/message.rb', line 77 def initialize(method, url) super() @method, @url = method, url headers["Host"] = Addressable::URI.parse(url).host end |
Instance Attribute Details
#method ⇒ Object
Returns the value of attribute method.
75 76 77 |
# File 'lib/roadforest/http/message.rb', line 75 def method @method end |
#url ⇒ Object
Returns the value of attribute url.
75 76 77 |
# File 'lib/roadforest/http/message.rb', line 75 def url @url end |
Instance Method Details
#inspect ⇒ Object
83 84 85 |
# File 'lib/roadforest/http/message.rb', line 83 def inspect "\n" + super end |
#inspection_payload ⇒ Object
91 92 93 |
# File 'lib/roadforest/http/message.rb', line 91 def inspection_payload [url, "#{method} #{url.path}"] + super end |
#needs_body? ⇒ Boolean
87 88 89 |
# File 'lib/roadforest/http/message.rb', line 87 def needs_body? %w{POST PATCH PUT}.include?(@method) end |