Class: Epages::ProductLineItem

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

Constant Summary collapse

KEYS =
%w(line_item_id sku name product_id quantity line_item_price single_item_price images links delivery_weight).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) ⇒ ProductLineItem

Returns a new instance of ProductLineItem.



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

def initialize(data)
  parse_attribute_as_array_of(:images, data.delete(:images), Epages::Image)
  parse_attribute_as_array_of(:links, data.delete(:links), Epages::Link)
  parse_attribute_as(:quantity, data.delete(:quantity))
  parse_attribute_as(:line_item_price, data.delete(:lineItemPrice), Epages::Price)
  parse_attribute_as(:single_item_price, data.delete(:singleItemPrice), Epages::Price)
  parse_attributes(data)
end