Method: EasyPost::Error#initialize

Defined in:
lib/easypost/error.rb

#initialize(message = nil, http_status = nil, http_body = nil, json_body = {}) ⇒ Error

Returns a new instance of Error.



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/easypost/error.rb', line 11

def initialize(message=nil, http_status=nil, http_body=nil, json_body={})
  @message = message
  @http_status = http_status
  @http_body = http_body
  @json_body = json_body

  @param = @json_body.fetch(:error, {}).fetch(:param, nil)
  @code = @json_body.fetch(:error, {}).fetch(:code, nil)
  @errors = @json_body.fetch(:error, {}).fetch(:errors, nil)

  super(message)
end