Class: Epages::Customer

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/epages/customer.rb

Constant Summary collapse

KEYS =
%w(customer_id customer_number creation_date billing_address internal_note links).collect(&:to_sym).freeze

Instance Method Summary collapse

Methods included from Utils

build_shop_from, camelize_keys, camelize_words, options_to_multipart_request, options_to_patch_request, parse_attribute_as, parse_attribute_as_array_of, parse_attributes, symbolize_keys!, to_query_options, underscorize_keys

Constructor Details

#initialize(data) ⇒ Customer

Returns a new instance of Customer.



11
12
13
14
15
16
# File 'lib/epages/customer.rb', line 11

def initialize(data)
  parse_attribute_as(:billing_address, data.delete(:billingAddress), Epages::Address)
  parse_attribute_as_array_of(:links, data.delete(:links), Epages::Link)
  parse_attribute_as(:creation_date, data.delete(:creationDate), DateTime)
  parse_attributes(data)
end