xero-ruby 3.0.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/xero-ruby.rb +3 -0
- data/lib/xero-ruby/api/accounting_api.rb +300 -147
- data/lib/xero-ruby/models/accounting/budget.rb +321 -0
- data/lib/xero-ruby/models/accounting/budget_lines.rb +265 -0
- data/lib/xero-ruby/models/accounting/budgets.rb +222 -0
- data/lib/xero-ruby/models/accounting/line_item.rb +11 -1
- data/lib/xero-ruby/models/accounting/report.rb +1 -11
- data/lib/xero-ruby/models/accounting/report_with_row.rb +1 -1
- data/lib/xero-ruby/version.rb +2 -2
- metadata +8 -5
@@ -0,0 +1,222 @@
|
|
1
|
+
=begin
|
2
|
+
#Xero Accounting API
|
3
|
+
|
4
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
|
+
|
6
|
+
Contact: api@xero.com
|
7
|
+
Generated by: https://openapi-generator.tech
|
8
|
+
OpenAPI Generator version: 4.3.1
|
9
|
+
|
10
|
+
=end
|
11
|
+
|
12
|
+
require 'time'
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module XeroRuby::Accounting
|
16
|
+
require 'bigdecimal'
|
17
|
+
|
18
|
+
class Budgets
|
19
|
+
|
20
|
+
attr_accessor :budgets
|
21
|
+
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
+
def self.attribute_map
|
24
|
+
{
|
25
|
+
:'budgets' => :'Budgets'
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
# Attribute type mapping.
|
30
|
+
def self.openapi_types
|
31
|
+
{
|
32
|
+
:'budgets' => :'Array<Budget>'
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
# Initializes the object
|
37
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
38
|
+
def initialize(attributes = {})
|
39
|
+
if (!attributes.is_a?(Hash))
|
40
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Accounting::Budgets` initialize method"
|
41
|
+
end
|
42
|
+
|
43
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
44
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
45
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
46
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Accounting::Budgets`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
47
|
+
end
|
48
|
+
h[k.to_sym] = v
|
49
|
+
}
|
50
|
+
|
51
|
+
if attributes.key?(:'budgets')
|
52
|
+
if (value = attributes[:'budgets']).is_a?(Array)
|
53
|
+
self.budgets = value
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
59
|
+
# @return Array for valid properties with the reasons
|
60
|
+
def list_invalid_properties
|
61
|
+
invalid_properties = Array.new
|
62
|
+
invalid_properties
|
63
|
+
end
|
64
|
+
|
65
|
+
# Check to see if the all the properties in the model are valid
|
66
|
+
# @return true if the model is valid
|
67
|
+
def valid?
|
68
|
+
true
|
69
|
+
end
|
70
|
+
|
71
|
+
# Checks equality by comparing each attribute.
|
72
|
+
# @param [Object] Object to be compared
|
73
|
+
def ==(o)
|
74
|
+
return true if self.equal?(o)
|
75
|
+
self.class == o.class &&
|
76
|
+
budgets == o.budgets
|
77
|
+
end
|
78
|
+
|
79
|
+
# @see the `==` method
|
80
|
+
# @param [Object] Object to be compared
|
81
|
+
def eql?(o)
|
82
|
+
self == o
|
83
|
+
end
|
84
|
+
|
85
|
+
# Calculates hash code according to all attributes.
|
86
|
+
# @return [Integer] Hash code
|
87
|
+
def hash
|
88
|
+
[budgets].hash
|
89
|
+
end
|
90
|
+
|
91
|
+
# Builds the object from hash
|
92
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
93
|
+
# @return [Object] Returns the model itself
|
94
|
+
def self.build_from_hash(attributes)
|
95
|
+
new.build_from_hash(attributes)
|
96
|
+
end
|
97
|
+
|
98
|
+
# Builds the object from hash
|
99
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
100
|
+
# @return [Object] Returns the model itself
|
101
|
+
def build_from_hash(attributes)
|
102
|
+
return nil unless attributes.is_a?(Hash)
|
103
|
+
self.class.openapi_types.each_pair do |key, type|
|
104
|
+
if type =~ /\AArray<(.*)>/i
|
105
|
+
# check to ensure the input is an array given that the attribute
|
106
|
+
# is documented as an array but the input is not
|
107
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
108
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
109
|
+
end
|
110
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
111
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
112
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
113
|
+
end
|
114
|
+
|
115
|
+
self
|
116
|
+
end
|
117
|
+
|
118
|
+
# Deserializes the data based on type
|
119
|
+
# @param string type Data type
|
120
|
+
# @param string value Value to be deserialized
|
121
|
+
# @return [Object] Deserialized data
|
122
|
+
def _deserialize(type, value)
|
123
|
+
case type.to_sym
|
124
|
+
when :DateTime
|
125
|
+
DateTime.parse(parse_date(value))
|
126
|
+
when :Date
|
127
|
+
Date.parse(parse_date(value))
|
128
|
+
when :String
|
129
|
+
value.to_s
|
130
|
+
when :Integer
|
131
|
+
value.to_i
|
132
|
+
when :Float
|
133
|
+
value.to_f
|
134
|
+
when :BigDecimal
|
135
|
+
BigDecimal(value.to_s)
|
136
|
+
when :Boolean
|
137
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
138
|
+
true
|
139
|
+
else
|
140
|
+
false
|
141
|
+
end
|
142
|
+
when :Object
|
143
|
+
# generic object (usually a Hash), return directly
|
144
|
+
value
|
145
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
146
|
+
inner_type = Regexp.last_match[:inner_type]
|
147
|
+
value.map { |v| _deserialize(inner_type, v) }
|
148
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
149
|
+
k_type = Regexp.last_match[:k_type]
|
150
|
+
v_type = Regexp.last_match[:v_type]
|
151
|
+
{}.tap do |hash|
|
152
|
+
value.each do |k, v|
|
153
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
else # model
|
157
|
+
XeroRuby::Accounting.const_get(type).build_from_hash(value)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
# Returns the string representation of the object
|
162
|
+
# @return [String] String presentation of the object
|
163
|
+
def to_s
|
164
|
+
to_hash.to_s
|
165
|
+
end
|
166
|
+
|
167
|
+
# to_body is an alias to to_hash (backward compatibility)
|
168
|
+
# @return [Hash] Returns the object in the form of hash
|
169
|
+
def to_body
|
170
|
+
to_hash
|
171
|
+
end
|
172
|
+
|
173
|
+
# Returns the object in the form of hash
|
174
|
+
# @return [Hash] Returns the object in the form of hash
|
175
|
+
def to_hash(downcase: false)
|
176
|
+
hash = {}
|
177
|
+
self.class.attribute_map.each_pair do |attr, param|
|
178
|
+
value = self.send(attr)
|
179
|
+
next if value.nil?
|
180
|
+
key = downcase ? attr : param
|
181
|
+
hash[key] = _to_hash(value, downcase: downcase)
|
182
|
+
end
|
183
|
+
hash
|
184
|
+
end
|
185
|
+
|
186
|
+
# Returns the object in the form of hash with snake_case
|
187
|
+
def to_attributes
|
188
|
+
to_hash(downcase: true)
|
189
|
+
end
|
190
|
+
|
191
|
+
# Outputs non-array value in the form of hash
|
192
|
+
# For object, use to_hash. Otherwise, just return the value
|
193
|
+
# @param [Object] value Any valid value
|
194
|
+
# @return [Hash] Returns the value in the form of hash
|
195
|
+
def _to_hash(value, downcase: false)
|
196
|
+
if value.is_a?(Array)
|
197
|
+
value.map do |v|
|
198
|
+
v.to_hash(downcase: downcase)
|
199
|
+
end
|
200
|
+
elsif value.is_a?(Hash)
|
201
|
+
{}.tap do |hash|
|
202
|
+
value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
|
203
|
+
end
|
204
|
+
elsif value.respond_to? :to_hash
|
205
|
+
value.to_hash(downcase: downcase)
|
206
|
+
else
|
207
|
+
value
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
def parse_date(datestring)
|
212
|
+
if datestring.include?('Date')
|
213
|
+
date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
|
214
|
+
original, date, timezone = *date_pattern.match(datestring)
|
215
|
+
date = (date.to_i / 1000)
|
216
|
+
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
217
|
+
else # handle date 'types' for small subset of payroll API's
|
218
|
+
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|
222
|
+
end
|
@@ -34,6 +34,9 @@ module XeroRuby::Accounting
|
|
34
34
|
# See Accounts
|
35
35
|
attr_accessor :account_code
|
36
36
|
|
37
|
+
# The associated account ID related to this line item
|
38
|
+
attr_accessor :account_id
|
39
|
+
|
37
40
|
# The tax type from TaxRates
|
38
41
|
attr_accessor :tax_type
|
39
42
|
|
@@ -64,6 +67,7 @@ module XeroRuby::Accounting
|
|
64
67
|
:'unit_amount' => :'UnitAmount',
|
65
68
|
:'item_code' => :'ItemCode',
|
66
69
|
:'account_code' => :'AccountCode',
|
70
|
+
:'account_id' => :'AccountID',
|
67
71
|
:'tax_type' => :'TaxType',
|
68
72
|
:'tax_amount' => :'TaxAmount',
|
69
73
|
:'line_amount' => :'LineAmount',
|
@@ -83,6 +87,7 @@ module XeroRuby::Accounting
|
|
83
87
|
:'unit_amount' => :'BigDecimal',
|
84
88
|
:'item_code' => :'String',
|
85
89
|
:'account_code' => :'String',
|
90
|
+
:'account_id' => :'String',
|
86
91
|
:'tax_type' => :'String',
|
87
92
|
:'tax_amount' => :'BigDecimal',
|
88
93
|
:'line_amount' => :'BigDecimal',
|
@@ -132,6 +137,10 @@ module XeroRuby::Accounting
|
|
132
137
|
self.account_code = attributes[:'account_code']
|
133
138
|
end
|
134
139
|
|
140
|
+
if attributes.key?(:'account_id')
|
141
|
+
self.account_id = attributes[:'account_id']
|
142
|
+
end
|
143
|
+
|
135
144
|
if attributes.key?(:'tax_type')
|
136
145
|
self.tax_type = attributes[:'tax_type']
|
137
146
|
end
|
@@ -187,6 +196,7 @@ module XeroRuby::Accounting
|
|
187
196
|
unit_amount == o.unit_amount &&
|
188
197
|
item_code == o.item_code &&
|
189
198
|
account_code == o.account_code &&
|
199
|
+
account_id == o.account_id &&
|
190
200
|
tax_type == o.tax_type &&
|
191
201
|
tax_amount == o.tax_amount &&
|
192
202
|
line_amount == o.line_amount &&
|
@@ -205,7 +215,7 @@ module XeroRuby::Accounting
|
|
205
215
|
# Calculates hash code according to all attributes.
|
206
216
|
# @return [Integer] Hash code
|
207
217
|
def hash
|
208
|
-
[line_item_id, description, quantity, unit_amount, item_code, account_code, tax_type, tax_amount, line_amount, tracking, discount_rate, discount_amount, repeating_invoice_id].hash
|
218
|
+
[line_item_id, description, quantity, unit_amount, item_code, account_code, account_id, tax_type, tax_amount, line_amount, tracking, discount_rate, discount_amount, repeating_invoice_id].hash
|
209
219
|
end
|
210
220
|
|
211
221
|
# Builds the object from hash
|
@@ -16,9 +16,6 @@ module XeroRuby::Accounting
|
|
16
16
|
require 'bigdecimal'
|
17
17
|
|
18
18
|
class Report
|
19
|
-
# See Prepayment Types
|
20
|
-
attr_accessor :report_id
|
21
|
-
|
22
19
|
# See Prepayment Types
|
23
20
|
attr_accessor :report_name
|
24
21
|
|
@@ -63,7 +60,6 @@ module XeroRuby::Accounting
|
|
63
60
|
# Attribute mapping from ruby-style variable name to JSON key.
|
64
61
|
def self.attribute_map
|
65
62
|
{
|
66
|
-
:'report_id' => :'ReportID',
|
67
63
|
:'report_name' => :'ReportName',
|
68
64
|
:'report_type' => :'ReportType',
|
69
65
|
:'report_title' => :'ReportTitle',
|
@@ -76,7 +72,6 @@ module XeroRuby::Accounting
|
|
76
72
|
# Attribute type mapping.
|
77
73
|
def self.openapi_types
|
78
74
|
{
|
79
|
-
:'report_id' => :'String',
|
80
75
|
:'report_name' => :'String',
|
81
76
|
:'report_type' => :'String',
|
82
77
|
:'report_title' => :'String',
|
@@ -101,10 +96,6 @@ module XeroRuby::Accounting
|
|
101
96
|
h[k.to_sym] = v
|
102
97
|
}
|
103
98
|
|
104
|
-
if attributes.key?(:'report_id')
|
105
|
-
self.report_id = attributes[:'report_id']
|
106
|
-
end
|
107
|
-
|
108
99
|
if attributes.key?(:'report_name')
|
109
100
|
self.report_name = attributes[:'report_name']
|
110
101
|
end
|
@@ -162,7 +153,6 @@ module XeroRuby::Accounting
|
|
162
153
|
def ==(o)
|
163
154
|
return true if self.equal?(o)
|
164
155
|
self.class == o.class &&
|
165
|
-
report_id == o.report_id &&
|
166
156
|
report_name == o.report_name &&
|
167
157
|
report_type == o.report_type &&
|
168
158
|
report_title == o.report_title &&
|
@@ -180,7 +170,7 @@ module XeroRuby::Accounting
|
|
180
170
|
# Calculates hash code according to all attributes.
|
181
171
|
# @return [Integer] Hash code
|
182
172
|
def hash
|
183
|
-
[
|
173
|
+
[report_name, report_type, report_title, report_date, updated_date_utc, contacts].hash
|
184
174
|
end
|
185
175
|
|
186
176
|
# Builds the object from hash
|
data/lib/xero-ruby/version.rb
CHANGED
@@ -7,9 +7,9 @@ Contact: api@xero.com
|
|
7
7
|
Generated by: https://openapi-generator.tech
|
8
8
|
OpenAPI Generator version: 4.3.1
|
9
9
|
|
10
|
-
The version of the XeroOpenAPI document: 2.
|
10
|
+
The version of the XeroOpenAPI document: 2.13.0
|
11
11
|
=end
|
12
12
|
|
13
13
|
module XeroRuby
|
14
|
-
VERSION = '3.
|
14
|
+
VERSION = '3.1.0'
|
15
15
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xero-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Xero API Team
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-05-
|
11
|
+
date: 2021-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -134,6 +134,9 @@ files:
|
|
134
134
|
- lib/xero-ruby/models/accounting/bill.rb
|
135
135
|
- lib/xero-ruby/models/accounting/branding_theme.rb
|
136
136
|
- lib/xero-ruby/models/accounting/branding_themes.rb
|
137
|
+
- lib/xero-ruby/models/accounting/budget.rb
|
138
|
+
- lib/xero-ruby/models/accounting/budget_lines.rb
|
139
|
+
- lib/xero-ruby/models/accounting/budgets.rb
|
137
140
|
- lib/xero-ruby/models/accounting/cis_org_setting.rb
|
138
141
|
- lib/xero-ruby/models/accounting/cis_org_settings.rb
|
139
142
|
- lib/xero-ruby/models/accounting/cis_setting.rb
|
@@ -980,7 +983,7 @@ homepage: https://developer.xero.com
|
|
980
983
|
licenses:
|
981
984
|
- Unlicense
|
982
985
|
metadata: {}
|
983
|
-
post_install_message:
|
986
|
+
post_install_message:
|
984
987
|
rdoc_options: []
|
985
988
|
require_paths:
|
986
989
|
- lib
|
@@ -996,7 +999,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
996
999
|
version: '0'
|
997
1000
|
requirements: []
|
998
1001
|
rubygems_version: 3.1.2
|
999
|
-
signing_key:
|
1002
|
+
signing_key:
|
1000
1003
|
specification_version: 4
|
1001
1004
|
summary: Xero Accounting API Ruby Gem
|
1002
1005
|
test_files:
|