Class: Elibri::ONIX::Release_3_0::SalesRestriction
- Inherits:
-
Object
- Object
- Elibri::ONIX::Release_3_0::SalesRestriction
- Defined in:
- lib/elibri_onix/onix_3_0/sales_restriction.rb
Instance Attribute Summary collapse
-
#end_date ⇒ Object
Returns the value of attribute end_date.
-
#outlet_code ⇒ Object
Returns the value of attribute outlet_code.
-
#outlet_name ⇒ Object
Returns the value of attribute outlet_name.
-
#to_xml ⇒ Object
Returns the value of attribute to_xml.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(data) ⇒ SalesRestriction
constructor
A new instance of SalesRestriction.
Constructor Details
#initialize(data) ⇒ SalesRestriction
Returns a new instance of SalesRestriction.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/elibri_onix/onix_3_0/sales_restriction.rb', line 8 def initialize(data) @to_xml = data.to_s @type = data.at_css('SalesRestrictionType')&.text&.to_i if data.at_css('SalesOutlet') @outlet_name = data.at_css('SalesOutlet').at_css('SalesOutletName')&.text outlet_id_struct = data.at_css('SalesOutlet').at_css('SalesOutletIdentifier') if outlet_id_struct && outlet_id_struct.at_css("SalesOutletIDType")&.text == "03" @outlet_code = outlet_id_struct.at_css("IDValue")&.text end end @end_date = Date.parse(data.at_css('EndDate')&.text) if data.at_css('EndDate') end |
Instance Attribute Details
#end_date ⇒ Object
Returns the value of attribute end_date.
6 7 8 |
# File 'lib/elibri_onix/onix_3_0/sales_restriction.rb', line 6 def end_date @end_date end |
#outlet_code ⇒ Object
Returns the value of attribute outlet_code.
6 7 8 |
# File 'lib/elibri_onix/onix_3_0/sales_restriction.rb', line 6 def outlet_code @outlet_code end |
#outlet_name ⇒ Object
Returns the value of attribute outlet_name.
6 7 8 |
# File 'lib/elibri_onix/onix_3_0/sales_restriction.rb', line 6 def outlet_name @outlet_name end |
#to_xml ⇒ Object
Returns the value of attribute to_xml.
6 7 8 |
# File 'lib/elibri_onix/onix_3_0/sales_restriction.rb', line 6 def to_xml @to_xml end |
#type ⇒ Object
Returns the value of attribute type.
6 7 8 |
# File 'lib/elibri_onix/onix_3_0/sales_restriction.rb', line 6 def type @type end |