Class: Asdawqw::Taxes

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

Overview

Taxes Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

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_idString

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

Returns:



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

def alt_id
  @alt_id
end

#nameString

Tax name

Returns:



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

def name
  @name
end

#typeTaxisTypeEnum

Tax type SalesTaxExcluded

Returns:



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

def type
  @type
end

#valueFloat

Tax value

Returns:

  • (Float)


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

.namesObject

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