Class: Falsify::PriceSet
- Inherits:
-
Object
- Object
- Falsify::PriceSet
- Defined in:
- lib/falsify/models/order/price_set.rb
Overview
A PriceSet contains a price in both shop and presentment currencies.
Used for:
- price_set
- discounted_price_set
- total_discounts_set
- total_line_items_price_set
- total_price_set
- total_tax_set
- discount_allocations.amount_set
Instance Attribute Summary collapse
- #presentment_money_amount ⇒ String
- #presentment_money_currency_code ⇒ String
- #shop_money_amount ⇒ String
- #shop_money_currency_code ⇒ String
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#presentment_money_amount ⇒ String
18 19 20 |
# File 'lib/falsify/models/order/price_set.rb', line 18 def presentment_money_amount @presentment_money_amount end |
#presentment_money_currency_code ⇒ String
20 21 22 |
# File 'lib/falsify/models/order/price_set.rb', line 20 def presentment_money_currency_code @presentment_money_currency_code end |
#shop_money_amount ⇒ String
14 15 16 |
# File 'lib/falsify/models/order/price_set.rb', line 14 def shop_money_amount @shop_money_amount end |
#shop_money_currency_code ⇒ String
16 17 18 |
# File 'lib/falsify/models/order/price_set.rb', line 16 def shop_money_currency_code @shop_money_currency_code end |
Class Method Details
.create_from_hash(hash) ⇒ PriceSet
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/falsify/models/order/price_set.rb', line 24 def self.create_from_hash(hash) ps = PriceSet.new() shop_money = hash[:shop_money] ps.shop_money_amount = shop_money[:amount] ps.shop_money_currency_code = shop_money[:currency_code] presentment_money = hash[:presentment_money] ps.presentment_money_amount = presentment_money[:amount] ps.presentment_money_currency_code = presentment_money[:currency_code] return ps end |
Instance Method Details
#to_hash ⇒ Hash
39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/falsify/models/order/price_set.rb', line 39 def to_hash() return { 'shop_money': { "amount": @shop_money_amount, "currency_code": @shop_money_currency_code, }, 'presentment_money': { "amount": @presentment_money_amount, "currency_code": @presentment_money_currency_code, }, } end |