Class: Elibri::ONIX::Release_3_0::SupplyDetail
- Inherits:
-
Object
- Object
- Elibri::ONIX::Release_3_0::SupplyDetail
- Includes:
- HashId
- Defined in:
- lib/elibri_onix/onix_3_0/supply_detail.rb
Constant Summary collapse
- ATTRIBUTES =
[ :relation_code, :supplier, :product_availability, :pack_quantity, :price, :on_hand, :quantity_coded, :quantity_code ]
- RELATIONS =
[]
Constants included from HashId
HashId::SKIPPED_2, HashId::SKIPPED_ATTRIBS
Instance Attribute Summary collapse
-
#on_hand ⇒ Object
Returns the value of attribute on_hand.
-
#pack_quantity ⇒ Object
Returns the value of attribute pack_quantity.
-
#price ⇒ Object
Returns the value of attribute price.
-
#product_availability ⇒ Object
Returns the value of attribute product_availability.
-
#quantity_coded ⇒ Object
Returns the value of attribute quantity_coded.
-
#relation_code ⇒ Object
Returns the value of attribute relation_code.
-
#supplier ⇒ Object
Returns the value of attribute supplier.
-
#to_xml ⇒ Object
Returns the value of attribute to_xml.
Instance Method Summary collapse
-
#initialize(data) ⇒ SupplyDetail
constructor
A new instance of SupplyDetail.
- #quantity_code ⇒ Object
Methods included from HashId
Constructor Details
#initialize(data) ⇒ SupplyDetail
Returns a new instance of SupplyDetail.
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/elibri_onix/onix_3_0/supply_detail.rb', line 25 def initialize(data) @to_xml = data.to_s @relation_code = data.at_xpath('xmlns:ProductRelationCode').try(:text).try(:to_i) @supplier = Supplier.new(data.at_xpath('xmlns:Supplier')) if data.at_xpath('xmlns:Supplier') @product_availability = data.at_xpath('xmlns:ProductAvailability').try(:text).try(:to_i) @pack_quantity = data.at_xpath('xmlns:PackQuantity').try(:text).try(:to_i) @price = Price.new(data.at_xpath('xmlns:Price')) if data.at_xpath('xmlns:Price') if data.at_xpath('xmlns:Stock') @on_hand = data.at_xpath('xmlns:Stock').at_xpath('xmlns:OnHand').try(:text).try(:to_i) @quantity_coded = StockQuantityCoded.new(data.at_xpath('xmlns:Stock').at_xpath('xmlns:StockQuantityCoded')) if data.at_xpath('xmlns:Stock').at_xpath('xmlns:StockQuantityCoded') end end |
Instance Attribute Details
#on_hand ⇒ Object
Returns the value of attribute on_hand.
21 22 23 |
# File 'lib/elibri_onix/onix_3_0/supply_detail.rb', line 21 def on_hand @on_hand end |
#pack_quantity ⇒ Object
Returns the value of attribute pack_quantity.
21 22 23 |
# File 'lib/elibri_onix/onix_3_0/supply_detail.rb', line 21 def pack_quantity @pack_quantity end |
#price ⇒ Object
Returns the value of attribute price.
21 22 23 |
# File 'lib/elibri_onix/onix_3_0/supply_detail.rb', line 21 def price @price end |
#product_availability ⇒ Object
Returns the value of attribute product_availability.
21 22 23 |
# File 'lib/elibri_onix/onix_3_0/supply_detail.rb', line 21 def product_availability @product_availability end |
#quantity_coded ⇒ Object
Returns the value of attribute quantity_coded.
21 22 23 |
# File 'lib/elibri_onix/onix_3_0/supply_detail.rb', line 21 def quantity_coded @quantity_coded end |
#relation_code ⇒ Object
Returns the value of attribute relation_code.
21 22 23 |
# File 'lib/elibri_onix/onix_3_0/supply_detail.rb', line 21 def relation_code @relation_code end |
#supplier ⇒ Object
Returns the value of attribute supplier.
21 22 23 |
# File 'lib/elibri_onix/onix_3_0/supply_detail.rb', line 21 def supplier @supplier end |
#to_xml ⇒ Object
Returns the value of attribute to_xml.
21 22 23 |
# File 'lib/elibri_onix/onix_3_0/supply_detail.rb', line 21 def to_xml @to_xml end |
Instance Method Details
#quantity_code ⇒ Object
38 39 40 |
# File 'lib/elibri_onix/onix_3_0/supply_detail.rb', line 38 def quantity_code @quantity_coded.try(:code) end |