Class: Asdawqw::Policies

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

Overview

Policies Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(payment_policy = nil, cancellation_policy = nil, fee_tax_mandatory = nil, terms = nil, check_in_time = nil, check_out_time = nil, lead_time = nil) ⇒ Policies

Returns a new instance of Policies.



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

def initialize(payment_policy = nil,
               cancellation_policy = nil,
               fee_tax_mandatory = nil,
               terms = nil,
               check_in_time = nil,
               check_out_time = nil,
               lead_time = nil)
  @payment_policy = payment_policy
  @cancellation_policy = cancellation_policy
  @fee_tax_mandatory = fee_tax_mandatory
  @terms = terms
  @check_in_time = check_in_time
  @check_out_time = check_out_time
  @lead_time = lead_time
end

Instance Attribute Details

#cancellation_policyCancellationPolicy

Model

Returns:



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

def cancellation_policy
  @cancellation_policy
end

#check_in_timeString

Time of Check in (HH:MM:SS)

Returns:



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

def check_in_time
  @check_in_time
end

#check_out_timeString

Time of Check out (HH:MM:SS)

Returns:



31
32
33
# File 'lib/asdawqw/models/policies.rb', line 31

def check_out_time
  @check_out_time
end

#fee_tax_mandatoryFeeTaxMandatory

Model

Returns:



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

def fee_tax_mandatory
  @fee_tax_mandatory
end

#lead_timeInteger

Minimum number of days before check-in for which reservation is allowed to be booked. Allowed values are 0-7.

Returns:

  • (Integer)


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

def lead_time
  @lead_time
end

#payment_policyPaymentPolicy

Model

Returns:



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

def payment_policy
  @payment_policy
end

#termsString

Full URL to PM terms and conditions

Returns:



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

def terms
  @terms
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/asdawqw/models/policies.rb', line 68

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  payment_policy = PaymentPolicy.from_hash(hash['paymentPolicy']) if
    hash['paymentPolicy']
  if hash['cancellationPolicy']
    cancellation_policy = CancellationPolicy.from_hash(hash['cancellationPolicy'])
  end
  fee_tax_mandatory = FeeTaxMandatory.from_hash(hash['feeTaxMandatory']) if
    hash['feeTaxMandatory']
  terms = hash['terms']
  check_in_time = hash['checkInTime']
  check_out_time = hash['checkOutTime']
  lead_time = hash['leadTime']

  # Create object from extracted values.
  Policies.new(payment_policy,
               cancellation_policy,
               fee_tax_mandatory,
               terms,
               check_in_time,
               check_out_time,
               lead_time)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['payment_policy'] = 'paymentPolicy'
  @_hash['cancellation_policy'] = 'cancellationPolicy'
  @_hash['fee_tax_mandatory'] = 'feeTaxMandatory'
  @_hash['terms'] = 'terms'
  @_hash['check_in_time'] = 'checkInTime'
  @_hash['check_out_time'] = 'checkOutTime'
  @_hash['lead_time'] = 'leadTime'
  @_hash
end