Class: Asdawqw::ReservationRateNotifcationModel

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/asdawqw/models/reservation_rate_notifcation_model.rb

Overview

ReservationRateNotifcationModel Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(original_rack_rate = nil, net_rate = nil, new_published_rack_rate = nil) ⇒ ReservationRateNotifcationModel

Returns a new instance of ReservationRateNotifcationModel.



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

def initialize(original_rack_rate = nil,
               net_rate = nil,
               new_published_rack_rate = nil)
  @original_rack_rate = original_rack_rate
  @net_rate = net_rate
  @new_published_rack_rate = new_published_rack_rate
end

Instance Attribute Details

#net_rateFloat

Net rate (rate which PM will get - so without any additional commissions).

Returns:

  • (Float)


16
17
18
# File 'lib/asdawqw/models/reservation_rate_notifcation_model.rb', line 16

def net_rate
  @net_rate
end

#new_published_rack_rateFloat

New published rack rate (rate which guest paid - rate with all commissions).

Returns:

  • (Float)


21
22
23
# File 'lib/asdawqw/models/reservation_rate_notifcation_model.rb', line 21

def new_published_rack_rate
  @new_published_rack_rate
end

#original_rack_rateFloat

Original rack rate. Rate received from PMS (rate without additional channel commission or any additional markup)

Returns:

  • (Float)


12
13
14
# File 'lib/asdawqw/models/reservation_rate_notifcation_model.rb', line 12

def original_rack_rate
  @original_rack_rate
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/asdawqw/models/reservation_rate_notifcation_model.rb', line 41

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  original_rack_rate = hash['originalRackRate']
  net_rate = hash['netRate']
  new_published_rack_rate = hash['newPublishedRackRate']

  # Create object from extracted values.
  ReservationRateNotifcationModel.new(original_rack_rate,
                                      net_rate,
                                      new_published_rack_rate)
end

.namesObject

A mapping from model property names to API property names.



24
25
26
27
28
29
30
# File 'lib/asdawqw/models/reservation_rate_notifcation_model.rb', line 24

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['original_rack_rate'] = 'originalRackRate'
  @_hash['net_rate'] = 'netRate'
  @_hash['new_published_rack_rate'] = 'newPublishedRackRate'
  @_hash
end