Exception: BackchatClient::Error::GeneralError
- Inherits:
-
StandardError
- Object
- StandardError
- BackchatClient::Error::GeneralError
- Defined in:
- lib/backchat_client/error/general_error.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(response = nil) ⇒ GeneralError
constructor
A new instance of GeneralError.
- #to_s ⇒ Object
Constructor Details
#initialize(response = nil) ⇒ GeneralError
Returns a new instance of GeneralError.
6 7 8 |
# File 'lib/backchat_client/error/general_error.rb', line 6 def initialize(response = nil) @response = response end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
4 5 6 |
# File 'lib/backchat_client/error/general_error.rb', line 4 def response @response end |
Instance Method Details
#errors ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/backchat_client/error/general_error.rb', line 14 def errors @errors||=( errors = nil if !response.nil? and response.respond_to?(:body) data = ActiveSupport::JSON.decode(response.body) data.has_key?("errors") and errors = data["errors"].flatten end errors ) end |
#to_s ⇒ Object
10 11 12 |
# File 'lib/backchat_client/error/general_error.rb', line 10 def to_s response end |