Sha256: d1ba2ee1fb95d965887f68f7c9d3faa26e20e633093007ece5400bbe1751f9b3

Contents?: true

Size: 669 Bytes

Versions: 5

Compression:

Stored size: 669 Bytes

Contents

require 'date'
require 'time'

module SparkApi
  module Models
    class TourOfHome < Base
      extend Subresource

      self.element_name = "tourofhomes"
      
      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

5 entries across 5 versions & 1 rubygems

Version Path
spark_api-1.1.0 lib/spark_api/models/tour_of_home.rb
spark_api-1.0.4 lib/spark_api/models/tour_of_home.rb
spark_api-1.0.2 lib/spark_api/models/tour_of_home.rb
spark_api-1.0.1 lib/spark_api/models/tour_of_home.rb
spark_api-1.0.0 lib/spark_api/models/tour_of_home.rb