Exception: Vonage::APIError
- Extended by:
- T::Sig
- Defined in:
- lib/vonage/api_error.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#http_response ⇒ Object
readonly
Returns the value of attribute http_response.
Instance Method Summary collapse
- #http_response_body ⇒ Object
- #http_response_code ⇒ Object
- #http_response_headers ⇒ Object
-
#initialize(message = nil, http_response: nil) ⇒ APIError
constructor
A new instance of APIError.
Constructor Details
#initialize(message = nil, http_response: nil) ⇒ APIError
Returns a new instance of APIError.
12 13 14 15 |
# File 'lib/vonage/api_error.rb', line 12 def initialize( = nil, http_response: nil) super() @http_response = http_response end |
Instance Attribute Details
#http_response ⇒ Object (readonly)
Returns the value of attribute http_response.
9 10 11 |
# File 'lib/vonage/api_error.rb', line 9 def http_response @http_response end |
Instance Method Details
#http_response_body ⇒ Object
27 28 29 30 31 |
# File 'lib/vonage/api_error.rb', line 27 def http_response_body return nil unless http_response return {} unless http_response.content_type && http_response.content_type.include?("json") ::JSON.parse(http_response.body) end |
#http_response_code ⇒ Object
17 18 19 20 |
# File 'lib/vonage/api_error.rb', line 17 def http_response_code return nil unless http_response http_response.code end |
#http_response_headers ⇒ Object
22 23 24 25 |
# File 'lib/vonage/api_error.rb', line 22 def http_response_headers return nil unless http_response http_response.to_hash end |