Class: Asdawqw::LosRate
- Defined in:
- lib/asdawqw/models/los_rate.rb
Overview
Model for LOS (Length of stay) rates
Instance Attribute Summary collapse
-
#check_in_date ⇒ Date
Check-in Date.
-
#currency ⇒ String
readonly
Currency for rates.
-
#los_value ⇒ List of Float
List rates value per day.
-
#max_guests ⇒ Integer
Max guests for check in date.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
-
#initialize(check_in_date = nil, max_guests = nil, los_value = nil, currency = nil) ⇒ LosRate
constructor
A new instance of LosRate.
Methods inherited from BaseModel
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_date ⇒ Date
Check-in Date. Date should be in format “yyyy-MM-dd”
11 12 13 |
# File 'lib/asdawqw/models/los_rate.rb', line 11 def check_in_date @check_in_date end |
#currency ⇒ String (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.
29 30 31 |
# File 'lib/asdawqw/models/los_rate.rb', line 29 def currency @currency end |
#los_value ⇒ List 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.
23 24 25 |
# File 'lib/asdawqw/models/los_rate.rb', line 23 def los_value @los_value end |
#max_guests ⇒ Integer
Max guests for check in date
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 |
.names ⇒ Object
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 |