=begin Marketcheck Cars API Access the New, Used and Certified cars inventories for all Car Dealers in US.
The data is sourced from online listings by over 40,000 Car dealers in US. At any time, there are about 5.2M searchable listings (about 1.8M unique VINs) for Used & Certified cars and about 5M (about 2.3M unique VINs) New Car listings from all over US. We use this API at the back for our website www.marketcheck.com and our Android and iOS mobile apps too.
Few useful links :
OpenAPI spec version: 1.0.3 Generated by: https://github.com/swagger-api/swagger-codegen.git =end require 'date' module SwaggerClient # Represents a car history entry class HistoricalListing # Unique identifier representing a specific listing from the Marketcheck database attr_accessor :id # Asking price for the car attr_accessor :price # MSRP for the car attr_accessor :msrp # Odometer reading / reported miles usage for the car attr_accessor :miles # Vehicle Details Page url of the specific car attr_accessor :vdp_url # Seller name of the listing from the Marketcheck database attr_accessor :seller_name # Listing scraped at timestamp attr_accessor :scraped_at # Listing last seen at (most recent) timestamp attr_accessor :last_seen_at # Source website for the listing attr_accessor :source # City of the listing attr_accessor :city # State of the listing attr_accessor :state # Zip of the listing attr_accessor :zip # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'id' => :'id', :'price' => :'price', :'msrp' => :'msrp', :'miles' => :'miles', :'vdp_url' => :'vdp_url', :'seller_name' => :'seller_name', :'scraped_at' => :'scraped_at', :'last_seen_at' => :'last_seen_at', :'source' => :'source', :'city' => :'city', :'state' => :'state', :'zip' => :'zip' } end # Attribute type mapping. def self.swagger_types { :'id' => :'String', :'price' => :'String', :'msrp' => :'String', :'miles' => :'String', :'vdp_url' => :'String', :'seller_name' => :'String', :'scraped_at' => :'Float', :'last_seen_at' => :'Float', :'source' => :'String', :'city' => :'String', :'state' => :'String', :'zip' => :'String' } end def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo} if attributes[:'id'] self.id = attributes[:'id'] end if attributes[:'price'] self.price = attributes[:'price'] end if attributes[:'msrp'] self.msrp = attributes[:'msrp'] end if attributes[:'miles'] self.miles = attributes[:'miles'] end if attributes[:'vdp_url'] self.vdp_url = attributes[:'vdp_url'] end if attributes[:'seller_name'] self.seller_name = attributes[:'seller_name'] end if attributes[:'scraped_at'] self.scraped_at = attributes[:'scraped_at'] end if attributes[:'last_seen_at'] self.last_seen_at = attributes[:'last_seen_at'] end if attributes[:'source'] self.source = attributes[:'source'] end if attributes[:'city'] self.city = attributes[:'city'] end if attributes[:'state'] self.state = attributes[:'state'] end if attributes[:'zip'] self.zip = attributes[:'zip'] end end # Check equality by comparing each attribute. def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && price == o.price && msrp == o.msrp && miles == o.miles && vdp_url == o.vdp_url && seller_name == o.seller_name && scraped_at == o.scraped_at && last_seen_at == o.last_seen_at && source == o.source && city == o.city && state == o.state && zip == o.zip end # @see the `==` method def eql?(o) self == o end # Calculate hash code according to all attributes. def hash [id, price, msrp, miles, vdp_url, seller_name, scraped_at, last_seen_at, source, city, state, zip].hash end # build the object from hash def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /^Array<(.*)>/i if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) else #TODO show warning in debug mode end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) else # data not found in attributes(hash), not an issue as the data can be optional end end self end def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :BOOLEAN if value.to_s =~ /^(true|t|yes|y|1)$/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?.+), (?.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model _model = SwaggerClient.const_get(type).new _model.build_from_hash(value) end end def to_s to_hash.to_s end # to_body is an alias to to_body (backward compatibility)) def to_body to_hash end # return the object in the form of hash def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end # Method to output non-array value in the form of hash # For object, use to_hash. Otherwise, just return the value def _to_hash(value) if value.is_a?(Array) value.compact.map{ |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end end end