Class: Square::Connect::Itemization
- Inherits:
-
Object
- Object
- Square::Connect::Itemization
- Defined in:
- lib/square/connect/itemization.rb
Instance Attribute Summary collapse
-
#discount_money ⇒ Object
Returns the value of attribute discount_money.
-
#discounts ⇒ Object
Returns the value of attribute discounts.
-
#gross_sales_money ⇒ Object
Returns the value of attribute gross_sales_money.
-
#item_detail ⇒ Object
Returns the value of attribute item_detail.
-
#item_variation_name ⇒ Object
Returns the value of attribute item_variation_name.
-
#name ⇒ Object
Returns the value of attribute name.
-
#notes ⇒ Object
Returns the value of attribute notes.
-
#quantity ⇒ Object
Returns the value of attribute quantity.
-
#single_quantity_money ⇒ Object
Returns the value of attribute single_quantity_money.
-
#taxes ⇒ Object
Returns the value of attribute taxes.
-
#total_money ⇒ Object
Returns the value of attribute total_money.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Itemization
constructor
A new instance of Itemization.
Constructor Details
#initialize(attributes = {}) ⇒ Itemization
Returns a new instance of Itemization.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/square/connect/itemization.rb', line 6 def initialize(attributes = {}) self.name = attributes[:name] self.quantity = attributes[:quantity] self.item_detail = if attributes[:item_detail].present? ItemDetail.new attributes[:item_detail] end self.notes = attributes[:notes] self.item_variation_name = attributes[:item_variation_name] [ :total_money, :single_quantity_money, :gross_sales_money, :discount_money ].each do |money_key| if attributes[money_key] self.send "#{money_key}=", Money.new(attributes[money_key]) end end self.taxes = Array(attributes[:taxes]).collect do |tax_attributes| Tax.new tax_attributes end self.discounts = Array(attributes[:discounts]).collect do |discount_attributes| Discount.new discount_attributes end end |
Instance Attribute Details
#discount_money ⇒ Object
Returns the value of attribute discount_money.
4 5 6 |
# File 'lib/square/connect/itemization.rb', line 4 def discount_money @discount_money end |
#discounts ⇒ Object
Returns the value of attribute discounts.
4 5 6 |
# File 'lib/square/connect/itemization.rb', line 4 def discounts @discounts end |
#gross_sales_money ⇒ Object
Returns the value of attribute gross_sales_money.
4 5 6 |
# File 'lib/square/connect/itemization.rb', line 4 def gross_sales_money @gross_sales_money end |
#item_detail ⇒ Object
Returns the value of attribute item_detail.
4 5 6 |
# File 'lib/square/connect/itemization.rb', line 4 def item_detail @item_detail end |
#item_variation_name ⇒ Object
Returns the value of attribute item_variation_name.
4 5 6 |
# File 'lib/square/connect/itemization.rb', line 4 def item_variation_name @item_variation_name end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/square/connect/itemization.rb', line 4 def name @name end |
#notes ⇒ Object
Returns the value of attribute notes.
4 5 6 |
# File 'lib/square/connect/itemization.rb', line 4 def notes @notes end |
#quantity ⇒ Object
Returns the value of attribute quantity.
4 5 6 |
# File 'lib/square/connect/itemization.rb', line 4 def quantity @quantity end |
#single_quantity_money ⇒ Object
Returns the value of attribute single_quantity_money.
4 5 6 |
# File 'lib/square/connect/itemization.rb', line 4 def single_quantity_money @single_quantity_money end |
#taxes ⇒ Object
Returns the value of attribute taxes.
4 5 6 |
# File 'lib/square/connect/itemization.rb', line 4 def taxes @taxes end |
#total_money ⇒ Object
Returns the value of attribute total_money.
4 5 6 |
# File 'lib/square/connect/itemization.rb', line 4 def total_money @total_money end |