Class: Elibri::ONIX::Release_3_0::Price
- Inherits:
-
Object
- Object
- Elibri::ONIX::Release_3_0::Price
- Defined in:
- lib/elibri_onix/onix_3_0/price.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#currency_code ⇒ Object
Returns the value of attribute currency_code.
-
#minimum_order_quantity ⇒ Object
Returns the value of attribute minimum_order_quantity.
-
#position_on_product ⇒ Object
Returns the value of attribute position_on_product.
-
#price_constraint_limits ⇒ Object
Returns the value of attribute price_constraint_limits.
-
#price_identifier ⇒ Object
Returns the value of attribute price_identifier.
-
#price_qualifier ⇒ Object
Returns the value of attribute price_qualifier.
-
#printed_on_product ⇒ Object
Returns the value of attribute printed_on_product.
-
#tax_rate_percent ⇒ Object
Returns the value of attribute tax_rate_percent.
-
#tax_type ⇒ Object
Returns the value of attribute tax_type.
-
#to_xml ⇒ Object
Returns the value of attribute to_xml.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(data) ⇒ Price
constructor
A new instance of Price.
- #printed_on_product? ⇒ Boolean
- #vat ⇒ Object
Constructor Details
#initialize(data) ⇒ Price
Returns a new instance of Price.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/elibri_onix/onix_3_0/price.rb', line 10 def initialize(data) @to_xml = data.to_s @type = data.at_css('PriceType')&.text @price_qualifier = data.at_css("PriceQualifier")&.text @minimum_order_quantity = data.at_css('MinimumOrderQuantity')&.text&.to_i @amount = BigDecimal(data.at_css('PriceAmount')&.text) @currency_code = data.at_css('CurrencyCode')&.text @printed_on_product = data.at_css('PrintedOnProduct')&.text @position_on_product = data.at_css('PositionOnProduct')&.text if data.at_css('Tax') @tax_type = data.at_css('Tax').at_css('TaxType')&.text @tax_rate_percent = data.at_css('Tax').at_css('TaxRatePercent').text.to_i if data.at_css('Tax').at_css('TaxRatePercent') end @price_constraint_limits = data.css("PriceConstraintLimit").map { |pc| PriceConstraintLimit.new(pc) } if pi = data.at_css("PriceIdentifier") @price_identifier = PriceIdentifier.new(pi) end end |
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
7 8 9 |
# File 'lib/elibri_onix/onix_3_0/price.rb', line 7 def amount @amount end |
#currency_code ⇒ Object
Returns the value of attribute currency_code.
7 8 9 |
# File 'lib/elibri_onix/onix_3_0/price.rb', line 7 def currency_code @currency_code end |
#minimum_order_quantity ⇒ Object
Returns the value of attribute minimum_order_quantity.
7 8 9 |
# File 'lib/elibri_onix/onix_3_0/price.rb', line 7 def minimum_order_quantity @minimum_order_quantity end |
#position_on_product ⇒ Object
Returns the value of attribute position_on_product.
7 8 9 |
# File 'lib/elibri_onix/onix_3_0/price.rb', line 7 def position_on_product @position_on_product end |
#price_constraint_limits ⇒ Object
Returns the value of attribute price_constraint_limits.
7 8 9 |
# File 'lib/elibri_onix/onix_3_0/price.rb', line 7 def price_constraint_limits @price_constraint_limits end |
#price_identifier ⇒ Object
Returns the value of attribute price_identifier.
7 8 9 |
# File 'lib/elibri_onix/onix_3_0/price.rb', line 7 def price_identifier @price_identifier end |
#price_qualifier ⇒ Object
Returns the value of attribute price_qualifier.
7 8 9 |
# File 'lib/elibri_onix/onix_3_0/price.rb', line 7 def price_qualifier @price_qualifier end |
#printed_on_product ⇒ Object
Returns the value of attribute printed_on_product.
7 8 9 |
# File 'lib/elibri_onix/onix_3_0/price.rb', line 7 def printed_on_product @printed_on_product end |
#tax_rate_percent ⇒ Object
Returns the value of attribute tax_rate_percent.
7 8 9 |
# File 'lib/elibri_onix/onix_3_0/price.rb', line 7 def tax_rate_percent @tax_rate_percent end |
#tax_type ⇒ Object
Returns the value of attribute tax_type.
7 8 9 |
# File 'lib/elibri_onix/onix_3_0/price.rb', line 7 def tax_type @tax_type end |
#to_xml ⇒ Object
Returns the value of attribute to_xml.
7 8 9 |
# File 'lib/elibri_onix/onix_3_0/price.rb', line 7 def to_xml @to_xml end |
#type ⇒ Object
Returns the value of attribute type.
7 8 9 |
# File 'lib/elibri_onix/onix_3_0/price.rb', line 7 def type @type end |
Instance Method Details
#printed_on_product? ⇒ Boolean
29 30 31 |
# File 'lib/elibri_onix/onix_3_0/price.rb', line 29 def printed_on_product? @printed_on_product == "02" end |