Class: Taxamo::InputTransactionLine

Inherits:
Object
  • Object
show all
Defined in:
lib/taxamo/models/inputtransactionline.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ InputTransactionLine

Returns a new instance of InputTransactionLine.



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/taxamo/models/inputtransactionline.rb', line 41

def initialize(attributes = {})
  return if attributes.nil? or attributes.empty?
  # Morph attribute keys into undescored rubyish style
  if attributes.key?("product_type")
    @product_type = attributes["product_type"]
      
  end
  if attributes.key?("deducted_tax_rate")
    @deducted_tax_rate = attributes["deducted_tax_rate"]
      
  end
  if attributes.key?("supply_date")
    @supply_date = attributes["supply_date"]
      
  end
  if attributes.key?("unit_price")
    @unit_price = attributes["unit_price"]
      
  end
  if attributes.key?("unit_of_measure")
    @unit_of_measure = attributes["unit_of_measure"]
      
  end
  if attributes.key?("quantity")
    @quantity = attributes["quantity"]
      
  end
  if attributes.key?("custom_fields")
    if (value = attributes["custom_fields"]).is_a?(Array)
        @custom_fields = value.map{ |v| CustomFields.new(v) }
      end
    end
  if attributes.key?("line_key")
    @line_key = attributes["line_key"]
      
  end
  if attributes.key?("tax_name")
    @tax_name = attributes["tax_name"]
      
  end
  if attributes.key?("product_code")
    @product_code = attributes["product_code"]
      
  end
  if attributes.key?("amount")
    @amount = attributes["amount"]
      
  end
  if attributes.key?("custom_id")
    @custom_id = attributes["custom_id"]
      
  end
  if attributes.key?("informative")
    @informative = attributes["informative"]
      
  end
  if attributes.key?("tax_rate")
    @tax_rate = attributes["tax_rate"]
      
  end
  if attributes.key?("total_amount")
    @total_amount = attributes["total_amount"]
      
  end
  if attributes.key?("product_tax_code")
    @product_tax_code = attributes["product_tax_code"]
      
  end
  if attributes.key?("description")
    @description = attributes["description"]
      
  end
  

end

Instance Attribute Details

#amountObject

Returns the value of attribute amount.



15
16
17
# File 'lib/taxamo/models/inputtransactionline.rb', line 15

def amount
  @amount
end

#custom_fieldsObject

Returns the value of attribute custom_fields.



15
16
17
# File 'lib/taxamo/models/inputtransactionline.rb', line 15

def custom_fields
  @custom_fields
end

#custom_idObject

Returns the value of attribute custom_id.



15
16
17
# File 'lib/taxamo/models/inputtransactionline.rb', line 15

def custom_id
  @custom_id
end

#deducted_tax_rateObject

Returns the value of attribute deducted_tax_rate.



15
16
17
# File 'lib/taxamo/models/inputtransactionline.rb', line 15

def deducted_tax_rate
  @deducted_tax_rate
end

#descriptionObject

Returns the value of attribute description.



15
16
17
# File 'lib/taxamo/models/inputtransactionline.rb', line 15

def description
  @description
end

#informativeObject

Returns the value of attribute informative.



15
16
17
# File 'lib/taxamo/models/inputtransactionline.rb', line 15

def informative
  @informative
end

#line_keyObject

Returns the value of attribute line_key.



15
16
17
# File 'lib/taxamo/models/inputtransactionline.rb', line 15

def line_key
  @line_key
end

#product_codeObject

Returns the value of attribute product_code.



15
16
17
# File 'lib/taxamo/models/inputtransactionline.rb', line 15

def product_code
  @product_code
end

#product_tax_codeObject

Returns the value of attribute product_tax_code.



15
16
17
# File 'lib/taxamo/models/inputtransactionline.rb', line 15

def product_tax_code
  @product_tax_code
end

#product_typeObject

Returns the value of attribute product_type.



15
16
17
# File 'lib/taxamo/models/inputtransactionline.rb', line 15

def product_type
  @product_type
end

#quantityObject

Returns the value of attribute quantity.



15
16
17
# File 'lib/taxamo/models/inputtransactionline.rb', line 15

def quantity
  @quantity
end

#supply_dateObject

Returns the value of attribute supply_date.



15
16
17
# File 'lib/taxamo/models/inputtransactionline.rb', line 15

def supply_date
  @supply_date
end

#tax_nameObject

Returns the value of attribute tax_name.



15
16
17
# File 'lib/taxamo/models/inputtransactionline.rb', line 15

def tax_name
  @tax_name
end

#tax_rateObject

Returns the value of attribute tax_rate.



15
16
17
# File 'lib/taxamo/models/inputtransactionline.rb', line 15

def tax_rate
  @tax_rate
end

#total_amountObject

Returns the value of attribute total_amount.



15
16
17
# File 'lib/taxamo/models/inputtransactionline.rb', line 15

def total_amount
  @total_amount
end

#unit_of_measureObject

Returns the value of attribute unit_of_measure.



15
16
17
# File 'lib/taxamo/models/inputtransactionline.rb', line 15

def unit_of_measure
  @unit_of_measure
end

#unit_priceObject

Returns the value of attribute unit_price.



15
16
17
# File 'lib/taxamo/models/inputtransactionline.rb', line 15

def unit_price
  @unit_price
end

Class Method Details

.attribute_mapObject

:internal => :external



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/taxamo/models/inputtransactionline.rb', line 18

def self.attribute_map
  {
    :product_type => :product_type,
    :deducted_tax_rate => :deducted_tax_rate,
    :supply_date => :supply_date,
    :unit_price => :unit_price,
    :unit_of_measure => :unit_of_measure,
    :quantity => :quantity,
    :custom_fields => :custom_fields,
    :line_key => :line_key,
    :tax_name => :tax_name,
    :product_code => :product_code,
    :amount => :amount,
    :custom_id => :custom_id,
    :informative => :informative,
    :tax_rate => :tax_rate,
    :total_amount => :total_amount,
    :product_tax_code => :product_tax_code,
    :description => :description

  }
end

Instance Method Details

#to_bodyObject



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/taxamo/models/inputtransactionline.rb', line 117

def to_body
  body = {}
  self.class.attribute_map.each_pair do |key, value|
    v = self.send(key)
    unless v.nil?
      if v.is_a?(Array)
        array = Array.new
        v.each do |item|
          if item.respond_to?("to_body".to_sym)
            array.push item.to_body
          else
            array.push item
          end
        end
        body[value] = array
      else
        if v.respond_to?("to_body".to_sym)
          body[value] = v.to_body
        else
          body[value] = v
        end
      end
    end
  end
  body
end