Sha256: e622686c4fed8cdc7e7b9bdfd62fa01a669051f4d9015ec32c14da29d72f730b

Contents?: true

Size: 669 Bytes

Versions: 7

Compression:

Stored size: 669 Bytes

Contents

require 'date'
require 'time'

module FlexmlsApi
  module Models
    class OpenHouse < Base
      extend Subresource

      self.element_name = "openhouses"
      
      def initialize(attributes={})
        # Transform the date strings
        unless attributes['Date'].nil?
          date = Date.parse(attributes['Date'])
          attributes['Date'] = date
          attributes['StartTime'] = Time.parse("#{date}T#{attributes['StartTime']}") unless attributes['StartTime'].nil?
          attributes['EndTime'] = Time.parse("#{date}T#{attributes['EndTime']}") unless attributes['EndTime'].nil?
        end
        super(attributes)
      end
      
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
spark_api-1.0.2 lib/spark_api/models/open_house.rb~
spark_api-1.0.1 lib/spark_api/models/open_house.rb~
spark_api-1.0.0 lib/spark_api/models/open_house.rb~
flexmls_api-0.7.3 lib/flexmls_api/models/open_house.rb
flexmls_api-0.7.5 lib/flexmls_api/models/open_house.rb
flexmls_api-0.7.0 lib/flexmls_api/models/open_house.rb
flexmls_api-0.6.5 lib/flexmls_api/models/open_house.rb