Class: Asdawqw::Fee
Overview
Fee Model.
Instance Attribute Summary collapse
-
#alt_id ⇒ String
Alternative Id of the fee (fee id in your system).
-
#begin_date ⇒ Date
Fee applies from Date.
-
#end_date ⇒ Date
Fee applies to Date.
-
#entity_type ⇒ FeeEntityTypeEnum
Entity type OPTIONAL, MANDATORY_PAL.
-
#fee_type ⇒ FeeTypeEnum
Fee Type PET_FEE, DEPOSIT.
-
#name ⇒ String
Fee name.
-
#option ⇒ Integer
Number of guests when set extra person fee.
-
#tax_type ⇒ FeeTaxTypeEnum
Tax Type NOT_TAXABLE, By default: NOT_TAXABLE.
-
#unit ⇒ FeeUnitEnum
Fee unit (PER_STAY, PER_DAY, PER_PERSON, PER_DAY_PER_PERSON, PER_DAY_PER_PERSON_EXTRA).
-
#value ⇒ Float
Fee value.
-
#value_type ⇒ FeeValueTypeEnum
Value Type (FLAT, PERCENT).
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(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
constructor
A new instance of Fee.
Methods inherited from BaseModel
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_id ⇒ String
Alternative Id of the fee (fee id in your system)
52 53 54 |
# File 'lib/asdawqw/models/fee.rb', line 52 def alt_id @alt_id end |
#begin_date ⇒ Date
Fee applies from Date. Date should be in format “yyyy-MM-dd”
11 12 13 |
# File 'lib/asdawqw/models/fee.rb', line 11 def begin_date @begin_date end |
#end_date ⇒ Date
Fee applies to Date. Date should be in format “yyyy-MM-dd”
15 16 17 |
# File 'lib/asdawqw/models/fee.rb', line 15 def end_date @end_date end |
#entity_type ⇒ FeeEntityTypeEnum
Entity type OPTIONAL, MANDATORY_PAL
19 20 21 |
# File 'lib/asdawqw/models/fee.rb', line 19 def entity_type @entity_type end |
#fee_type ⇒ FeeTypeEnum
Fee Type PET_FEE, DEPOSIT
23 24 25 |
# File 'lib/asdawqw/models/fee.rb', line 23 def fee_type @fee_type end |
#name ⇒ String
Fee name. For example: Extra person, Cleaning fee, Parking etc.
31 32 33 |
# File 'lib/asdawqw/models/fee.rb', line 31 def name @name end |
#option ⇒ Integer
Number of guests when set extra person fee. Only values >0 are allowed.
27 28 29 |
# File 'lib/asdawqw/models/fee.rb', line 27 def option @option end |
#tax_type ⇒ FeeTaxTypeEnum
Tax Type NOT_TAXABLE, By default: NOT_TAXABLE
35 36 37 |
# File 'lib/asdawqw/models/fee.rb', line 35 def tax_type @tax_type end |
#unit ⇒ FeeUnitEnum
Fee unit (PER_STAY, PER_DAY, PER_PERSON, PER_DAY_PER_PERSON, PER_DAY_PER_PERSON_EXTRA)
40 41 42 |
# File 'lib/asdawqw/models/fee.rb', line 40 def unit @unit end |
#value ⇒ Float
Fee value
44 45 46 |
# File 'lib/asdawqw/models/fee.rb', line 44 def value @value end |
#value_type ⇒ FeeValueTypeEnum
Value Type (FLAT, PERCENT)
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 |
.names ⇒ Object
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 |