Class: Elibri::ONIX::Release_3_0::SalesRestriction

Inherits:
Object
  • Object
show all
Includes:
HashId
Defined in:
lib/elibri_onix/onix_3_0/sales_restriction.rb

Constant Summary collapse

ATTRIBUTES =
[
  :type, :outlet_name, :end_date
]
RELATIONS =
[]

Constants included from HashId

HashId::SKIPPED_2, HashId::SKIPPED_ATTRIBS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HashId

#calculate_hash, #eid

Constructor Details

#initialize(data) ⇒ SalesRestriction

Returns a new instance of SalesRestriction.



24
25
26
27
28
29
30
31
# File 'lib/elibri_onix/onix_3_0/sales_restriction.rb', line 24

def initialize(data)
  @to_xml = data.to_s
  @type = data.at_xpath('xmlns:SalesRestrictionType').try(:text).try(:to_i)
  if data.at_xpath('xmlns:SalesOutlet')
    @outlet_name = data.at_xpath('xmlns:SalesOutlet').at_xpath('xmlns:SalesOutletName').try(:text)
  end
  @end_date = Date.parse(data.at_xpath('xmlns:EndDate').try(:text)) if data.at_xpath('xmlns:EndDate')
end

Instance Attribute Details

#end_dateObject

Returns the value of attribute end_date.



22
23
24
# File 'lib/elibri_onix/onix_3_0/sales_restriction.rb', line 22

def end_date
  @end_date
end

#outlet_nameObject

Returns the value of attribute outlet_name.



22
23
24
# File 'lib/elibri_onix/onix_3_0/sales_restriction.rb', line 22

def outlet_name
  @outlet_name
end

#to_xmlObject

Returns the value of attribute to_xml.



22
23
24
# File 'lib/elibri_onix/onix_3_0/sales_restriction.rb', line 22

def to_xml
  @to_xml
end

#typeObject

Returns the value of attribute type.



22
23
24
# File 'lib/elibri_onix/onix_3_0/sales_restriction.rb', line 22

def type
  @type
end