Class: FreshBooks::XmlSerializer::DateTimeSerializer

Inherits:
Object
  • Object
show all
Defined in:
lib/freshbooks/xml_serializer/serializers.rb

Class Method Summary collapse

Class Method Details

.to_node(member_name, value) ⇒ Object



96
97
98
99
100
# File 'lib/freshbooks/xml_serializer/serializers.rb', line 96

def self.to_node(member_name, value)
  element = REXML::Element.new(member_name)
  element.text = value.to_s(:db)
  element
end

.to_value(xml_val) ⇒ Object



102
103
104
# File 'lib/freshbooks/xml_serializer/serializers.rb', line 102

def self.to_value(xml_val)
  DateTime.parse(xml_val.text.to_s) 
end