Class: InputTransactionLine

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

Overview

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](www.apache.org/licenses/LICENSE-2.0)

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ InputTransactionLine

Returns a new instance of InputTransactionLine.



39
40
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
# File 'lib/taxamo/models/inputtransactionline.rb', line 39

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

end

Instance Attribute Details

#amountObject

Returns the value of attribute amount.



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

def amount
  @amount
end

#custom_fieldsObject

Returns the value of attribute custom_fields.



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

def custom_fields
  @custom_fields
end

#custom_idObject

Returns the value of attribute custom_id.



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

def custom_id
  @custom_id
end

#descriptionObject

Returns the value of attribute description.



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

def description
  @description
end

#informativeObject

Returns the value of attribute informative.



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

def informative
  @informative
end

#line_keyObject

Returns the value of attribute line_key.



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

def line_key
  @line_key
end

#product_codeObject

Returns the value of attribute product_code.



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

def product_code
  @product_code
end

#product_tax_codeObject

Returns the value of attribute product_tax_code.



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

def product_tax_code
  @product_tax_code
end

#product_typeObject

Returns the value of attribute product_type.



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

def product_type
  @product_type
end

#quantityObject

Returns the value of attribute quantity.



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

def quantity
  @quantity
end

#supply_dateObject

Returns the value of attribute supply_date.



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

def supply_date
  @supply_date
end

#tax_nameObject

Returns the value of attribute tax_name.



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

def tax_name
  @tax_name
end

#tax_rateObject

Returns the value of attribute tax_rate.



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

def tax_rate
  @tax_rate
end

#total_amountObject

Returns the value of attribute total_amount.



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

def total_amount
  @total_amount
end

#unit_of_measureObject

Returns the value of attribute unit_of_measure.



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

def unit_of_measure
  @unit_of_measure
end

#unit_priceObject

Returns the value of attribute unit_price.



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

def unit_price
  @unit_price
end

Class Method Details

.attribute_mapObject

:internal => :external



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

def self.attribute_map
  {
    :product_type => :product_type,
    :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



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/taxamo/models/inputtransactionline.rb', line 111

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