Class: AdfBuilder::RequestDate

Inherits:
Object
  • Object
show all
Defined in:
lib/adf_builder/base/request_date.rb

Constant Summary collapse

WITH_SYMBOLS =
'%FT%T%:z'
WITHOUT_SYMBOLS =
'%Y%m%dT%H%M%S%z'

Instance Method Summary collapse

Constructor Details

#initialize(prospect_node) ⇒ RequestDate

Returns a new instance of RequestDate.



6
7
8
9
10
# File 'lib/adf_builder/base/request_date.rb', line 6

def initialize(prospect_node)
  @request_date_node = Ox::Element.new('requestdate')
  @request_date_node << DateTime.now.strftime('%FT%T%:z')
  prospect_node << @request_date_node
end

Instance Method Details

#update_val(datetime_value, format = 1) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/adf_builder/base/request_date.rb', line 12

def update_val(datetime_value, format=1)
  if format == 1
    @request_date_node.replace_text(datetime_value.strftime(WITH_SYMBOLS))
  elsif format == 2
    @request_date_node.replace_text(datetime_value.strftime(WITHOUT_SYMBOLS))
  end
end