Exception: MailinatorClient::ResponseError
- Inherits:
-
StandardError
- Object
- StandardError
- MailinatorClient::ResponseError
- Defined in:
- lib/mailinator_client/error.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(code, result = nil, raw_body = nil) ⇒ ResponseError
constructor
A new instance of ResponseError.
Constructor Details
#initialize(code, result = nil, raw_body = nil) ⇒ ResponseError
Returns a new instance of ResponseError.
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/mailinator_client/error.rb', line 6 def initialize(code, result = nil, raw_body = nil) result_hash = result.is_a?(Hash) ? result : {} @code = code @type = result_hash["type"] || result_hash[:type] = result_hash["message"] || result_hash[:message] if (.nil? || .to_s.empty?) && !raw_body.nil? = raw_body.to_s.strip end = "HTTP #{code}" if .nil? || .to_s.empty? super() end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
3 4 5 |
# File 'lib/mailinator_client/error.rb', line 3 def code @code end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/mailinator_client/error.rb', line 4 def type @type end |