Class: Epages::LineItemContainer

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

Constant Summary collapse

KEYS =
%w(grand_total total_before_tax total_tax line_items_sub_total product_line_items shipping_price
coupon_line_item deposits eco_participations shipping_options basket_discount).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) ⇒ LineItemContainer

Returns a new instance of LineItemContainer.



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

def initialize(data)
  parse_attribute_as(:grand_total, data[:grandTotal], Epages::Price)
  parse_attribute_as(:total_before_tax, data[:totalBeforeTax], Epages::Price)
  parse_attribute_as(:total_tax, data[:totalTax], Epages::Price)
  parse_attribute_as(:line_items_sub_total, data[:lineItemsSubTotal], Epages::Price)
  parse_attribute_as_array_of(:product_line_items, data[:productLineItems], Epages::ProductLineItem)
end