Class: Asdawqw::ManualPolicies

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

Overview

ManualPolicies Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

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_daysInteger

Days before check-in when cancellation policy will be charged

Returns:

  • (Integer)


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

def before_days
  @before_days
end

#cancellation_feeFloat

Cancellation transaction fee - additional fee on cancellation

Returns:

  • (Float)


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

def cancellation_fee
  @cancellation_fee
end

#charge_valueInteger

Percentage or flat value which will be charged in case of cancellation

Returns:

  • (Integer)


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

.namesObject

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