Class: ApiStruct::Errors::Client
- Inherits:
-
Object
- Object
- ApiStruct::Errors::Client
- Defined in:
- lib/api_struct/errors/client.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(response) ⇒ Client
constructor
A new instance of Client.
- #to_s ⇒ Object
Constructor Details
#initialize(response) ⇒ Client
Returns a new instance of Client.
6 7 8 9 10 11 12 13 14 |
# File 'lib/api_struct/errors/client.rb', line 6 def initialize(response) if response.is_a?(Hash) @status = response[:status] @body = response[:body] else @status = response.status @body = parse_body(response.body.to_s) end end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
4 5 6 |
# File 'lib/api_struct/errors/client.rb', line 4 def body @body end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
4 5 6 |
# File 'lib/api_struct/errors/client.rb', line 4 def status @status end |
Instance Method Details
#to_s ⇒ Object
16 17 18 |
# File 'lib/api_struct/errors/client.rb', line 16 def to_s error end |