Exception: Telesign::API::APIError
- Inherits:
-
StandardError
- Object
- StandardError
- Telesign::API::APIError
- Defined in:
- lib/telesign/rest.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(http_response) ⇒ APIError
constructor
A new instance of APIError.
- #to_s ⇒ Object
Constructor Details
#initialize(http_response) ⇒ APIError
156 157 158 159 160 161 162 |
# File 'lib/telesign/rest.rb', line 156 def initialize(http_response) @errors = JSON.parse(http_response.body)['errors'] @headers = http_response.to_hash @status = http_response.code @body = http_response.body end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
154 155 156 |
# File 'lib/telesign/rest.rb', line 154 def body @body end |
#errors ⇒ Object
Returns the value of attribute errors.
154 155 156 |
# File 'lib/telesign/rest.rb', line 154 def errors @errors end |
#headers ⇒ Object
Returns the value of attribute headers.
154 155 156 |
# File 'lib/telesign/rest.rb', line 154 def headers @headers end |
#status ⇒ Object
Returns the value of attribute status.
154 155 156 |
# File 'lib/telesign/rest.rb', line 154 def status @status end |
Instance Method Details
#to_s ⇒ Object
164 165 166 167 168 169 170 171 |
# File 'lib/telesign/rest.rb', line 164 def to_s result = '' @errors.each do |error| result = "#{result}#{error['description']}\n" end result end |