Class: ApiError
- Inherits:
-
Object
- Object
- ApiError
- Includes:
- ActiveModel::Model
- Defined in:
- lib/nexmo_developer/app/models/api_error.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#id ⇒ Object
Returns the value of attribute id.
- #link_text ⇒ Object
-
#link_url ⇒ Object
Returns the value of attribute link_url.
-
#resolution ⇒ Object
Returns the value of attribute resolution.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
3 4 5 |
# File 'lib/nexmo_developer/app/models/api_error.rb', line 3 def description @description end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/nexmo_developer/app/models/api_error.rb', line 3 def id @id end |
#link_text ⇒ Object
6 7 8 |
# File 'lib/nexmo_developer/app/models/api_error.rb', line 6 def link_text @link_text || 'Find out more' end |
#link_url ⇒ Object
Returns the value of attribute link_url.
3 4 5 |
# File 'lib/nexmo_developer/app/models/api_error.rb', line 3 def link_url @link_url end |
#resolution ⇒ Object
Returns the value of attribute resolution.
3 4 5 |
# File 'lib/nexmo_developer/app/models/api_error.rb', line 3 def resolution @resolution end |
Class Method Details
.parse_config(errors) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/nexmo_developer/app/models/api_error.rb', line 24 def self.parse_config(errors) return [] if errors.blank? errors.map do |id, config| ApiError.new({ id: id }.merge(config)) end end |
Instance Method Details
#link ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/nexmo_developer/app/models/api_error.rb', line 15 def link return nil unless @link_text && @link_url OpenStruct.new({ text: @link_text, url: @link_url, }) end |
#link=(link) ⇒ Object
10 11 12 13 |
# File 'lib/nexmo_developer/app/models/api_error.rb', line 10 def link=(link) @link_text = link['text'] @link_url = link['url'] end |