Class: EasyPost::Models::Error
- Inherits:
-
Object
- Object
- EasyPost::Models::Error
- Defined in:
- lib/easypost/models/error.rb
Overview
EasyPost Error object.
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#field ⇒ Object
readonly
Returns the value of attribute field.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Class Method Summary collapse
-
.from_api_error_response(data) ⇒ Object
Create an EasyPost Error from an API error response.
Instance Method Summary collapse
-
#initialize(code, field = nil, message = nil) ⇒ Error
constructor
Initialize a new EasyPost Error.
Constructor Details
#initialize(code, field = nil, message = nil) ⇒ Error
Initialize a new EasyPost Error
8 9 10 11 12 |
# File 'lib/easypost/models/error.rb', line 8 def initialize(code, field = nil, = nil) @code = code @field = field @message = end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
5 6 7 |
# File 'lib/easypost/models/error.rb', line 5 def code @code end |
#field ⇒ Object (readonly)
Returns the value of attribute field.
5 6 7 |
# File 'lib/easypost/models/error.rb', line 5 def field @field end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
5 6 7 |
# File 'lib/easypost/models/error.rb', line 5 def @message end |
Class Method Details
.from_api_error_response(data) ⇒ Object
Create an EasyPost Error from an API error response.
15 16 17 18 19 20 |
# File 'lib/easypost/models/error.rb', line 15 def self.from_api_error_response(data) code = data['code'] field = data['field'] || nil = data['message'] || nil EasyPost::Models::Error.new(code, field, ) end |