lib/myjohndeere/json_attributes.rb in myjohndeere-0.0.10 vs lib/myjohndeere/json_attributes.rb in myjohndeere-0.0.11

- old
+ new

@@ -20,10 +20,12 @@ def setup_attributes(json_data) return if self.class.json_attributes.nil? self.class.json_attributes.each do |attrib| attrib = attrib.to_s val = json_data[attrib] - if /(date)|(timestamp)/i.match(attrib) then + if val =~ /\A(true)|(false)\z/i then + val = /true/i.match(val) ? true : false + elsif /(date)|(timestamp)|(time\Z)/i.match(attrib) then # try to parse it val = Time.parse(val) rescue val end instance_variable_set("@#{attrib.underscore}", val) end \ No newline at end of file