Class: ChangeHealth::Models::Error
- Inherits:
-
Object
- Object
- ChangeHealth::Models::Error
- Defined in:
- lib/change_health/models/error.rb
Constant Summary collapse
- SIMPLE_RETRY_CODES =
%w[ 42 80 ].freeze
- NO_RESUBMIT_MESSAGES =
[ 'resubmission not allowed', 'do not resubmit' ].freeze
- DOWN_FIELD =
'Http Header'.freeze
- DOWN_MESSAGE =
'Please review http headers for this API, please contact support if you are unsure how to resolve.'.freeze
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
- #code_message ⇒ Object
- #field_message ⇒ Object
-
#initialize(data) ⇒ Error
constructor
A new instance of Error.
- #message ⇒ Object
- #represents_down? ⇒ Boolean
- #retryable? ⇒ Boolean
Constructor Details
#initialize(data) ⇒ Error
Returns a new instance of Error.
21 22 23 |
# File 'lib/change_health/models/error.rb', line 21 def initialize(data) @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
5 6 7 |
# File 'lib/change_health/models/error.rb', line 5 def data @data end |
Instance Method Details
#code_message ⇒ Object
33 34 35 |
# File 'lib/change_health/models/error.rb', line 33 def "#{code}: #{description}" if code? end |
#field_message ⇒ Object
29 30 31 |
# File 'lib/change_health/models/error.rb', line 29 def "#{field}: #{description}" if field? end |
#message ⇒ Object
25 26 27 |
# File 'lib/change_health/models/error.rb', line 25 def || end |
#represents_down? ⇒ Boolean
37 38 39 |
# File 'lib/change_health/models/error.rb', line 37 def represents_down? field == DOWN_FIELD && description == DOWN_MESSAGE end |
#retryable? ⇒ Boolean
41 42 43 44 |
# File 'lib/change_health/models/error.rb', line 41 def retryable? represents_down? || (code? && SIMPLE_RETRY_CODES.include?(code) && followupAction? && NO_RESUBMIT_MESSAGES.none? {|msg| followupAction.downcase.include?(msg) }) end |