Class: Asdawqw::Fee

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

Overview

Fee Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(entity_type = nil, fee_type = nil, name = nil, unit = nil, value = nil, value_type = nil, begin_date = nil, end_date = nil, option = nil, tax_type = nil, alt_id = nil) ⇒ Fee

Returns a new instance of Fee.



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

def initialize(entity_type = nil,
               fee_type = nil,
               name = nil,
               unit = nil,
               value = nil,
               value_type = nil,
               begin_date = nil,
               end_date = nil,
               option = nil,
               tax_type = nil,
               alt_id = nil)
  @begin_date = begin_date
  @end_date = end_date
  @entity_type = entity_type
  @fee_type = fee_type
  @option = option
  @name = name
  @tax_type = tax_type
  @unit = unit
  @value = value
  @value_type = value_type
  @alt_id = alt_id
end

Instance Attribute Details

#alt_idString

Alternative Id of the fee (fee id in your system)

Returns:



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

def alt_id
  @alt_id
end

#begin_dateDate

Fee applies from Date. Date should be in format “yyyy-MM-dd”

Returns:

  • (Date)


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

def begin_date
  @begin_date
end

#end_dateDate

Fee applies to Date. Date should be in format “yyyy-MM-dd”

Returns:

  • (Date)


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

def end_date
  @end_date
end

#entity_typeFeeEntityTypeEnum

Entity type OPTIONAL, MANDATORY_PAL

Returns:



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

def entity_type
  @entity_type
end

#fee_typeFeeTypeEnum

Fee Type PET_FEE, DEPOSIT

Returns:



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

def fee_type
  @fee_type
end

#nameString

Fee name. For example: Extra person, Cleaning fee, Parking etc.

Returns:



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

def name
  @name
end

#optionInteger

Number of guests when set extra person fee. Only values >0 are allowed.

Returns:

  • (Integer)


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

def option
  @option
end

#tax_typeFeeTaxTypeEnum

Tax Type NOT_TAXABLE, By default: NOT_TAXABLE

Returns:



35
36
37
# File 'lib/asdawqw/models/fee.rb', line 35

def tax_type
  @tax_type
end

#unitFeeUnitEnum

Fee unit (PER_STAY, PER_DAY, PER_PERSON, PER_DAY_PER_PERSON, PER_DAY_PER_PERSON_EXTRA)

Returns:



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

def unit
  @unit
end

#valueFloat

Fee value

Returns:

  • (Float)


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

def value
  @value
end

#value_typeFeeValueTypeEnum

Value Type (FLAT, PERCENT)

Returns:



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

def value_type
  @value_type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/asdawqw/models/fee.rb', line 96

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  entity_type = hash['entityType']
  fee_type = hash['feeType']
  name = hash['name']
  unit = hash['unit']
  value = hash['value']
  value_type = hash['valueType']
  begin_date = hash['beginDate']
  end_date = hash['endDate']
  option = hash['option']
  tax_type = hash['taxType']
  alt_id = hash['altId']

  # Create object from extracted values.
  Fee.new(entity_type,
          fee_type,
          name,
          unit,
          value,
          value_type,
          begin_date,
          end_date,
          option,
          tax_type,
          alt_id)
end

.namesObject

A mapping from model property names to API property names.



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/asdawqw/models/fee.rb', line 55

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['begin_date'] = 'beginDate'
  @_hash['end_date'] = 'endDate'
  @_hash['entity_type'] = 'entityType'
  @_hash['fee_type'] = 'feeType'
  @_hash['option'] = 'option'
  @_hash['name'] = 'name'
  @_hash['tax_type'] = 'taxType'
  @_hash['unit'] = 'unit'
  @_hash['value'] = 'value'
  @_hash['value_type'] = 'valueType'
  @_hash['alt_id'] = 'altId'
  @_hash
end