Class: SwaggerClient::Dealer
- Inherits:
-
Object
- Object
- SwaggerClient::Dealer
- Defined in:
- lib/swagger_client/models/dealer.rb
Instance Attribute Summary collapse
-
#car_type ⇒ Object
Car type new|used|certified.
-
#city ⇒ Object
City of the dealer.
-
#dealer_type ⇒ Object
Dealer type - independent, franchise, multi-brand, authorized.
-
#franchise_id ⇒ Object
Dealer franchise id.
-
#id ⇒ Object
The unique id associated with the dealer in the Marketcheck database.
-
#latitude ⇒ Object
Latutide for the dealer location.
-
#longitude ⇒ Object
Longitude for the dealer location.
-
#name ⇒ Object
Name of the dealer.
-
#phone ⇒ Object
Contact no of the dealer.
-
#rating ⇒ Object
Overall rating of the dealership on scale 1-5.
-
#state ⇒ Object
State of the dealer.
-
#street ⇒ Object
Street of the dealer.
-
#target_url_certified ⇒ Object
Target url for the certified cars listing.
-
#target_url_new ⇒ Object
Target url for the new cars listing.
-
#target_url_used ⇒ Object
Target url for the used cars listing.
-
#zip ⇒ Object
Zip of the dealer.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Check equality by comparing each attribute.
- #_deserialize(type, value) ⇒ Object
-
#_to_hash(value) ⇒ Object
Method to output non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
build the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Object
Calculate hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Dealer
constructor
A new instance of Dealer.
-
#to_body ⇒ Object
to_body is an alias to to_body (backward compatibility)).
-
#to_hash ⇒ Object
return the object in the form of hash.
- #to_s ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Dealer
Returns a new instance of Dealer.
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
# File 'lib/swagger_client/models/dealer.rb', line 127 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[:'franchise_id'] self.franchise_id = attributes[:'franchise_id'] end if attributes[:'name'] self.name = attributes[:'name'] end if attributes[:'street'] self.street = attributes[:'street'] 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 if attributes[:'latitude'] self.latitude = attributes[:'latitude'] end if attributes[:'longitude'] self.longitude = attributes[:'longitude'] end if attributes[:'phone'] self.phone = attributes[:'phone'] end if attributes[:'car_type'] self.car_type = attributes[:'car_type'] end if attributes[:'target_url_new'] self.target_url_new = attributes[:'target_url_new'] end if attributes[:'target_url_used'] self.target_url_used = attributes[:'target_url_used'] end if attributes[:'target_url_certified'] self.target_url_certified = attributes[:'target_url_certified'] end if attributes[:'dealer_type'] self.dealer_type = attributes[:'dealer_type'] else self.dealer_type = "independent" end if attributes[:'rating'] self. = attributes[:'rating'] end end |
Instance Attribute Details
#car_type ⇒ Object
Car type new|used|certified
48 49 50 |
# File 'lib/swagger_client/models/dealer.rb', line 48 def car_type @car_type end |
#city ⇒ Object
City of the dealer
30 31 32 |
# File 'lib/swagger_client/models/dealer.rb', line 30 def city @city end |
#dealer_type ⇒ Object
Dealer type - independent, franchise, multi-brand, authorized
60 61 62 |
# File 'lib/swagger_client/models/dealer.rb', line 60 def dealer_type @dealer_type end |
#franchise_id ⇒ Object
Dealer franchise id
21 22 23 |
# File 'lib/swagger_client/models/dealer.rb', line 21 def franchise_id @franchise_id end |
#id ⇒ Object
The unique id associated with the dealer in the Marketcheck database
18 19 20 |
# File 'lib/swagger_client/models/dealer.rb', line 18 def id @id end |
#latitude ⇒ Object
Latutide for the dealer location
39 40 41 |
# File 'lib/swagger_client/models/dealer.rb', line 39 def latitude @latitude end |
#longitude ⇒ Object
Longitude for the dealer location
42 43 44 |
# File 'lib/swagger_client/models/dealer.rb', line 42 def longitude @longitude end |
#name ⇒ Object
Name of the dealer
24 25 26 |
# File 'lib/swagger_client/models/dealer.rb', line 24 def name @name end |
#phone ⇒ Object
Contact no of the dealer
45 46 47 |
# File 'lib/swagger_client/models/dealer.rb', line 45 def phone @phone end |
#rating ⇒ Object
Overall rating of the dealership on scale 1-5
63 64 65 |
# File 'lib/swagger_client/models/dealer.rb', line 63 def @rating end |
#state ⇒ Object
State of the dealer
33 34 35 |
# File 'lib/swagger_client/models/dealer.rb', line 33 def state @state end |
#street ⇒ Object
Street of the dealer
27 28 29 |
# File 'lib/swagger_client/models/dealer.rb', line 27 def street @street end |
#target_url_certified ⇒ Object
Target url for the certified cars listing
57 58 59 |
# File 'lib/swagger_client/models/dealer.rb', line 57 def target_url_certified @target_url_certified end |
#target_url_new ⇒ Object
Target url for the new cars listing
51 52 53 |
# File 'lib/swagger_client/models/dealer.rb', line 51 def target_url_new @target_url_new end |
#target_url_used ⇒ Object
Target url for the used cars listing
54 55 56 |
# File 'lib/swagger_client/models/dealer.rb', line 54 def target_url_used @target_url_used end |
#zip ⇒ Object
Zip of the dealer
36 37 38 |
# File 'lib/swagger_client/models/dealer.rb', line 36 def zip @zip end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/swagger_client/models/dealer.rb', line 66 def self.attribute_map { :'id' => :'id', :'franchise_id' => :'franchise_id', :'name' => :'name', :'street' => :'street', :'city' => :'city', :'state' => :'state', :'zip' => :'zip', :'latitude' => :'latitude', :'longitude' => :'longitude', :'phone' => :'phone', :'car_type' => :'car_type', :'target_url_new' => :'target_url_new', :'target_url_used' => :'target_url_used', :'target_url_certified' => :'target_url_certified', :'dealer_type' => :'dealer_type', :'rating' => :'rating' } end |
.swagger_types ⇒ Object
Attribute type mapping.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/swagger_client/models/dealer.rb', line 105 def self.swagger_types { :'id' => :'String', :'franchise_id' => :'String', :'name' => :'String', :'street' => :'String', :'city' => :'String', :'state' => :'String', :'zip' => :'String', :'latitude' => :'String', :'longitude' => :'String', :'phone' => :'String', :'car_type' => :'String', :'target_url_new' => :'String', :'target_url_used' => :'String', :'target_url_certified' => :'String', :'dealer_type' => :'String', :'rating' => :'Float' } end |
Instance Method Details
#==(o) ⇒ Object
Check equality by comparing each attribute.
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
# File 'lib/swagger_client/models/dealer.rb', line 203 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && franchise_id == o.franchise_id && name == o.name && street == o.street && city == o.city && state == o.state && zip == o.zip && latitude == o.latitude && longitude == o.longitude && phone == o.phone && car_type == o.car_type && target_url_new == o.target_url_new && target_url_used == o.target_url_used && target_url_certified == o.target_url_certified && dealer_type == o.dealer_type && == o. end |
#_deserialize(type, value) ⇒ Object
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 |
# File 'lib/swagger_client/models/dealer.rb', line 254 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<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+), (?<v_type>.+)>\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 |
#_to_hash(value) ⇒ Object
Method to output non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
314 315 316 317 318 319 320 321 322 323 324 325 326 |
# File 'lib/swagger_client/models/dealer.rb', line 314 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 |
#build_from_hash(attributes) ⇒ Object
build the object from hash
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 |
# File 'lib/swagger_client/models/dealer.rb', line 235 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 |
#eql?(o) ⇒ Boolean
225 226 227 |
# File 'lib/swagger_client/models/dealer.rb', line 225 def eql?(o) self == o end |
#hash ⇒ Object
Calculate hash code according to all attributes.
230 231 232 |
# File 'lib/swagger_client/models/dealer.rb', line 230 def hash [id, franchise_id, name, street, city, state, zip, latitude, longitude, phone, car_type, target_url_new, target_url_used, target_url_certified, dealer_type, ].hash end |
#to_body ⇒ Object
to_body is an alias to to_body (backward compatibility))
297 298 299 |
# File 'lib/swagger_client/models/dealer.rb', line 297 def to_body to_hash end |
#to_hash ⇒ Object
return the object in the form of hash
302 303 304 305 306 307 308 309 310 |
# File 'lib/swagger_client/models/dealer.rb', line 302 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 |
#to_s ⇒ Object
292 293 294 |
# File 'lib/swagger_client/models/dealer.rb', line 292 def to_s to_hash.to_s end |