Class: Lipstick::Api::NewOrderResponse

Inherits:
Response
  • Object
show all
Defined in:
lib/lipstick/api/new_order_response.rb

Constant Summary

Constants inherited from Response

Response::CODES

Instance Attribute Summary

Attributes inherited from Response

#code, #message

Instance Method Summary collapse

Methods inherited from Response

csv_field, int_csv_field, #underscore

Constructor Details

#initialize(fields) ⇒ NewOrderResponse



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/lipstick/api/new_order_response.rb', line 4

def initialize(fields)
  fields.keys.each do |key|
    fields[underscore(key.to_s).to_sym] = fields.delete(key)
  end
  if fields[:response_code] == '100'
    fields[:test] = (fields[:test] == '1')
    fields[:customer_id] = fields.delete(:customer_id).to_i
    fields[:order_id] = fields.delete(:order_id).to_i
  end
      super(fields)
end