Class: Repull::MarketTopComp

Inherits:
ApiModelBase show all
Defined in:
lib/repull/models/market_top_comp.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ MarketTopComp

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



115
116
117
118
119
120
121
122
123
124
125
126
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
# File 'lib/repull/models/market_top_comp.rb', line 115

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Repull::MarketTopComp` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Repull::MarketTopComp`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.key?(:'platform_listing_id')
    self.platform_listing_id = attributes[:'platform_listing_id']
  end

  if attributes.key?(:'title')
    self.title = attributes[:'title']
  end

  if attributes.key?(:'property_type')
    self.property_type = attributes[:'property_type']
  end

  if attributes.key?(:'bedrooms')
    self.bedrooms = attributes[:'bedrooms']
  end

  if attributes.key?(:'max_guests')
    self.max_guests = attributes[:'max_guests']
  end

  if attributes.key?(:'rating')
    self.rating = attributes[:'rating']
  end

  if attributes.key?(:'review_count')
    self.review_count = attributes[:'review_count']
  end

  if attributes.key?(:'current_nightly_rate')
    self.current_nightly_rate = attributes[:'current_nightly_rate']
  end

  if attributes.key?(:'thumbnail_url')
    self.thumbnail_url = attributes[:'thumbnail_url']
  end

  if attributes.key?(:'lat')
    self.lat = attributes[:'lat']
  end

  if attributes.key?(:'lng')
    self.lng = attributes[:'lng']
  end

  if attributes.key?(:'url')
    self.url = attributes[:'url']
  end

  if attributes.key?(:'distance_km')
    self.distance_km = attributes[:'distance_km']
  end
end

Instance Attribute Details

#bedroomsObject

Returns the value of attribute bedrooms.



26
27
28
# File 'lib/repull/models/market_top_comp.rb', line 26

def bedrooms
  @bedrooms
end

#current_nightly_rateObject

Returns the value of attribute current_nightly_rate.



34
35
36
# File 'lib/repull/models/market_top_comp.rb', line 34

def current_nightly_rate
  @current_nightly_rate
end

#distance_kmObject

Returns the value of attribute distance_km.



44
45
46
# File 'lib/repull/models/market_top_comp.rb', line 44

def distance_km
  @distance_km
end

#idObject

Returns the value of attribute id.



18
19
20
# File 'lib/repull/models/market_top_comp.rb', line 18

def id
  @id
end

#latObject

Returns the value of attribute lat.



38
39
40
# File 'lib/repull/models/market_top_comp.rb', line 38

def lat
  @lat
end

#lngObject

Returns the value of attribute lng.



40
41
42
# File 'lib/repull/models/market_top_comp.rb', line 40

def lng
  @lng
end

#max_guestsObject

Returns the value of attribute max_guests.



28
29
30
# File 'lib/repull/models/market_top_comp.rb', line 28

def max_guests
  @max_guests
end

#platform_listing_idObject

Returns the value of attribute platform_listing_id.



20
21
22
# File 'lib/repull/models/market_top_comp.rb', line 20

def platform_listing_id
  @platform_listing_id
end

#property_typeObject

Returns the value of attribute property_type.



24
25
26
# File 'lib/repull/models/market_top_comp.rb', line 24

def property_type
  @property_type
end

#ratingObject

Returns the value of attribute rating.



30
31
32
# File 'lib/repull/models/market_top_comp.rb', line 30

def rating
  @rating
end

#review_countObject

Returns the value of attribute review_count.



32
33
34
# File 'lib/repull/models/market_top_comp.rb', line 32

def review_count
  @review_count
end

#thumbnail_urlObject

Returns the value of attribute thumbnail_url.



36
37
38
# File 'lib/repull/models/market_top_comp.rb', line 36

def thumbnail_url
  @thumbnail_url
end

#titleObject

Returns the value of attribute title.



22
23
24
# File 'lib/repull/models/market_top_comp.rb', line 22

def title
  @title
end

#urlObject

Returns the value of attribute url.



42
43
44
# File 'lib/repull/models/market_top_comp.rb', line 42

def url
  @url
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



67
68
69
# File 'lib/repull/models/market_top_comp.rb', line 67

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



72
73
74
# File 'lib/repull/models/market_top_comp.rb', line 72

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/repull/models/market_top_comp.rb', line 47

def self.attribute_map
  {
    :'id' => :'id',
    :'platform_listing_id' => :'platformListingId',
    :'title' => :'title',
    :'property_type' => :'propertyType',
    :'bedrooms' => :'bedrooms',
    :'max_guests' => :'maxGuests',
    :'rating' => :'rating',
    :'review_count' => :'reviewCount',
    :'current_nightly_rate' => :'currentNightlyRate',
    :'thumbnail_url' => :'thumbnailUrl',
    :'lat' => :'lat',
    :'lng' => :'lng',
    :'url' => :'url',
    :'distance_km' => :'distanceKm'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# File 'lib/repull/models/market_top_comp.rb', line 237

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/repull/models/market_top_comp.rb', line 97

def self.openapi_nullable
  Set.new([
    :'title',
    :'property_type',
    :'bedrooms',
    :'max_guests',
    :'rating',
    :'review_count',
    :'current_nightly_rate',
    :'thumbnail_url',
    :'lat',
    :'lng',
    :'distance_km'
  ])
end

.openapi_typesObject

Attribute type mapping.



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/repull/models/market_top_comp.rb', line 77

def self.openapi_types
  {
    :'id' => :'String',
    :'platform_listing_id' => :'String',
    :'title' => :'String',
    :'property_type' => :'String',
    :'bedrooms' => :'Integer',
    :'max_guests' => :'Integer',
    :'rating' => :'Float',
    :'review_count' => :'Integer',
    :'current_nightly_rate' => :'Float',
    :'thumbnail_url' => :'String',
    :'lat' => :'Float',
    :'lng' => :'Float',
    :'url' => :'String',
    :'distance_km' => :'Float'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# File 'lib/repull/models/market_top_comp.rb', line 203

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      platform_listing_id == o.platform_listing_id &&
      title == o.title &&
      property_type == o.property_type &&
      bedrooms == o.bedrooms &&
      max_guests == o.max_guests &&
      rating == o.rating &&
      review_count == o.review_count &&
      current_nightly_rate == o.current_nightly_rate &&
      thumbnail_url == o.thumbnail_url &&
      lat == o.lat &&
      lng == o.lng &&
      url == o.url &&
      distance_km == o.distance_km
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


224
225
226
# File 'lib/repull/models/market_top_comp.rb', line 224

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



230
231
232
# File 'lib/repull/models/market_top_comp.rb', line 230

def hash
  [id, platform_listing_id, title, property_type, bedrooms, max_guests, rating, review_count, current_nightly_rate, thumbnail_url, lat, lng, url, distance_km].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



188
189
190
191
192
# File 'lib/repull/models/market_top_comp.rb', line 188

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/repull/models/market_top_comp.rb', line 259

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



196
197
198
199
# File 'lib/repull/models/market_top_comp.rb', line 196

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  true
end