Class: Repull::ListingCreateRequest

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

Overview

Inputs for ‘POST /v1/listings`. Provide enough address detail (street + city + lat/lng) for downstream Airbnb publish to work.

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 = {}) ⇒ ListingCreateRequest

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
# File 'lib/repull/models/listing_create_request.rb', line 142

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Repull::ListingCreateRequest` 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::ListingCreateRequest`. 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?(:'name')
    self.name = attributes[:'name']
  else
    self.name = nil
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#allows_childrenObject

Returns the value of attribute allows_children.



62
63
64
# File 'lib/repull/models/listing_create_request.rb', line 62

def allows_children
  @allows_children
end

#allows_eventsObject

Returns the value of attribute allows_events.



64
65
66
# File 'lib/repull/models/listing_create_request.rb', line 64

def allows_events
  @allows_events
end

#allows_petsObject

Returns the value of attribute allows_pets.



58
59
60
# File 'lib/repull/models/listing_create_request.rb', line 58

def allows_pets
  @allows_pets
end

#allows_smokingObject

Returns the value of attribute allows_smoking.



60
61
62
# File 'lib/repull/models/listing_create_request.rb', line 60

def allows_smoking
  @allows_smoking
end

#bathroomsObject

Returns the value of attribute bathrooms.



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

def bathrooms
  @bathrooms
end

#bedroomsObject

Returns the value of attribute bedrooms.



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

def bedrooms
  @bedrooms
end

#bedsObject

Returns the value of attribute beds.



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

def beds
  @beds
end

#cancellation_policyObject

Returns the value of attribute cancellation_policy.



52
53
54
# File 'lib/repull/models/listing_create_request.rb', line 52

def cancellation_policy
  @cancellation_policy
end

#check_in_time_startObject

Returns the value of attribute check_in_time_start.



54
55
56
# File 'lib/repull/models/listing_create_request.rb', line 54

def check_in_time_start
  @check_in_time_start
end

#check_out_timeObject

Returns the value of attribute check_out_time.



56
57
58
# File 'lib/repull/models/listing_create_request.rb', line 56

def check_out_time
  @check_out_time
end

#cityObject

Returns the value of attribute city.



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

def city
  @city
end

#cleaning_feeObject

Returns the value of attribute cleaning_fee.



50
51
52
# File 'lib/repull/models/listing_create_request.rb', line 50

def cleaning_fee
  @cleaning_fee
end

#country_codeObject

Returns the value of attribute country_code.



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

def country_code
  @country_code
end

#default_daily_priceObject

Returns the value of attribute default_daily_price.



48
49
50
# File 'lib/repull/models/listing_create_request.rb', line 48

def default_daily_price
  @default_daily_price
end

#descriptionObject

Returns the value of attribute description.



46
47
48
# File 'lib/repull/models/listing_create_request.rb', line 46

def description
  @description
end

#latObject

Returns the value of attribute lat.



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

def lat
  @lat
end

#lngObject

Returns the value of attribute lng.



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

def lng
  @lng
end

#nameObject

Public guest-facing title



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

def name
  @name
end

#person_capacityObject

Returns the value of attribute person_capacity.



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

def person_capacity
  @person_capacity
end

#property_typeObject

Returns the value of attribute property_type.



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

def property_type
  @property_type
end

#stateObject

Returns the value of attribute state.



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

def state
  @state
end

#streetObject

Returns the value of attribute street.



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

def street
  @street
end

#summaryObject

Returns the value of attribute summary.



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

def summary
  @summary
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



96
97
98
# File 'lib/repull/models/listing_create_request.rb', line 96

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



101
102
103
# File 'lib/repull/models/listing_create_request.rb', line 101

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



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
# File 'lib/repull/models/listing_create_request.rb', line 67

def self.attribute_map
  {
    :'name' => :'name',
    :'property_type' => :'propertyType',
    :'street' => :'street',
    :'city' => :'city',
    :'state' => :'state',
    :'country_code' => :'countryCode',
    :'lat' => :'lat',
    :'lng' => :'lng',
    :'bedrooms' => :'bedrooms',
    :'bathrooms' => :'bathrooms',
    :'beds' => :'beds',
    :'person_capacity' => :'personCapacity',
    :'summary' => :'summary',
    :'description' => :'description',
    :'default_daily_price' => :'defaultDailyPrice',
    :'cleaning_fee' => :'cleaningFee',
    :'cancellation_policy' => :'cancellationPolicy',
    :'check_in_time_start' => :'checkInTimeStart',
    :'check_out_time' => :'checkOutTime',
    :'allows_pets' => :'allowsPets',
    :'allows_smoking' => :'allowsSmoking',
    :'allows_children' => :'allowsChildren',
    :'allows_events' => :'allowsEvents'
  }
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



326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
# File 'lib/repull/models/listing_create_request.rb', line 326

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



135
136
137
138
# File 'lib/repull/models/listing_create_request.rb', line 135

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/repull/models/listing_create_request.rb', line 106

def self.openapi_types
  {
    :'name' => :'String',
    :'property_type' => :'String',
    :'street' => :'String',
    :'city' => :'String',
    :'state' => :'String',
    :'country_code' => :'String',
    :'lat' => :'Float',
    :'lng' => :'Float',
    :'bedrooms' => :'Integer',
    :'bathrooms' => :'Float',
    :'beds' => :'Integer',
    :'person_capacity' => :'Integer',
    :'summary' => :'String',
    :'description' => :'String',
    :'default_daily_price' => :'Float',
    :'cleaning_fee' => :'Float',
    :'cancellation_policy' => :'String',
    :'check_in_time_start' => :'String',
    :'check_out_time' => :'String',
    :'allows_pets' => :'Boolean',
    :'allows_smoking' => :'Boolean',
    :'allows_children' => :'Boolean',
    :'allows_events' => :'Boolean'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
# File 'lib/repull/models/listing_create_request.rb', line 283

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      name == o.name &&
      property_type == o.property_type &&
      street == o.street &&
      city == o.city &&
      state == o.state &&
      country_code == o.country_code &&
      lat == o.lat &&
      lng == o.lng &&
      bedrooms == o.bedrooms &&
      bathrooms == o.bathrooms &&
      beds == o.beds &&
      person_capacity == o.person_capacity &&
      summary == o.summary &&
      description == o.description &&
      default_daily_price == o.default_daily_price &&
      cleaning_fee == o.cleaning_fee &&
      cancellation_policy == o.cancellation_policy &&
      check_in_time_start == o.check_in_time_start &&
      check_out_time == o.check_out_time &&
      allows_pets == o.allows_pets &&
      allows_smoking == o.allows_smoking &&
      allows_children == o.allows_children &&
      allows_events == o.allows_events
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


313
314
315
# File 'lib/repull/models/listing_create_request.rb', line 313

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



319
320
321
# File 'lib/repull/models/listing_create_request.rb', line 319

def hash
  [name, property_type, street, city, state, country_code, lat, lng, bedrooms, bathrooms, beds, person_capacity, summary, description, default_daily_price, cleaning_fee, cancellation_policy, check_in_time_start, check_out_time, allows_pets, allows_smoking, allows_children, allows_events].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



253
254
255
256
257
258
259
260
261
# File 'lib/repull/models/listing_create_request.rb', line 253

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @name.nil?
    invalid_properties.push('invalid value for "name", name cannot be nil.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



348
349
350
351
352
353
354
355
356
357
358
359
360
# File 'lib/repull/models/listing_create_request.rb', line 348

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



265
266
267
268
269
# File 'lib/repull/models/listing_create_request.rb', line 265

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @name.nil?
  true
end