taxamo 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +7 -0
- data/LICENSE +11 -0
- data/README.md +120 -0
- data/Rakefile +7 -0
- data/lib/monkey.rb +90 -0
- data/lib/swagger.rb +93 -0
- data/lib/swagger/configuration.rb +21 -0
- data/lib/swagger/request.rb +198 -0
- data/lib/swagger/response.rb +87 -0
- data/lib/taxamo.rb +999 -0
- data/lib/taxamo/models/additionalcurrencies.rb +62 -0
- data/lib/taxamo/models/additionalcurrency.rb +82 -0
- data/lib/taxamo/models/bycountry.rb +77 -0
- data/lib/taxamo/models/bystatus.rb +69 -0
- data/lib/taxamo/models/bytaxationtype.rb +82 -0
- data/lib/taxamo/models/c.rb +77 -0
- data/lib/taxamo/models/calculatesimpletaxout.rb +62 -0
- data/lib/taxamo/models/calculatetaxin.rb +62 -0
- data/lib/taxamo/models/calculatetaxlocationout.rb +97 -0
- data/lib/taxamo/models/calculatetaxout.rb +62 -0
- data/lib/taxamo/models/canceltransactionout.rb +62 -0
- data/lib/taxamo/models/capturepaymentout.rb +62 -0
- data/lib/taxamo/models/confirmtransactionin.rb +62 -0
- data/lib/taxamo/models/confirmtransactionout.rb +62 -0
- data/lib/taxamo/models/countries.rb +112 -0
- data/lib/taxamo/models/country.rb +114 -0
- data/lib/taxamo/models/countryschema.rb +114 -0
- data/lib/taxamo/models/createpaymentin.rb +72 -0
- data/lib/taxamo/models/createpaymentout.rb +62 -0
- data/lib/taxamo/models/createrefundin.rb +77 -0
- data/lib/taxamo/models/createrefundout.rb +77 -0
- data/lib/taxamo/models/createsmstokenin.rb +67 -0
- data/lib/taxamo/models/createsmstokenout.rb +62 -0
- data/lib/taxamo/models/createtransactionin.rb +67 -0
- data/lib/taxamo/models/createtransactionout.rb +62 -0
- data/lib/taxamo/models/currencyschema.rb +82 -0
- data/lib/taxamo/models/customfields.rb +67 -0
- data/lib/taxamo/models/emailinvoicein.rb +62 -0
- data/lib/taxamo/models/emailinvoiceout.rb +62 -0
- data/lib/taxamo/models/evidence.rb +112 -0
- data/lib/taxamo/models/evidenceschema.rb +77 -0
- data/lib/taxamo/models/getcountriesdictout.rb +63 -0
- data/lib/taxamo/models/getcurrenciesdictout.rb +63 -0
- data/lib/taxamo/models/getdailysettlementstatsout.rb +63 -0
- data/lib/taxamo/models/getproducttypesdictout.rb +63 -0
- data/lib/taxamo/models/getrefundsout.rb +63 -0
- data/lib/taxamo/models/getsettlementout.rb +83 -0
- data/lib/taxamo/models/getsettlementstatsbycountryout.rb +63 -0
- data/lib/taxamo/models/getsettlementstatsbytaxationtypeout.rb +62 -0
- data/lib/taxamo/models/getsettlementsummaryout.rb +62 -0
- data/lib/taxamo/models/gettransactionout.rb +62 -0
- data/lib/taxamo/models/gettransactionsstatsout.rb +62 -0
- data/lib/taxamo/models/inputtransaction.rb +184 -0
- data/lib/taxamo/models/inputtransactionline.rb +133 -0
- data/lib/taxamo/models/inputtransactionupdate.rb +184 -0
- data/lib/taxamo/models/invoiceaddress.rb +97 -0
- data/lib/taxamo/models/listpaymentsout.rb +63 -0
- data/lib/taxamo/models/listtransactionsout.rb +63 -0
- data/lib/taxamo/models/locategivenipout.rb +72 -0
- data/lib/taxamo/models/locatemyipout.rb +72 -0
- data/lib/taxamo/models/n.rb +77 -0
- data/lib/taxamo/models/payments.rb +72 -0
- data/lib/taxamo/models/producttypeschema.rb +62 -0
- data/lib/taxamo/models/report.rb +92 -0
- data/lib/taxamo/models/settlementdailystatsschema.rb +102 -0
- data/lib/taxamo/models/summary.rb +87 -0
- data/lib/taxamo/models/transaction.rb +279 -0
- data/lib/taxamo/models/transactionlines.rb +163 -0
- data/lib/taxamo/models/transactions.rb +279 -0
- data/lib/taxamo/models/unconfirmtransactionin.rb +62 -0
- data/lib/taxamo/models/unconfirmtransactionout.rb +62 -0
- data/lib/taxamo/models/updatetransactionin.rb +62 -0
- data/lib/taxamo/models/updatetransactionout.rb +62 -0
- data/lib/taxamo/models/validatetaxnumberout.rb +77 -0
- data/lib/taxamo/models/verifysmstokenout.rb +62 -0
- data/lib/taxamo/version.rb +17 -0
- data/taxamo.gemspec +31 -0
- data/test/taxamo/connectivity_test.rb +55 -0
- data/test/taxamo/tax_test.rb +147 -0
- data/test/taxamo/transactions_api_test.rb +308 -0
- metadata +226 -0
@@ -0,0 +1,62 @@
|
|
1
|
+
# Copyright 2014-2015 Taxamo, Ltd.
|
2
|
+
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
|
6
|
+
#
|
7
|
+
# Unless required by applicable law or agreed to in writing, software
|
8
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
9
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
10
|
+
# See the License for the specific language governing permissions and
|
11
|
+
# limitations under the License.
|
12
|
+
|
13
|
+
class GetSettlementStatsByTaxationTypeOut
|
14
|
+
attr_accessor :by_taxation_type
|
15
|
+
|
16
|
+
# :internal => :external
|
17
|
+
def self.attribute_map
|
18
|
+
{
|
19
|
+
:by_taxation_type => :by_taxation_type
|
20
|
+
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
def initialize(attributes = {})
|
25
|
+
return if attributes.empty?
|
26
|
+
# Morph attribute keys into undescored rubyish style
|
27
|
+
if attributes["by_taxation_type"]
|
28
|
+
@by_taxation_type = ByTaxationType.new(attributes["by_taxation_type"])
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
def to_body
|
36
|
+
body = {}
|
37
|
+
self.class.attribute_map.each_pair do |key, value|
|
38
|
+
v = self.send(key)
|
39
|
+
unless v.nil?
|
40
|
+
if v.is_a?(Array)
|
41
|
+
array = Array.new
|
42
|
+
v.each do |item|
|
43
|
+
if item.respond_to?("to_body".to_sym)
|
44
|
+
array.push item.to_body
|
45
|
+
else
|
46
|
+
array.push item
|
47
|
+
end
|
48
|
+
end
|
49
|
+
body[value] = array
|
50
|
+
else
|
51
|
+
if v.respond_to?("to_body".to_sym)
|
52
|
+
body[value] = v.to_body
|
53
|
+
else
|
54
|
+
body[value] = v
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
body
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# Copyright 2014-2015 Taxamo, Ltd.
|
2
|
+
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
|
6
|
+
#
|
7
|
+
# Unless required by applicable law or agreed to in writing, software
|
8
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
9
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
10
|
+
# See the License for the specific language governing permissions and
|
11
|
+
# limitations under the License.
|
12
|
+
|
13
|
+
class GetSettlementSummaryOut
|
14
|
+
attr_accessor :summary
|
15
|
+
|
16
|
+
# :internal => :external
|
17
|
+
def self.attribute_map
|
18
|
+
{
|
19
|
+
:summary => :summary
|
20
|
+
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
def initialize(attributes = {})
|
25
|
+
return if attributes.empty?
|
26
|
+
# Morph attribute keys into undescored rubyish style
|
27
|
+
if attributes["summary"]
|
28
|
+
@summary = Summary.new(attributes["summary"])
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
def to_body
|
36
|
+
body = {}
|
37
|
+
self.class.attribute_map.each_pair do |key, value|
|
38
|
+
v = self.send(key)
|
39
|
+
unless v.nil?
|
40
|
+
if v.is_a?(Array)
|
41
|
+
array = Array.new
|
42
|
+
v.each do |item|
|
43
|
+
if item.respond_to?("to_body".to_sym)
|
44
|
+
array.push item.to_body
|
45
|
+
else
|
46
|
+
array.push item
|
47
|
+
end
|
48
|
+
end
|
49
|
+
body[value] = array
|
50
|
+
else
|
51
|
+
if v.respond_to?("to_body".to_sym)
|
52
|
+
body[value] = v.to_body
|
53
|
+
else
|
54
|
+
body[value] = v
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
body
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# Copyright 2014-2015 Taxamo, Ltd.
|
2
|
+
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
|
6
|
+
#
|
7
|
+
# Unless required by applicable law or agreed to in writing, software
|
8
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
9
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
10
|
+
# See the License for the specific language governing permissions and
|
11
|
+
# limitations under the License.
|
12
|
+
|
13
|
+
class GetTransactionOut
|
14
|
+
attr_accessor :transaction
|
15
|
+
|
16
|
+
# :internal => :external
|
17
|
+
def self.attribute_map
|
18
|
+
{
|
19
|
+
:transaction => :transaction
|
20
|
+
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
def initialize(attributes = {})
|
25
|
+
return if attributes.empty?
|
26
|
+
# Morph attribute keys into undescored rubyish style
|
27
|
+
if attributes["transaction"]
|
28
|
+
@transaction = Transaction.new(attributes["transaction"])
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
def to_body
|
36
|
+
body = {}
|
37
|
+
self.class.attribute_map.each_pair do |key, value|
|
38
|
+
v = self.send(key)
|
39
|
+
unless v.nil?
|
40
|
+
if v.is_a?(Array)
|
41
|
+
array = Array.new
|
42
|
+
v.each do |item|
|
43
|
+
if item.respond_to?("to_body".to_sym)
|
44
|
+
array.push item.to_body
|
45
|
+
else
|
46
|
+
array.push item
|
47
|
+
end
|
48
|
+
end
|
49
|
+
body[value] = array
|
50
|
+
else
|
51
|
+
if v.respond_to?("to_body".to_sym)
|
52
|
+
body[value] = v.to_body
|
53
|
+
else
|
54
|
+
body[value] = v
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
body
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# Copyright 2014-2015 Taxamo, Ltd.
|
2
|
+
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
|
6
|
+
#
|
7
|
+
# Unless required by applicable law or agreed to in writing, software
|
8
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
9
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
10
|
+
# See the License for the specific language governing permissions and
|
11
|
+
# limitations under the License.
|
12
|
+
|
13
|
+
class GetTransactionsStatsOut
|
14
|
+
attr_accessor :by_status
|
15
|
+
|
16
|
+
# :internal => :external
|
17
|
+
def self.attribute_map
|
18
|
+
{
|
19
|
+
:by_status => :by_status
|
20
|
+
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
def initialize(attributes = {})
|
25
|
+
return if attributes.empty?
|
26
|
+
# Morph attribute keys into undescored rubyish style
|
27
|
+
if attributes["by_status"]
|
28
|
+
@by_status = ByStatus.new(attributes["by_status"])
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
def to_body
|
36
|
+
body = {}
|
37
|
+
self.class.attribute_map.each_pair do |key, value|
|
38
|
+
v = self.send(key)
|
39
|
+
unless v.nil?
|
40
|
+
if v.is_a?(Array)
|
41
|
+
array = Array.new
|
42
|
+
v.each do |item|
|
43
|
+
if item.respond_to?("to_body".to_sym)
|
44
|
+
array.push item.to_body
|
45
|
+
else
|
46
|
+
array.push item
|
47
|
+
end
|
48
|
+
end
|
49
|
+
body[value] = array
|
50
|
+
else
|
51
|
+
if v.respond_to?("to_body".to_sym)
|
52
|
+
body[value] = v.to_body
|
53
|
+
else
|
54
|
+
body[value] = v
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
body
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
@@ -0,0 +1,184 @@
|
|
1
|
+
# Copyright 2014-2015 Taxamo, Ltd.
|
2
|
+
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
|
6
|
+
#
|
7
|
+
# Unless required by applicable law or agreed to in writing, software
|
8
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
9
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
10
|
+
# See the License for the specific language governing permissions and
|
11
|
+
# limitations under the License.
|
12
|
+
|
13
|
+
class InputTransaction
|
14
|
+
attr_accessor :buyer_credit_card_prefix, :custom_data, :buyer_name, :invoice_date, :currency_code, :supply_date, :invoice_address, :verification_token, :transaction_lines, :buyer_tax_number, :custom_fields, :force_country_code, :invoice_number, :order_date, :buyer_ip, :buyer_email, :original_transaction_key, :billing_country_code, :custom_id, :additional_currencies, :invoice_place, :evidence, :description, :tax_deducted, :tax_country_code
|
15
|
+
|
16
|
+
# :internal => :external
|
17
|
+
def self.attribute_map
|
18
|
+
{
|
19
|
+
:buyer_credit_card_prefix => :buyer_credit_card_prefix,
|
20
|
+
:custom_data => :custom_data,
|
21
|
+
:buyer_name => :buyer_name,
|
22
|
+
:invoice_date => :invoice_date,
|
23
|
+
:currency_code => :currency_code,
|
24
|
+
:supply_date => :supply_date,
|
25
|
+
:invoice_address => :invoice_address,
|
26
|
+
:verification_token => :verification_token,
|
27
|
+
:transaction_lines => :transaction_lines,
|
28
|
+
:buyer_tax_number => :buyer_tax_number,
|
29
|
+
:custom_fields => :custom_fields,
|
30
|
+
:force_country_code => :force_country_code,
|
31
|
+
:invoice_number => :invoice_number,
|
32
|
+
:order_date => :order_date,
|
33
|
+
:buyer_ip => :buyer_ip,
|
34
|
+
:buyer_email => :buyer_email,
|
35
|
+
:original_transaction_key => :original_transaction_key,
|
36
|
+
:billing_country_code => :billing_country_code,
|
37
|
+
:custom_id => :custom_id,
|
38
|
+
:additional_currencies => :additional_currencies,
|
39
|
+
:invoice_place => :invoice_place,
|
40
|
+
:evidence => :evidence,
|
41
|
+
:description => :description,
|
42
|
+
:tax_deducted => :tax_deducted,
|
43
|
+
:tax_country_code => :tax_country_code
|
44
|
+
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
def initialize(attributes = {})
|
49
|
+
return if attributes.empty?
|
50
|
+
# Morph attribute keys into undescored rubyish style
|
51
|
+
if attributes["buyer_credit_card_prefix"]
|
52
|
+
@buyer_credit_card_prefix = attributes["buyer_credit_card_prefix"]
|
53
|
+
|
54
|
+
end
|
55
|
+
if attributes["custom_data"]
|
56
|
+
@custom_data = attributes["custom_data"]
|
57
|
+
|
58
|
+
end
|
59
|
+
if attributes["buyer_name"]
|
60
|
+
@buyer_name = attributes["buyer_name"]
|
61
|
+
|
62
|
+
end
|
63
|
+
if attributes["invoice_date"]
|
64
|
+
@invoice_date = attributes["invoice_date"]
|
65
|
+
|
66
|
+
end
|
67
|
+
if attributes["currency_code"]
|
68
|
+
@currency_code = attributes["currency_code"]
|
69
|
+
|
70
|
+
end
|
71
|
+
if attributes["supply_date"]
|
72
|
+
@supply_date = attributes["supply_date"]
|
73
|
+
|
74
|
+
end
|
75
|
+
if attributes["invoice_address"]
|
76
|
+
@invoice_address = InvoiceAddress.new(attributes["invoice_address"])
|
77
|
+
|
78
|
+
end
|
79
|
+
if attributes["verification_token"]
|
80
|
+
@verification_token = attributes["verification_token"]
|
81
|
+
|
82
|
+
end
|
83
|
+
if attributes["transaction_lines"]
|
84
|
+
if (value = attributes["transaction_lines"]).is_a?(Array)
|
85
|
+
@transaction_lines = value.map{ |v| InputTransactionLine.new(v) }
|
86
|
+
end
|
87
|
+
end
|
88
|
+
if attributes["buyer_tax_number"]
|
89
|
+
@buyer_tax_number = attributes["buyer_tax_number"]
|
90
|
+
|
91
|
+
end
|
92
|
+
if attributes["custom_fields"]
|
93
|
+
if (value = attributes["custom_fields"]).is_a?(Array)
|
94
|
+
@custom_fields = value.map{ |v| CustomFields.new(v) }
|
95
|
+
end
|
96
|
+
end
|
97
|
+
if attributes["force_country_code"]
|
98
|
+
@force_country_code = attributes["force_country_code"]
|
99
|
+
|
100
|
+
end
|
101
|
+
if attributes["invoice_number"]
|
102
|
+
@invoice_number = attributes["invoice_number"]
|
103
|
+
|
104
|
+
end
|
105
|
+
if attributes["order_date"]
|
106
|
+
@order_date = attributes["order_date"]
|
107
|
+
|
108
|
+
end
|
109
|
+
if attributes["buyer_ip"]
|
110
|
+
@buyer_ip = attributes["buyer_ip"]
|
111
|
+
|
112
|
+
end
|
113
|
+
if attributes["buyer_email"]
|
114
|
+
@buyer_email = attributes["buyer_email"]
|
115
|
+
|
116
|
+
end
|
117
|
+
if attributes["original_transaction_key"]
|
118
|
+
@original_transaction_key = attributes["original_transaction_key"]
|
119
|
+
|
120
|
+
end
|
121
|
+
if attributes["billing_country_code"]
|
122
|
+
@billing_country_code = attributes["billing_country_code"]
|
123
|
+
|
124
|
+
end
|
125
|
+
if attributes["custom_id"]
|
126
|
+
@custom_id = attributes["custom_id"]
|
127
|
+
|
128
|
+
end
|
129
|
+
if attributes["additional_currencies"]
|
130
|
+
@additional_currencies = AdditionalCurrencies.new(attributes["additional_currencies"])
|
131
|
+
|
132
|
+
end
|
133
|
+
if attributes["invoice_place"]
|
134
|
+
@invoice_place = attributes["invoice_place"]
|
135
|
+
|
136
|
+
end
|
137
|
+
if attributes["evidence"]
|
138
|
+
@evidence = Evidence.new(attributes["evidence"])
|
139
|
+
|
140
|
+
end
|
141
|
+
if attributes["description"]
|
142
|
+
@description = attributes["description"]
|
143
|
+
|
144
|
+
end
|
145
|
+
if attributes["tax_deducted"]
|
146
|
+
@tax_deducted = attributes["tax_deducted"]
|
147
|
+
|
148
|
+
end
|
149
|
+
if attributes["tax_country_code"]
|
150
|
+
@tax_country_code = attributes["tax_country_code"]
|
151
|
+
|
152
|
+
end
|
153
|
+
|
154
|
+
|
155
|
+
end
|
156
|
+
|
157
|
+
def to_body
|
158
|
+
body = {}
|
159
|
+
self.class.attribute_map.each_pair do |key, value|
|
160
|
+
v = self.send(key)
|
161
|
+
unless v.nil?
|
162
|
+
if v.is_a?(Array)
|
163
|
+
array = Array.new
|
164
|
+
v.each do |item|
|
165
|
+
if item.respond_to?("to_body".to_sym)
|
166
|
+
array.push item.to_body
|
167
|
+
else
|
168
|
+
array.push item
|
169
|
+
end
|
170
|
+
end
|
171
|
+
body[value] = array
|
172
|
+
else
|
173
|
+
if v.respond_to?("to_body".to_sym)
|
174
|
+
body[value] = v.to_body
|
175
|
+
else
|
176
|
+
body[value] = v
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
body
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
@@ -0,0 +1,133 @@
|
|
1
|
+
# Copyright 2014-2015 Taxamo, Ltd.
|
2
|
+
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
|
6
|
+
#
|
7
|
+
# Unless required by applicable law or agreed to in writing, software
|
8
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
9
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
10
|
+
# See the License for the specific language governing permissions and
|
11
|
+
# limitations under the License.
|
12
|
+
|
13
|
+
class InputTransactionLine
|
14
|
+
attr_accessor :product_type, :supply_date, :unit_price, :unit_of_measure, :quantity, :custom_fields, :line_key, :tax_name, :product_code, :amount, :custom_id, :informative, :tax_rate, :total_amount, :description
|
15
|
+
|
16
|
+
# :internal => :external
|
17
|
+
def self.attribute_map
|
18
|
+
{
|
19
|
+
:product_type => :product_type,
|
20
|
+
:supply_date => :supply_date,
|
21
|
+
:unit_price => :unit_price,
|
22
|
+
:unit_of_measure => :unit_of_measure,
|
23
|
+
:quantity => :quantity,
|
24
|
+
:custom_fields => :custom_fields,
|
25
|
+
:line_key => :line_key,
|
26
|
+
:tax_name => :tax_name,
|
27
|
+
:product_code => :product_code,
|
28
|
+
:amount => :amount,
|
29
|
+
:custom_id => :custom_id,
|
30
|
+
:informative => :informative,
|
31
|
+
:tax_rate => :tax_rate,
|
32
|
+
:total_amount => :total_amount,
|
33
|
+
:description => :description
|
34
|
+
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
def initialize(attributes = {})
|
39
|
+
return if attributes.empty?
|
40
|
+
# Morph attribute keys into undescored rubyish style
|
41
|
+
if attributes["product_type"]
|
42
|
+
@product_type = attributes["product_type"]
|
43
|
+
|
44
|
+
end
|
45
|
+
if attributes["supply_date"]
|
46
|
+
@supply_date = attributes["supply_date"]
|
47
|
+
|
48
|
+
end
|
49
|
+
if attributes["unit_price"]
|
50
|
+
@unit_price = attributes["unit_price"]
|
51
|
+
|
52
|
+
end
|
53
|
+
if attributes["unit_of_measure"]
|
54
|
+
@unit_of_measure = attributes["unit_of_measure"]
|
55
|
+
|
56
|
+
end
|
57
|
+
if attributes["quantity"]
|
58
|
+
@quantity = attributes["quantity"]
|
59
|
+
|
60
|
+
end
|
61
|
+
if attributes["custom_fields"]
|
62
|
+
if (value = attributes["custom_fields"]).is_a?(Array)
|
63
|
+
@custom_fields = value.map{ |v| CustomFields.new(v) }
|
64
|
+
end
|
65
|
+
end
|
66
|
+
if attributes["line_key"]
|
67
|
+
@line_key = attributes["line_key"]
|
68
|
+
|
69
|
+
end
|
70
|
+
if attributes["tax_name"]
|
71
|
+
@tax_name = attributes["tax_name"]
|
72
|
+
|
73
|
+
end
|
74
|
+
if attributes["product_code"]
|
75
|
+
@product_code = attributes["product_code"]
|
76
|
+
|
77
|
+
end
|
78
|
+
if attributes["amount"]
|
79
|
+
@amount = attributes["amount"]
|
80
|
+
|
81
|
+
end
|
82
|
+
if attributes["custom_id"]
|
83
|
+
@custom_id = attributes["custom_id"]
|
84
|
+
|
85
|
+
end
|
86
|
+
if attributes["informative"]
|
87
|
+
@informative = attributes["informative"]
|
88
|
+
|
89
|
+
end
|
90
|
+
if attributes["tax_rate"]
|
91
|
+
@tax_rate = attributes["tax_rate"]
|
92
|
+
|
93
|
+
end
|
94
|
+
if attributes["total_amount"]
|
95
|
+
@total_amount = attributes["total_amount"]
|
96
|
+
|
97
|
+
end
|
98
|
+
if attributes["description"]
|
99
|
+
@description = attributes["description"]
|
100
|
+
|
101
|
+
end
|
102
|
+
|
103
|
+
|
104
|
+
end
|
105
|
+
|
106
|
+
def to_body
|
107
|
+
body = {}
|
108
|
+
self.class.attribute_map.each_pair do |key, value|
|
109
|
+
v = self.send(key)
|
110
|
+
unless v.nil?
|
111
|
+
if v.is_a?(Array)
|
112
|
+
array = Array.new
|
113
|
+
v.each do |item|
|
114
|
+
if item.respond_to?("to_body".to_sym)
|
115
|
+
array.push item.to_body
|
116
|
+
else
|
117
|
+
array.push item
|
118
|
+
end
|
119
|
+
end
|
120
|
+
body[value] = array
|
121
|
+
else
|
122
|
+
if v.respond_to?("to_body".to_sym)
|
123
|
+
body[value] = v.to_body
|
124
|
+
else
|
125
|
+
body[value] = v
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
body
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|