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, :additional_trade_information ]
- RELATIONS =
[]
Constants included from HashId
HashId::SKIPPED_2, HashId::SKIPPED_ATTRIBS
Instance Attribute Summary collapse
-
#additional_trade_information ⇒ Object
Returns the value of attribute additional_trade_information.
-
#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 37 38 39 40 41 |
# File 'lib/elibri_onix/onix_3_0/supply_detail.rb', line 25 def initialize(data) @to_xml = data.to_s @relation_code = data.at_css('ProductRelationCode').try(:text).try(:to_i) @supplier = Supplier.new(data.at_css('Supplier')) if data.at_css('Supplier') @product_availability = data.at_css('ProductAvailability').try(:text).try(:to_i) @pack_quantity = data.at_css('PackQuantity').try(:text).try(:to_i) @price = Price.new(data.at_css('Price')) if data.at_css('Price') if data.at_css('Stock') @on_hand = data.at_css('Stock').at_css('OnHand').try(:text).try(:to_i) @quantity_coded = StockQuantityCoded.new(data.at_css('Stock').at_css('StockQuantityCoded')) if data.at_css('Stock').at_css('StockQuantityCoded') end if own_coding = data.at_css('SupplierOwnCoding') if own_coding.at_css('SupplierCodeType').text == Elibri::ONIX::Dict::Release_3_0::SupplierOwnCodeType::SUPPLIERS_SALES_CLASSIFICATION @additional_trade_information = own_coding.at_css('SupplierCodeValue').text end end end |
Instance Attribute Details
#additional_trade_information ⇒ Object
Returns the value of attribute additional_trade_information.
21 22 23 |
# File 'lib/elibri_onix/onix_3_0/supply_detail.rb', line 21 def additional_trade_information @additional_trade_information end |
#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
43 44 45 |
# File 'lib/elibri_onix/onix_3_0/supply_detail.rb', line 43 def quantity_code @quantity_coded.try(:code) end |