Class: Asdawqw::LosRate

Inherits:
BaseModel show all
Defined in:
lib/asdawqw/models/los_rate.rb

Overview

Model for LOS (Length of stay) rates

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(check_in_date = nil, max_guests = nil, los_value = nil, currency = nil) ⇒ LosRate

Returns a new instance of LosRate.



41
42
43
44
45
46
47
48
49
# File 'lib/asdawqw/models/los_rate.rb', line 41

def initialize(check_in_date = nil,
               max_guests = nil,
               los_value = nil,
               currency = nil)
  @check_in_date = check_in_date
  @max_guests = max_guests
  @los_value = los_value
  @currency = currency
end

Instance Attribute Details

#check_in_dateDate

Check-in Date. Date should be in format “yyyy-MM-dd”

Returns:

  • (Date)


11
12
13
# File 'lib/asdawqw/models/los_rate.rb', line 11

def check_in_date
  @check_in_date
end

#currencyString (readonly)

Currency for rates. It will be visiable only in GET response. You should not set this field in request since we will use product currency for every rate.

Returns:



29
30
31
# File 'lib/asdawqw/models/los_rate.rb', line 29

def currency
  @currency
end

#los_valueList of Float

List rates value per day. First value is for reservation for 1 day. Secoon. If you do not support booking for some specific number of days, set value 0 for that element in array.nd value is for reservation for 2 days, and so on. If you do not support booking for some specific number of days, set value 0 for that element in array.

Returns:

  • (List of Float)


23
24
25
# File 'lib/asdawqw/models/los_rate.rb', line 23

def los_value
  @los_value
end

#max_guestsInteger

Max guests for check in date

Returns:

  • (Integer)


15
16
17
# File 'lib/asdawqw/models/los_rate.rb', line 15

def max_guests
  @max_guests
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/asdawqw/models/los_rate.rb', line 52

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  check_in_date = hash['checkInDate']
  max_guests = hash['maxGuests']
  los_value = hash['losValue']
  currency = hash['currency']

  # Create object from extracted values.
  LosRate.new(check_in_date,
              max_guests,
              los_value,
              currency)
end

.namesObject

A mapping from model property names to API property names.



32
33
34
35
36
37
38
39
# File 'lib/asdawqw/models/los_rate.rb', line 32

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['check_in_date'] = 'checkInDate'
  @_hash['max_guests'] = 'maxGuests'
  @_hash['los_value'] = 'losValue'
  @_hash['currency'] = 'currency'
  @_hash
end