Class: ONIX::SalesRestriction

Inherits:
SubsetDSL show all
Defined in:
lib/onix/sales_restriction.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from SubsetDSL

_ancestor_registered_scopes, _ancestors_registered_elements, ancestor_registered_scopes, ancestors_registered_elements, element, elements, get_class, ref_to_short, registered_elements, registered_scopes, scope, short_to_ref, #unsupported

Methods inherited from Subset

parse, #tag_match, tag_match, #unsupported

Constructor Details

#initializeSalesRestriction

Returns a new instance of SalesRestriction.



19
20
21
# File 'lib/onix/sales_restriction.rb', line 19

def initialize
  @sales_outlets=[]
end

Instance Attribute Details

#end_dateObject

Returns the value of attribute end_date.



8
9
10
# File 'lib/onix/sales_restriction.rb', line 8

def end_date
  @end_date
end

#start_dateObject

Returns the value of attribute start_date.



8
9
10
# File 'lib/onix/sales_restriction.rb', line 8

def start_date
  @start_date
end

Instance Method Details

#noteObject



15
16
17
# File 'lib/onix/sales_restriction.rb', line 15

def note
  @sales_restriction_note
end

#parse(n) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/onix/sales_restriction.rb', line 23

def parse(n)
  super
  n.elements.each do |t|
    case t
      when tag_match("StartDate")
        fmt=t["dateformat"] || "00"
        @start_date=ONIX::Helper.to_date(fmt,t.text)
      when tag_match("EndDate")
        fmt=t["dateformat"] || "00"
        @end_date=ONIX::Helper.to_date(fmt,t.text)
    end
  end
end

#typeObject

shortcuts



11
12
13
# File 'lib/onix/sales_restriction.rb', line 11

def type
  @sales_restriction_type
end