Class: MedpassResourceApi::ErrorResult
- Inherits:
-
Object
- Object
- MedpassResourceApi::ErrorResult
- Defined in:
- lib/medpass_resource_api.rb
Instance Attribute Summary collapse
-
#raw_errors ⇒ Object
readonly
Returns the value of attribute raw_errors.
Instance Method Summary collapse
- #errors ⇒ Object
- #errors_on(field) ⇒ Object
- #first_error_on(field) ⇒ Object
-
#initialize(error) ⇒ ErrorResult
constructor
A new instance of ErrorResult.
Constructor Details
#initialize(error) ⇒ ErrorResult
Returns a new instance of ErrorResult.
171 172 173 |
# File 'lib/medpass_resource_api.rb', line 171 def initialize(error) @raw_errors = JSON.parse(error.response.body) end |
Instance Attribute Details
#raw_errors ⇒ Object (readonly)
Returns the value of attribute raw_errors.
170 171 172 |
# File 'lib/medpass_resource_api.rb', line 170 def raw_errors @raw_errors end |
Instance Method Details
#errors ⇒ Object
183 184 185 |
# File 'lib/medpass_resource_api.rb', line 183 def errors self.raw_errors end |
#errors_on(field) ⇒ Object
175 176 177 |
# File 'lib/medpass_resource_api.rb', line 175 def errors_on(field) @raw_errors[field.to_s] rescue nil end |
#first_error_on(field) ⇒ Object
179 180 181 |
# File 'lib/medpass_resource_api.rb', line 179 def first_error_on(field) errors_on(field).first rescue errors_on(field) end |