Class: Simple::HTTP::Request
- Inherits:
-
Object
- Object
- Simple::HTTP::Request
- Defined in:
- lib/simple/http/request.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#verb ⇒ Object
readonly
Returns the value of attribute verb.
Instance Method Summary collapse
-
#initialize(verb:, url:, body: nil, headers:) ⇒ Request
constructor
A new instance of Request.
- #to_s ⇒ Object
Constructor Details
#initialize(verb:, url:, body: nil, headers:) ⇒ Request
Returns a new instance of Request.
4 5 6 |
# File 'lib/simple/http/request.rb', line 4 def initialize(verb:, url:, body: nil, headers:) @verb, @url, @body, @headers = verb, url, body, headers end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
2 3 4 |
# File 'lib/simple/http/request.rb', line 2 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
2 3 4 |
# File 'lib/simple/http/request.rb', line 2 def headers @headers end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
2 3 4 |
# File 'lib/simple/http/request.rb', line 2 def url @url end |
#verb ⇒ Object (readonly)
Returns the value of attribute verb.
2 3 4 |
# File 'lib/simple/http/request.rb', line 2 def verb @verb end |
Instance Method Details
#to_s ⇒ Object
8 9 10 11 |
# File 'lib/simple/http/request.rb', line 8 def to_s scrubbed_url = url.gsub(/\/\/(.*):(.*)@/) { |_| "//#{$1}:xxxxxx@" } "#{verb} #{scrubbed_url}" end |