lib/cloudapp/base.rb
def load(attributes = {})
      attributes.each do |key, val|
        if key =~ /^.*_at$/ and val
          # if this is a date/time key and it's not nil, try to parse it first
          # as DateTime, then as Date only
          begin
            dt = DateTime.strptime(val, "%Y-%m-%dT%H:%M:%SZ")
            newval = Time.utc(dt.year, dt.month, dt.day, dt.hour, dt.min, dt.sec)
          rescue ArgumentError => ex
            newval = DateTime.strptime(val, "%Y-%m-%d")
          end
          self.instance_variable_set("@#{key}", newval)
        else
          self.instance_variable_set("@#{key}", val)
        end
      end
    end
def load(attributes = {})
      attributes.each do |key, val|
        if key =~ /^.*_at$/ and val
          # if this is a date/time key and it's not nil, try to parse it first
          # as DateTime, then as Date only
          begin
            dt = DateTime.strptime(val, "%Y-%m-%dT%H:%M:%SZ")
            newval = Time.utc(dt.year, dt.month, dt.day, dt.hour, dt.min, dt.sec)
          rescue ArgumentError => ex
            newval = DateTime.strptime(val, "%Y-%m-%d")
          end
          self.instance_variable_set("@#{key}", newval)
        else
          self.instance_variable_set("@#{key}", val)
        end
      end
    end
Sets the attributes for object.

 @param [Hash] attributes