Exception: Zedkit::Client::ClientError
- Inherits:
-
ZedkitError
- Object
- StandardError
- ZedkitError
- Zedkit::Client::ClientError
- Defined in:
- lib/zedkit/client/exceptions.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#api_code ⇒ Object
readonly
Returns the value of attribute api_code.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#http_code ⇒ Object
readonly
Returns the value of attribute http_code.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
-
#initialize(info = {}) ⇒ ClientError
constructor
A new instance of ClientError.
- #to_s ⇒ Object
Constructor Details
#initialize(info = {}) ⇒ ClientError
Returns a new instance of ClientError.
26 27 28 29 30 31 |
# File 'lib/zedkit/client/exceptions.rb', line 26 def initialize(info = {}) @http_code = info[:http_code] || 0 @api_code = info[:api_code] || nil @message = info[:message] || nil @errors = info[:errors] || nil end |
Instance Attribute Details
#api_code ⇒ Object (readonly)
Returns the value of attribute api_code.
24 25 26 |
# File 'lib/zedkit/client/exceptions.rb', line 24 def api_code @api_code end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
24 25 26 |
# File 'lib/zedkit/client/exceptions.rb', line 24 def errors @errors end |
#http_code ⇒ Object (readonly)
Returns the value of attribute http_code.
24 25 26 |
# File 'lib/zedkit/client/exceptions.rb', line 24 def http_code @http_code end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
24 25 26 |
# File 'lib/zedkit/client/exceptions.rb', line 24 def @message end |
Instance Method Details
#to_s ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/zedkit/client/exceptions.rb', line 33 def to_s rs = "\nZedkit API Error Response.\n" \ << " HTTP Code => #{http_code}. #{http_string(http_code)}\n" rs << " API Status Code => #{api_code}.\n" unless api_code.nil? rs << " API Response Message => #{}.\n" unless .nil? rs << " API Error Attribute Details => #{@errors['attributes'].map {|k,v| "#{k} => #{v}" }}.\n" unless errors.nil? rs << "\n" end |