Exception: Webhookdb::Http::Error
- Defined in:
- lib/webhookdb/http.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#http_method ⇒ Object
readonly
Returns the value of attribute http_method.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
-
#initialize(response, msg = nil) ⇒ Error
constructor
A new instance of Error.
- #to_s ⇒ Object (also: #inspect)
Constructor Details
#initialize(response, msg = nil) ⇒ Error
Returns a new instance of Error.
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/webhookdb/http.rb', line 19 def initialize(response, msg=nil) @response = response @body = response.body @headers = response.headers.to_h @status = response.code @uri = response.request.last_uri.dup if @uri.query.present? cleaned_params = CGI.parse(@uri.query).map { |k, v| k.include?("secret") ? [k, ".snip."] : [k, v] } @uri.query = HTTParty::Request::NON_RAILS_QUERY_STRING_NORMALIZER.call(cleaned_params) end @http_method = response.request.http_method::METHOD super(msg || self.to_s) end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
17 18 19 |
# File 'lib/webhookdb/http.rb', line 17 def body @body end |
#http_method ⇒ Object (readonly)
Returns the value of attribute http_method.
17 18 19 |
# File 'lib/webhookdb/http.rb', line 17 def http_method @http_method end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
17 18 19 |
# File 'lib/webhookdb/http.rb', line 17 def response @response end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
17 18 19 |
# File 'lib/webhookdb/http.rb', line 17 def status @status end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
17 18 19 |
# File 'lib/webhookdb/http.rb', line 17 def uri @uri end |
Instance Method Details
#to_s ⇒ Object Also known as: inspect
33 34 35 |
# File 'lib/webhookdb/http.rb', line 33 def to_s return "HttpError(status: #{self.status}, method: #{self.http_method}, uri: #{self.uri}, body: #{self.body})" end |