Class: Repull::AirbnbCalendarOperation

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

Overview

One calendar operation. Supply either start_date + end_date OR a dates array. Every restriction here is forwarded verbatim to Airbnb's batch calendar API.

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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

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

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

  if attributes.key?(:'dates')
    if (value = attributes[:'dates']).is_a?(Array)
      self.dates = value
    end
  end

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

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

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

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

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

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

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

Instance Attribute Details

#availabilityObject

Stop-sell is expressed here: unavailable blocks the date(s); available re-opens; default reverts to rule-based availability.



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

def availability
  @availability
end

#closed_to_arrivalObject

Closed-to-arrival — no check-ins on the affected date(s).



41
42
43
# File 'lib/repull/models/airbnb_calendar_operation.rb', line 41

def closed_to_arrival
  @closed_to_arrival
end

#closed_to_departureObject

Closed-to-departure — no check-outs on the affected date(s).



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

def closed_to_departure
  @closed_to_departure
end

#daily_priceObject

Nightly price override.



29
30
31
# File 'lib/repull/models/airbnb_calendar_operation.rb', line 29

def daily_price
  @daily_price
end

#datesObject

Explicit date or start:end range strings, as an alternative to start_date/end_date.



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

def dates
  @dates
end

#end_dateObject

Inclusive range end (pair with start_date).



23
24
25
# File 'lib/repull/models/airbnb_calendar_operation.rb', line 23

def end_date
  @end_date
end

#max_nightsObject

Maximum length of stay for the date(s).



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

def max_nights
  @max_nights
end

#min_nightsObject

Minimum length of stay for the date(s).



35
36
37
# File 'lib/repull/models/airbnb_calendar_operation.rb', line 35

def min_nights
  @min_nights
end

#notesObject

Returns the value of attribute notes.



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

def notes
  @notes
end

#start_dateObject

Inclusive range start (pair with end_date).



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

def start_date
  @start_date
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



65
66
67
# File 'lib/repull/models/airbnb_calendar_operation.rb', line 65

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



70
71
72
# File 'lib/repull/models/airbnb_calendar_operation.rb', line 70

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



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

def self.attribute_map
  {
    :'start_date' => :'start_date',
    :'end_date' => :'end_date',
    :'dates' => :'dates',
    :'daily_price' => :'daily_price',
    :'availability' => :'availability',
    :'min_nights' => :'min_nights',
    :'max_nights' => :'max_nights',
    :'closed_to_arrival' => :'closed_to_arrival',
    :'closed_to_departure' => :'closed_to_departure',
    :'notes' => :'notes'
  }
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



212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/repull/models/airbnb_calendar_operation.rb', line 212

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



91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/repull/models/airbnb_calendar_operation.rb', line 91

def self.openapi_nullable
  Set.new([
    :'start_date',
    :'end_date',
    :'dates',
    :'daily_price',
    :'availability',
    :'min_nights',
    :'max_nights',
    :'closed_to_arrival',
    :'closed_to_departure',
    :'notes'
  ])
end

.openapi_typesObject

Attribute type mapping.



75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/repull/models/airbnb_calendar_operation.rb', line 75

def self.openapi_types
  {
    :'start_date' => :'Date',
    :'end_date' => :'Date',
    :'dates' => :'Array<String>',
    :'daily_price' => :'Float',
    :'availability' => :'String',
    :'min_nights' => :'Integer',
    :'max_nights' => :'Integer',
    :'closed_to_arrival' => :'Boolean',
    :'closed_to_departure' => :'Boolean',
    :'notes' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



182
183
184
185
186
187
188
189
190
191
192
193
194
195
# File 'lib/repull/models/airbnb_calendar_operation.rb', line 182

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      start_date == o.start_date &&
      end_date == o.end_date &&
      dates == o.dates &&
      daily_price == o.daily_price &&
      availability == o.availability &&
      min_nights == o.min_nights &&
      max_nights == o.max_nights &&
      closed_to_arrival == o.closed_to_arrival &&
      closed_to_departure == o.closed_to_departure &&
      notes == o.notes
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


199
200
201
# File 'lib/repull/models/airbnb_calendar_operation.rb', line 199

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



205
206
207
# File 'lib/repull/models/airbnb_calendar_operation.rb', line 205

def hash
  [start_date, end_date, dates, daily_price, availability, min_nights, max_nights, closed_to_arrival, closed_to_departure, notes].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



167
168
169
170
171
# File 'lib/repull/models/airbnb_calendar_operation.rb', line 167

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



234
235
236
237
238
239
240
241
242
243
244
245
246
# File 'lib/repull/models/airbnb_calendar_operation.rb', line 234

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



175
176
177
178
# File 'lib/repull/models/airbnb_calendar_operation.rb', line 175

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