Class: Latitude::APIError::Entry
- Inherits:
-
Object
- Object
- Latitude::APIError::Entry
- Defined in:
- lib/latitude/api/errors.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#detail ⇒ Object
readonly
Returns the value of attribute detail.
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(raw) ⇒ Entry
constructor
A new instance of Entry.
- #to_h ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(raw) ⇒ Entry
Returns a new instance of Entry.
21 22 23 24 25 26 27 28 |
# File 'lib/latitude/api/errors.rb', line 21 def initialize(raw) @raw = raw || {} @status = @raw["status"] @code = @raw["code"] @title = @raw["title"] @detail = @raw["detail"] || @raw["message"] @meta = @raw["meta"] || {} end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
19 20 21 |
# File 'lib/latitude/api/errors.rb', line 19 def code @code end |
#detail ⇒ Object (readonly)
Returns the value of attribute detail.
19 20 21 |
# File 'lib/latitude/api/errors.rb', line 19 def detail @detail end |
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
19 20 21 |
# File 'lib/latitude/api/errors.rb', line 19 def @meta end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
19 20 21 |
# File 'lib/latitude/api/errors.rb', line 19 def raw @raw end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
19 20 21 |
# File 'lib/latitude/api/errors.rb', line 19 def status @status end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
19 20 21 |
# File 'lib/latitude/api/errors.rb', line 19 def title @title end |
Instance Method Details
#to_h ⇒ Object
37 38 39 |
# File 'lib/latitude/api/errors.rb', line 37 def to_h @raw.dup end |
#to_s ⇒ Object
30 31 32 33 34 35 |
# File 'lib/latitude/api/errors.rb', line 30 def to_s return @detail.to_s if @title.nil? || @title.empty? return @title.to_s if @detail.nil? || @detail.empty? "#{@title}: #{@detail}" end |