Class: Elibri::ONIX::Release_3_0::PriceConstraintLimit

Inherits:
Object
  • Object
show all
Defined in:
lib/elibri_onix/onix_3_0/price_constraint_limit.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ PriceConstraintLimit



8
9
10
11
12
13
14
15
16
17
# File 'lib/elibri_onix/onix_3_0/price_constraint_limit.rb', line 8

def initialize(data)
  @to_xml = data.to_s
  @unit = data.at_css('PriceConstraintUnit')&.text
  @value = data.at_css("Quantity")&.text
  if @unit == Elibri::ONIX::Dict::Release_3_0::PriceConstraintUnit::VALID_FROM
    @value = Date.new(@value[0...4].to_i, @value[4...6].to_i, @value[6...8].to_i)
  else
    @value = @value.to_i
  end
end

Instance Attribute Details

#to_xmlObject

Returns the value of attribute to_xml.



6
7
8
# File 'lib/elibri_onix/onix_3_0/price_constraint_limit.rb', line 6

def to_xml
  @to_xml
end

#unitObject

Returns the value of attribute unit.



6
7
8
# File 'lib/elibri_onix/onix_3_0/price_constraint_limit.rb', line 6

def unit
  @unit
end

#valueObject

Returns the value of attribute value.



6
7
8
# File 'lib/elibri_onix/onix_3_0/price_constraint_limit.rb', line 6

def value
  @value
end