Class: Elibri::ONIX::Release_3_0::SupplyDetail
- Inherits:
-
Object
- Object
- Elibri::ONIX::Release_3_0::SupplyDetail
- Defined in:
- lib/elibri_onix/onix_3_0/supply_detail.rb
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.
-
#prices ⇒ Object
Returns the value of attribute prices.
-
#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
Constructor Details
#initialize(data) ⇒ SupplyDetail
Returns a new instance of SupplyDetail.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/elibri_onix/onix_3_0/supply_detail.rb', line 9 def initialize(data) @to_xml = data.to_s @relation_code = data.at_css('ProductRelationCode')&.text&.to_i @supplier = Supplier.new(data.at_css('Supplier')) if data.at_css('Supplier') @product_availability = data.at_css('ProductAvailability')&.text&.to_i @pack_quantity = data.at_css('PackQuantity')&.text&.to_i @prices = data.css("Price").map { |p| Price.new(p) } if data.at_css('Stock') @on_hand = data.at_css('Stock').at_css('OnHand')&.text&.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.
6 7 8 |
# File 'lib/elibri_onix/onix_3_0/supply_detail.rb', line 6 def additional_trade_information @additional_trade_information end |
#on_hand ⇒ Object
Returns the value of attribute on_hand.
6 7 8 |
# File 'lib/elibri_onix/onix_3_0/supply_detail.rb', line 6 def on_hand @on_hand end |
#pack_quantity ⇒ Object
Returns the value of attribute pack_quantity.
6 7 8 |
# File 'lib/elibri_onix/onix_3_0/supply_detail.rb', line 6 def pack_quantity @pack_quantity end |
#prices ⇒ Object
Returns the value of attribute prices.
6 7 8 |
# File 'lib/elibri_onix/onix_3_0/supply_detail.rb', line 6 def prices @prices end |
#product_availability ⇒ Object
Returns the value of attribute product_availability.
6 7 8 |
# File 'lib/elibri_onix/onix_3_0/supply_detail.rb', line 6 def product_availability @product_availability end |
#quantity_coded ⇒ Object
Returns the value of attribute quantity_coded.
6 7 8 |
# File 'lib/elibri_onix/onix_3_0/supply_detail.rb', line 6 def quantity_coded @quantity_coded end |
#relation_code ⇒ Object
Returns the value of attribute relation_code.
6 7 8 |
# File 'lib/elibri_onix/onix_3_0/supply_detail.rb', line 6 def relation_code @relation_code end |
#supplier ⇒ Object
Returns the value of attribute supplier.
6 7 8 |
# File 'lib/elibri_onix/onix_3_0/supply_detail.rb', line 6 def supplier @supplier end |
#to_xml ⇒ Object
Returns the value of attribute to_xml.
6 7 8 |
# File 'lib/elibri_onix/onix_3_0/supply_detail.rb', line 6 def to_xml @to_xml end |
Instance Method Details
#quantity_code ⇒ Object
27 28 29 |
# File 'lib/elibri_onix/onix_3_0/supply_detail.rb', line 27 def quantity_code @quantity_coded&.code end |