Exception: Firstclasspostcodes::ResponseError
- Inherits:
-
StandardError
- Object
- StandardError
- Firstclasspostcodes::ResponseError
- Defined in:
- lib/firstclasspostcodes/response_error.rb
Instance Attribute Summary collapse
-
#doc_url ⇒ Object
readonly
Returns the value of attribute doc_url.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(obj, type = nil) ⇒ ResponseError
constructor
A new instance of ResponseError.
- #message ⇒ Object
Constructor Details
#initialize(obj, type = nil) ⇒ ResponseError
Returns a new instance of ResponseError.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/firstclasspostcodes/response_error.rb', line 9 def initialize(obj, type = nil) if obj.is_a?(Hash) super(obj[:message]) @doc_url = obj[:docUrl] @type = obj[:type] return end super(obj) @doc_url = "#{DOC_URL}/#{type}" @type = type end |
Instance Attribute Details
#doc_url ⇒ Object (readonly)
Returns the value of attribute doc_url.
7 8 9 |
# File 'lib/firstclasspostcodes/response_error.rb', line 7 def doc_url @doc_url end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
7 8 9 |
# File 'lib/firstclasspostcodes/response_error.rb', line 7 def type @type end |
Instance Method Details
#message ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/firstclasspostcodes/response_error.rb', line 21 def " The following \"\#{type}\" error was encountered:\n \#{super}\n => See: \#{doc_url}\n MSG\nend\n" |