Class: Asdawqw::CancelReservationNotificationObject

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

Overview

CancelReservationNotificationObject Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(reservation_id = nil, product_id = nil, supplier_id = nil, agent_name = nil, confirmation_id = nil, unique_key = nil, new_state = nil, customer_name = nil, from_date = nil, to_date = nil, adult = nil, child = nil, email = nil, total = nil, phone = nil, notes = nil, credit_card_type = nil) ⇒ CancelReservationNotificationObject

Returns a new instance of CancelReservationNotificationObject.



102
103
104
105
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
133
134
135
136
# File 'lib/asdawqw/models/cancel_reservation_notification_object.rb', line 102

def initialize(reservation_id = nil,
               product_id = nil,
               supplier_id = nil,
               agent_name = nil,
               confirmation_id = nil,
               unique_key = nil,
               new_state = nil,
               customer_name = nil,
               from_date = nil,
               to_date = nil,
               adult = nil,
               child = nil,
               email = nil,
               total = nil,
               phone = nil,
               notes = nil,
               credit_card_type = nil)
  @reservation_id = reservation_id
  @product_id = product_id
  @supplier_id = supplier_id
  @agent_name = agent_name
  @confirmation_id = confirmation_id
  @unique_key = unique_key
  @new_state = new_state
  @customer_name = customer_name
  @from_date = from_date
  @to_date = to_date
  @adult = adult
  @child = child
  @email = email
  @phone = phone
  @notes = notes
  @credit_card_type = credit_card_type
  @total = total
end

Instance Attribute Details

#adultInteger

Number of adults

Returns:

  • (Integer)


52
53
54
# File 'lib/asdawqw/models/cancel_reservation_notification_object.rb', line 52

def adult
  @adult
end

#agent_nameString

Agent name/Channel name

Returns:



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

def agent_name
  @agent_name
end

#childInteger

Number of children

Returns:

  • (Integer)


56
57
58
# File 'lib/asdawqw/models/cancel_reservation_notification_object.rb', line 56

def child
  @child
end

#confirmation_idString

Channel confirmation code

Returns:



27
28
29
# File 'lib/asdawqw/models/cancel_reservation_notification_object.rb', line 27

def confirmation_id
  @confirmation_id
end

#credit_card_typeString

Credit card type

Returns:



72
73
74
# File 'lib/asdawqw/models/cancel_reservation_notification_object.rb', line 72

def credit_card_type
  @credit_card_type
end

#customer_nameString

Guest full name (in format firstName, lastName)

Returns:



40
41
42
# File 'lib/asdawqw/models/cancel_reservation_notification_object.rb', line 40

def customer_name
  @customer_name
end

#emailString

Guest email

Returns:



60
61
62
# File 'lib/asdawqw/models/cancel_reservation_notification_object.rb', line 60

def email
  @email
end

#from_dateDate

Reservation date from. Date is in format “yyyy-MM-dd”

Returns:

  • (Date)


44
45
46
# File 'lib/asdawqw/models/cancel_reservation_notification_object.rb', line 44

def from_date
  @from_date
end

#new_stateString

It will always be “Cancelled” in this request

Returns:



36
37
38
# File 'lib/asdawqw/models/cancel_reservation_notification_object.rb', line 36

def new_state
  @new_state
end

#notesString

Guest notes

Returns:



68
69
70
# File 'lib/asdawqw/models/cancel_reservation_notification_object.rb', line 68

def notes
  @notes
end

#phoneString

Guest phone

Returns:



64
65
66
# File 'lib/asdawqw/models/cancel_reservation_notification_object.rb', line 64

def phone
  @phone
end

#product_idString

Id of the product in BookingPal

Returns:



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

def product_id
  @product_id
end

#reservation_idString

Id of the reservation in BookingPal

Returns:



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

def reservation_id
  @reservation_id
end

#supplier_idInteger

Id of the property manager

Returns:

  • (Integer)


19
20
21
# File 'lib/asdawqw/models/cancel_reservation_notification_object.rb', line 19

def supplier_id
  @supplier_id
end

#to_dateDate

Reservation date to. Date is in format “yyyy-MM-dd”

Returns:

  • (Date)


48
49
50
# File 'lib/asdawqw/models/cancel_reservation_notification_object.rb', line 48

def to_date
  @to_date
end

#totalFloat

Best available rate (This is the total value that guests will pay, including rate, fees, taxes, and all commissions. )

Returns:

  • (Float)


77
78
79
# File 'lib/asdawqw/models/cancel_reservation_notification_object.rb', line 77

def total
  @total
end

#unique_keyString

Unique code to identify that the request is from BookingPal. This value is unique for every PMS (and it will be different in different environments).

Returns:



32
33
34
# File 'lib/asdawqw/models/cancel_reservation_notification_object.rb', line 32

def unique_key
  @unique_key
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/asdawqw/models/cancel_reservation_notification_object.rb', line 139

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  reservation_id = hash['reservationId']
  product_id = hash['productId']
  supplier_id = hash['supplierId']
  agent_name = hash['agentName']
  confirmation_id = hash['confirmationId']
  unique_key = hash['uniqueKey']
  new_state = hash['newState']
  customer_name = hash['customerName']
  from_date = hash['fromDate']
  to_date = hash['toDate']
  adult = hash['adult']
  child = hash['child']
  email = hash['email']
  total = hash['total']
  phone = hash['phone']
  notes = hash['notes']
  credit_card_type = hash['creditCardType']

  # Create object from extracted values.
  CancelReservationNotificationObject.new(reservation_id,
                                          product_id,
                                          supplier_id,
                                          agent_name,
                                          confirmation_id,
                                          unique_key,
                                          new_state,
                                          customer_name,
                                          from_date,
                                          to_date,
                                          adult,
                                          child,
                                          email,
                                          total,
                                          phone,
                                          notes,
                                          credit_card_type)
end

.namesObject

A mapping from model property names to API property names.



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/asdawqw/models/cancel_reservation_notification_object.rb', line 80

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['reservation_id'] = 'reservationId'
  @_hash['product_id'] = 'productId'
  @_hash['supplier_id'] = 'supplierId'
  @_hash['agent_name'] = 'agentName'
  @_hash['confirmation_id'] = 'confirmationId'
  @_hash['unique_key'] = 'uniqueKey'
  @_hash['new_state'] = 'newState'
  @_hash['customer_name'] = 'customerName'
  @_hash['from_date'] = 'fromDate'
  @_hash['to_date'] = 'toDate'
  @_hash['adult'] = 'adult'
  @_hash['child'] = 'child'
  @_hash['email'] = 'email'
  @_hash['phone'] = 'phone'
  @_hash['notes'] = 'notes'
  @_hash['credit_card_type'] = 'creditCardType'
  @_hash['total'] = 'total'
  @_hash
end