Class: Asdawqw::Taxes
- Defined in:
- lib/asdawqw/models/taxes.rb
Overview
Taxes Model.
Instance Attribute Summary collapse
-
#alt_id ⇒ String
Alternative Id of the tax (tax id in your system).
-
#name ⇒ String
Tax name.
-
#type ⇒ TaxisTypeEnum
Tax type SalesTaxExcluded.
-
#value ⇒ Float
Tax value.
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(name = nil, value = nil, type = nil, alt_id = nil) ⇒ Taxes
constructor
A new instance of Taxes.
Methods inherited from BaseModel
Constructor Details
#initialize(name = nil, value = nil, type = nil, alt_id = nil) ⇒ Taxes
Returns a new instance of Taxes.
35 36 37 38 39 40 41 42 43 |
# File 'lib/asdawqw/models/taxes.rb', line 35 def initialize(name = nil, value = nil, type = nil, alt_id = nil) @name = name @type = type @value = value @alt_id = alt_id end |
Instance Attribute Details
#alt_id ⇒ String
Alternative Id of the tax (tax id in your system)
23 24 25 |
# File 'lib/asdawqw/models/taxes.rb', line 23 def alt_id @alt_id end |
#type ⇒ TaxisTypeEnum
Tax type SalesTaxExcluded
15 16 17 |
# File 'lib/asdawqw/models/taxes.rb', line 15 def type @type end |
#value ⇒ Float
Tax value
19 20 21 |
# File 'lib/asdawqw/models/taxes.rb', line 19 def value @value end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/asdawqw/models/taxes.rb', line 46 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. name = hash['name'] value = hash['value'] type = hash['type'] alt_id = hash['altId'] # Create object from extracted values. Taxes.new(name, value, type, alt_id) end |
.names ⇒ Object
A mapping from model property names to API property names.
26 27 28 29 30 31 32 33 |
# File 'lib/asdawqw/models/taxes.rb', line 26 def self.names @_hash = {} if @_hash.nil? @_hash['name'] = 'name' @_hash['type'] = 'type' @_hash['value'] = 'value' @_hash['alt_id'] = 'altId' @_hash end |