Class: Asdawqw::ManualPolicies
- Defined in:
- lib/asdawqw/models/manual_policies.rb
Overview
ManualPolicies Model.
Instance Attribute Summary collapse
-
#before_days ⇒ Integer
Days before check-in when cancellation policy will be charged.
-
#cancellation_fee ⇒ Float
Cancellation transaction fee - additional fee on cancellation.
-
#charge_value ⇒ Integer
Percentage or flat value which will be charged in case of cancellation.
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(charge_value = nil, before_days = nil, cancellation_fee = nil) ⇒ ManualPolicies
constructor
A new instance of ManualPolicies.
Methods inherited from BaseModel
Constructor Details
#initialize(charge_value = nil, before_days = nil, cancellation_fee = nil) ⇒ ManualPolicies
Returns a new instance of ManualPolicies.
30 31 32 33 34 35 36 |
# File 'lib/asdawqw/models/manual_policies.rb', line 30 def initialize(charge_value = nil, before_days = nil, cancellation_fee = nil) @charge_value = charge_value @before_days = before_days @cancellation_fee = cancellation_fee end |
Instance Attribute Details
#before_days ⇒ Integer
Days before check-in when cancellation policy will be charged
15 16 17 |
# File 'lib/asdawqw/models/manual_policies.rb', line 15 def before_days @before_days end |
#cancellation_fee ⇒ Float
Cancellation transaction fee - additional fee on cancellation
19 20 21 |
# File 'lib/asdawqw/models/manual_policies.rb', line 19 def cancellation_fee @cancellation_fee end |
#charge_value ⇒ Integer
Percentage or flat value which will be charged in case of cancellation
11 12 13 |
# File 'lib/asdawqw/models/manual_policies.rb', line 11 def charge_value @charge_value end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/asdawqw/models/manual_policies.rb', line 39 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. charge_value = hash['chargeValue'] before_days = hash['beforeDays'] cancellation_fee = hash['cancellationFee'] # Create object from extracted values. ManualPolicies.new(charge_value, before_days, cancellation_fee) end |
.names ⇒ Object
A mapping from model property names to API property names.
22 23 24 25 26 27 28 |
# File 'lib/asdawqw/models/manual_policies.rb', line 22 def self.names @_hash = {} if @_hash.nil? @_hash['charge_value'] = 'chargeValue' @_hash['before_days'] = 'beforeDays' @_hash['cancellation_fee'] = 'cancellationFee' @_hash end |