Class: Asdawqw::ReservationNotificationObject
- Defined in:
- lib/asdawqw/models/reservation_notification_object.rb
Overview
ReservationNotificationObject Model.
Instance Attribute Summary collapse
-
#address ⇒ String
Guest address.
-
#adult ⇒ Integer
number of adults.
-
#agent_name ⇒ String
Agent name/Channel name.
-
#child ⇒ Integer
number of children.
-
#city ⇒ String
Guest city.
-
#commission ⇒ ReservationCommissionsNotificationModel
Model.
-
#confirmation_id ⇒ String
Channel confirmation code.
-
#country ⇒ String
Guest country.
-
#credit_card_cid ⇒ String
Credit card cid.
-
#credit_card_expiration_month ⇒ String
Credit card expiration month.
-
#credit_card_expiration_year ⇒ String
Credit card expiration yea.
-
#credit_card_number ⇒ String
Credit card number.
-
#credit_card_type ⇒ String
Credit card type.
-
#customer_name ⇒ String
Guest full name (in format firstName, lastName).
-
#email ⇒ String
Guest email.
-
#fees ⇒ List of ReservationFeeNotificationModel
List of models.
-
#from_date ⇒ Date
Reservation date from.
-
#new_state ⇒ String
Reservation state.
-
#notes ⇒ String
Guest notes.
-
#phone ⇒ String
Guest phone.
-
#product_id ⇒ String
Id of the product in BookingPal.
-
#rate ⇒ ReservationRateNotifcationModel
Model.
-
#reservation_id ⇒ String
Id of the reservation in BookingPal.
-
#state ⇒ String
Guest state.
-
#supplier_id ⇒ String
Id of the property manager.
-
#taxes ⇒ List of ReservationTaxNotificationModel
List of models.
-
#to_date ⇒ Date
Reservation date to.
-
#total ⇒ Float
Best available rate (This is the total value that guests will pay, including rate, fees, taxes, and all commissions. ).
-
#unique_key ⇒ String
Unique code to identify that the request is from BookingPal.
-
#zip ⇒ String
Guest zip code.
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
Methods inherited from BaseModel
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, fees = nil, taxes = nil, commission = nil, rate = nil, address = nil, city = nil, zip = nil, country = nil, state = nil, phone = nil, notes = nil, credit_card_type = nil, credit_card_number = nil, credit_card_expiration_month = nil, credit_card_expiration_year = nil, credit_card_cid = nil) ⇒ ReservationNotificationObject
Returns a new instance of ReservationNotificationObject.
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
# File 'lib/asdawqw/models/reservation_notification_object.rb', line 167 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, fees = nil, taxes = nil, commission = nil, rate = nil, address = nil, city = nil, zip = nil, country = nil, state = nil, phone = nil, notes = nil, credit_card_type = nil, credit_card_number = nil, credit_card_expiration_month = nil, credit_card_expiration_year = nil, credit_card_cid = 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 @address = address @city = city @zip = zip @country = country @state = state @email = email @phone = phone @notes = notes @credit_card_type = credit_card_type @credit_card_number = credit_card_number @credit_card_expiration_month = credit_card_expiration_month @credit_card_expiration_year = credit_card_expiration_year @credit_card_cid = credit_card_cid @total = total @fees = fees @taxes = taxes @commission = commission @rate = rate end |
Instance Attribute Details
#address ⇒ String
Guest address
60 61 62 |
# File 'lib/asdawqw/models/reservation_notification_object.rb', line 60 def address @address end |
#adult ⇒ Integer
number of adults
52 53 54 |
# File 'lib/asdawqw/models/reservation_notification_object.rb', line 52 def adult @adult end |
#agent_name ⇒ String
Agent name/Channel name
23 24 25 |
# File 'lib/asdawqw/models/reservation_notification_object.rb', line 23 def agent_name @agent_name end |
#child ⇒ Integer
number of children
56 57 58 |
# File 'lib/asdawqw/models/reservation_notification_object.rb', line 56 def child @child end |
#city ⇒ String
Guest city
64 65 66 |
# File 'lib/asdawqw/models/reservation_notification_object.rb', line 64 def city @city end |
#commission ⇒ ReservationCommissionsNotificationModel
Model
125 126 127 |
# File 'lib/asdawqw/models/reservation_notification_object.rb', line 125 def commission @commission end |
#confirmation_id ⇒ String
Channel confirmation code
27 28 29 |
# File 'lib/asdawqw/models/reservation_notification_object.rb', line 27 def confirmation_id @confirmation_id end |
#country ⇒ String
Guest country
72 73 74 |
# File 'lib/asdawqw/models/reservation_notification_object.rb', line 72 def country @country end |
#credit_card_cid ⇒ String
Credit card cid
108 109 110 |
# File 'lib/asdawqw/models/reservation_notification_object.rb', line 108 def credit_card_cid @credit_card_cid end |
#credit_card_expiration_month ⇒ String
Credit card expiration month
100 101 102 |
# File 'lib/asdawqw/models/reservation_notification_object.rb', line 100 def credit_card_expiration_month @credit_card_expiration_month end |
#credit_card_expiration_year ⇒ String
Credit card expiration yea
104 105 106 |
# File 'lib/asdawqw/models/reservation_notification_object.rb', line 104 def credit_card_expiration_year @credit_card_expiration_year end |
#credit_card_number ⇒ String
Credit card number
96 97 98 |
# File 'lib/asdawqw/models/reservation_notification_object.rb', line 96 def credit_card_number @credit_card_number end |
#credit_card_type ⇒ String
Credit card type
92 93 94 |
# File 'lib/asdawqw/models/reservation_notification_object.rb', line 92 def credit_card_type @credit_card_type end |
#customer_name ⇒ String
Guest full name (in format firstName, lastName)
40 41 42 |
# File 'lib/asdawqw/models/reservation_notification_object.rb', line 40 def customer_name @customer_name end |
#email ⇒ String
Guest email
80 81 82 |
# File 'lib/asdawqw/models/reservation_notification_object.rb', line 80 def email @email end |
#fees ⇒ List of ReservationFeeNotificationModel
List of models
117 118 119 |
# File 'lib/asdawqw/models/reservation_notification_object.rb', line 117 def fees @fees end |
#from_date ⇒ Date
Reservation date from. Date is in format “yyyy-MM-dd”
44 45 46 |
# File 'lib/asdawqw/models/reservation_notification_object.rb', line 44 def from_date @from_date end |
#new_state ⇒ String
Reservation state
36 37 38 |
# File 'lib/asdawqw/models/reservation_notification_object.rb', line 36 def new_state @new_state end |
#notes ⇒ String
Guest notes
88 89 90 |
# File 'lib/asdawqw/models/reservation_notification_object.rb', line 88 def notes @notes end |
#phone ⇒ String
Guest phone
84 85 86 |
# File 'lib/asdawqw/models/reservation_notification_object.rb', line 84 def phone @phone end |
#product_id ⇒ String
Id of the product in BookingPal
15 16 17 |
# File 'lib/asdawqw/models/reservation_notification_object.rb', line 15 def product_id @product_id end |
#rate ⇒ ReservationRateNotifcationModel
Model
129 130 131 |
# File 'lib/asdawqw/models/reservation_notification_object.rb', line 129 def rate @rate end |
#reservation_id ⇒ String
Id of the reservation in BookingPal
11 12 13 |
# File 'lib/asdawqw/models/reservation_notification_object.rb', line 11 def reservation_id @reservation_id end |
#state ⇒ String
Guest state
76 77 78 |
# File 'lib/asdawqw/models/reservation_notification_object.rb', line 76 def state @state end |
#supplier_id ⇒ String
Id of the property manager
19 20 21 |
# File 'lib/asdawqw/models/reservation_notification_object.rb', line 19 def supplier_id @supplier_id end |
#taxes ⇒ List of ReservationTaxNotificationModel
List of models
121 122 123 |
# File 'lib/asdawqw/models/reservation_notification_object.rb', line 121 def taxes @taxes end |
#to_date ⇒ Date
Reservation date to. Date is in format “yyyy-MM-dd”
48 49 50 |
# File 'lib/asdawqw/models/reservation_notification_object.rb', line 48 def to_date @to_date end |
#total ⇒ Float
Best available rate (This is the total value that guests will pay, including rate, fees, taxes, and all commissions. )
113 114 115 |
# File 'lib/asdawqw/models/reservation_notification_object.rb', line 113 def total @total end |
#unique_key ⇒ String
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).
32 33 34 |
# File 'lib/asdawqw/models/reservation_notification_object.rb', line 32 def unique_key @unique_key end |
#zip ⇒ String
Guest zip code
68 69 70 |
# File 'lib/asdawqw/models/reservation_notification_object.rb', line 68 def zip @zip end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 |
# File 'lib/asdawqw/models/reservation_notification_object.rb', line 230 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'] # Parameter is an array, so we need to iterate through it fees = nil unless hash['fees'].nil? fees = [] hash['fees'].each do |structure| fees << (ReservationFeeNotificationModel.from_hash(structure) if structure) end end # Parameter is an array, so we need to iterate through it taxes = nil unless hash['taxes'].nil? taxes = [] hash['taxes'].each do |structure| taxes << (ReservationTaxNotificationModel.from_hash(structure) if structure) end end if hash['commission'] commission = ReservationCommissionsNotificationModel.from_hash(hash['commission']) end rate = ReservationRateNotifcationModel.from_hash(hash['rate']) if hash['rate'] address = hash['address'] city = hash['city'] zip = hash['zip'] country = hash['country'] state = hash['state'] phone = hash['phone'] notes = hash['notes'] credit_card_type = hash['creditCardType'] credit_card_number = hash['creditCardNumber'] credit_card_expiration_month = hash['creditCardExpirationMonth'] credit_card_expiration_year = hash['creditCardExpirationYear'] credit_card_cid = hash['creditCardCid'] # Create object from extracted values. ReservationNotificationObject.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, fees, taxes, commission, rate, address, city, zip, country, state, phone, notes, credit_card_type, credit_card_number, credit_card_expiration_month, credit_card_expiration_year, credit_card_cid) end |
.names ⇒ Object
A mapping from model property names to API property names.
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 164 165 |
# File 'lib/asdawqw/models/reservation_notification_object.rb', line 132 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['address'] = 'address' @_hash['city'] = 'city' @_hash['zip'] = 'zip' @_hash['country'] = 'country' @_hash['state'] = 'state' @_hash['email'] = 'email' @_hash['phone'] = 'phone' @_hash['notes'] = 'notes' @_hash['credit_card_type'] = 'creditCardType' @_hash['credit_card_number'] = 'creditCardNumber' @_hash['credit_card_expiration_month'] = 'creditCardExpirationMonth' @_hash['credit_card_expiration_year'] = 'creditCardExpirationYear' @_hash['credit_card_cid'] = 'creditCardCid' @_hash['total'] = 'total' @_hash['fees'] = 'fees' @_hash['taxes'] = 'taxes' @_hash['commission'] = 'commission' @_hash['rate'] = 'rate' @_hash end |