xero-ruby 2.8.0 → 2.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -29
- data/lib/xero-ruby.rb +1 -1
- data/lib/xero-ruby/api/files_api.rb +126 -17
- data/lib/xero-ruby/api/payroll_uk_api.rb +6 -12
- data/lib/xero-ruby/models/accounting/batch_payment.rb +16 -4
- data/lib/xero-ruby/models/accounting/import_summary_accounts.rb +8 -8
- data/lib/xero-ruby/models/files/{inline_object.rb → upload_object.rb} +18 -3
- data/lib/xero-ruby/models/payroll_nz/salary_and_wage.rb +3 -2
- data/lib/xero-ruby/models/payroll_nz/timesheet.rb +3 -2
- data/lib/xero-ruby/version.rb +2 -2
- data/spec/files/models/inline_object_spec.rb +3 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eec58bb28471c43b81d1bed37d1201cab4f323a15c16eef399c36f3d17b83c2f
|
4
|
+
data.tar.gz: ca0c2bcacb4cf2bdff3b21dd8942ff3fef968ce9dfa1aba7055409dd5b06125e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d647375ed88c3154a5bdcb1156c5da25ef1dd47c1d2d1485bfa4dd5326264d2d6d2e6cbaf11c98c7bfdc05aeec5a0acd3409a9c655ae8c1a6ea460320aa7123
|
7
|
+
data.tar.gz: 5bcef855ca40c2175d801820a0ae17920382db45033a774959e05a080ede1ff4769ad129e8b5dcda0f3ae7c95fa03a9e86c09c2b6012bba1e0745002fe79f92f
|
data/README.md
CHANGED
@@ -7,22 +7,18 @@ Xero Ruby SDK for OAuth 2.0 generated from [Xero API OpenAPI Spec](https://githu
|
|
7
7
|
Xero Ruby SDK supports Xero's OAuth2.0 authentication and the following Xero API sets.
|
8
8
|
|
9
9
|
## API Client Docs
|
10
|
-
|
10
|
+
|
11
|
+
* Core [Accounting Api Docs](https://xeroapi.github.io/xero-ruby/accounting/index.html)
|
12
|
+
---
|
11
13
|
* [Asset Api Docs](/docs/assets/AssetApi.md)
|
12
14
|
* [Project Api Docs](docs/projects/ProjectApi.md)
|
13
|
-
* [
|
15
|
+
* [Files Api Docs](docs/files/FileApi.md)
|
14
16
|
* [Payroll Docs (AU)](docs/payroll_au/PayrollAuApi.md)
|
15
17
|
* [Payroll Docs (NZ)](docs/payroll_nz/PayrollNzApi.md)
|
16
18
|
* [Payroll Docs (UK)](docs/payroll_uk/PayrollUkApi.md)
|
17
19
|
|
18
20
|
## API Model Docs
|
19
|
-
* [
|
20
|
-
* [Asset Models Docs](/docs/assets/)
|
21
|
-
* [Project Models Docs](/docs/projects/)
|
22
|
-
* [File Models Docs](/docs/files/)
|
23
|
-
* [Payroll Models (AU)](docs/payroll_au/)
|
24
|
-
* [Payroll Models (NZ)](docs/payroll_nz/)
|
25
|
-
* [Payroll Models (UK)](docs/payroll_uk/)
|
21
|
+
* [XeroRuby Models Docs](/docs/)
|
26
22
|
|
27
23
|
## Sample Apps
|
28
24
|
We have two apps showing SDK usage.
|
@@ -31,9 +27,6 @@ We have two apps showing SDK usage.
|
|
31
27
|
|
32
28
|
![sample-app](https://i.imgur.com/OOEn55G.png)
|
33
29
|
|
34
|
-
## Looking for OAuth 1.0a support?
|
35
|
-
Check out the [Xeroizer](https://github.com/waynerobinson/xeroizer) gem (maintained by community).
|
36
|
-
|
37
30
|
---
|
38
31
|
## Installation
|
39
32
|
To install this gem to your current gemset.
|
@@ -49,7 +42,7 @@ gem 'xero-ruby'
|
|
49
42
|
* Create a [free Xero user account](https://www.xero.com/us/signup/api/)
|
50
43
|
* Login to your Xero developer [/myapps](https://developer.xero.com/myapps) dashboard & create an API application and note your API app's credentials.
|
51
44
|
|
52
|
-
### Creating a
|
45
|
+
### Creating a client
|
53
46
|
* Get the credential values from an API application at https://developer.xero.com/myapps/.
|
54
47
|
* Include [neccesary scopes](https://developer.xero.com/documentation/oauth2/scopes) as a space-seperated list
|
55
48
|
* example => "`openid profile email accounting.transactions accounting.settings`"
|
@@ -77,10 +70,11 @@ To generate a valid `token_set` send a user to the `authorization_url`:
|
|
77
70
|
redirect_to @authorization_url
|
78
71
|
```
|
79
72
|
|
80
|
-
Xero will then redirect back to the URI defined in your
|
73
|
+
Xero will then redirect back to the URI defined in your `redirect_uri` config.
|
74
|
+
|
81
75
|
*This must match **exactly** with the variable in your /myapps dashboard.*
|
82
76
|
|
83
|
-
In your callback
|
77
|
+
In your callback, calling `get_token_set_from_callback` will exchange the temporary code Xero return, with a valid `token_set` that you can use to make API calls.
|
84
78
|
```ruby
|
85
79
|
# => http://localhost:3000/oauth/callback
|
86
80
|
|
@@ -93,11 +87,12 @@ puts params['state']
|
|
93
87
|
```
|
94
88
|
|
95
89
|
## Making API calls once you have a token_set
|
96
|
-
|
90
|
+
Once you already have a token_set stored from this initual user interaction, you can setup a new client by passing the whole token_set to `refresh_token_set` or `set_token_set`.
|
97
91
|
```ruby
|
98
|
-
xero_client.refresh_token_set(user.token_set)
|
99
|
-
|
100
92
|
xero_client.set_token_set(user.token_set)
|
93
|
+
|
94
|
+
xero_client.refresh_token_set(user.token_set)
|
95
|
+
# this will set the access_token on the client, and return a refreshed `token_set` you need to save.
|
101
96
|
```
|
102
97
|
A `token_set` contains data about your API connection most importantly :
|
103
98
|
* `access_token`
|
@@ -171,6 +166,7 @@ end
|
|
171
166
|
## API Usage
|
172
167
|
|
173
168
|
### Accounting API
|
169
|
+
> https://xeroapi.github.io/xero-ruby/accounting/index.html
|
174
170
|
```ruby
|
175
171
|
require 'xero-ruby'
|
176
172
|
|
@@ -179,8 +175,6 @@ xero_client.refresh_token_set(user.token_set)
|
|
179
175
|
tenant_id = user.active_tenant_id
|
180
176
|
# example of how to store the `tenantId` of the specific tenant (aka organisation)
|
181
177
|
|
182
|
-
# https://github.com/XeroAPI/xero-ruby/blob/master/accounting/lib/xero-ruby/api/accounting_api.rb
|
183
|
-
|
184
178
|
# Get Accounts
|
185
179
|
accounts = xero_client.accounting_api.get_accounts(tenant_id).accounts
|
186
180
|
|
@@ -208,10 +202,8 @@ attachment = xero_client.accounting_api.create_account_attachment_by_file_name(t
|
|
208
202
|
```
|
209
203
|
|
210
204
|
### Assets API
|
205
|
+
> https://github.com/XeroAPI/xero-ruby/blob/master/accounting/lib/xero-ruby/api/asset_api.rb
|
211
206
|
```ruby
|
212
|
-
# https://github.com/XeroAPI/xero-ruby/blob/master/accounting/lib/xero-ruby/api/asset_api.rb
|
213
|
-
|
214
|
-
# Create Asset
|
215
207
|
asset = {
|
216
208
|
"assetName": "AssetName: #{rand(10000)}",
|
217
209
|
"assetNumber": "Asset: #{rand(10000)}",
|
@@ -221,18 +213,14 @@ asset = xero_client.asset_api.create_asset(tenant_id, asset)
|
|
221
213
|
```
|
222
214
|
|
223
215
|
### Project API
|
216
|
+
> https://github.com/XeroAPI/xero-ruby/blob/master/docs/projects/ProjectApi.md
|
224
217
|
```ruby
|
225
|
-
# https://github.com/XeroAPI/xero-ruby/blob/master/docs/projects/ProjectApi.md
|
226
|
-
|
227
|
-
# Get Projects
|
228
218
|
projects = xero_client.project_api.get_projects(tenant_id).items
|
229
219
|
```
|
230
220
|
|
231
221
|
### Files API
|
222
|
+
> https://github.com/XeroAPI/xero-ruby/blob/master/docs/files/FileApi.md
|
232
223
|
```ruby
|
233
|
-
# https://github.com/XeroAPI/xero-ruby/blob/master/docs/files/FileApi.md
|
234
|
-
|
235
|
-
# Get Files
|
236
224
|
opts = {
|
237
225
|
pagesize: 50, # Integer | pass an optional page size value
|
238
226
|
page: 2, # Integer | number of records to skip for pagination
|
data/lib/xero-ruby.rb
CHANGED
@@ -290,9 +290,9 @@ require 'xero-ruby/models/files/file_object'
|
|
290
290
|
require 'xero-ruby/models/files/files'
|
291
291
|
require 'xero-ruby/models/files/folder'
|
292
292
|
require 'xero-ruby/models/files/folders'
|
293
|
-
require 'xero-ruby/models/files/inline_object'
|
294
293
|
require 'xero-ruby/models/files/object_group'
|
295
294
|
require 'xero-ruby/models/files/object_type'
|
295
|
+
require 'xero-ruby/models/files/upload_object'
|
296
296
|
require 'xero-ruby/models/files/user'
|
297
297
|
require 'xero-ruby/models/projects/amount'
|
298
298
|
require 'xero-ruby/models/projects/charge_type'
|
@@ -1176,30 +1176,28 @@ module XeroRuby
|
|
1176
1176
|
return data, status_code, headers
|
1177
1177
|
end
|
1178
1178
|
|
1179
|
-
# Uploads a File
|
1179
|
+
# Uploads a File to the inbox
|
1180
1180
|
# @param xero_tenant_id [String] Xero identifier for Tenant
|
1181
|
+
# @param body [String]
|
1182
|
+
# @param name [String] exact name of the file you are uploading
|
1183
|
+
# @param filename [String]
|
1181
1184
|
# @param [Hash] opts the optional parameters
|
1182
|
-
# @option opts [String] :folder_id pass an optional folder id to save file to specific folder
|
1183
|
-
# @option opts [String] :body
|
1184
|
-
# @option opts [String] :name exact name of the file you are uploading
|
1185
|
-
# @option opts [String] :filename
|
1186
1185
|
# @option opts [String] :mime_type
|
1187
1186
|
# @return [FileObject]
|
1188
|
-
def upload_file(xero_tenant_id, opts = {})
|
1189
|
-
data, _status_code, _headers = upload_file_with_http_info(xero_tenant_id, opts)
|
1187
|
+
def upload_file(xero_tenant_id, body, name, filename, opts = {})
|
1188
|
+
data, _status_code, _headers = upload_file_with_http_info(xero_tenant_id, body, name, filename, opts)
|
1190
1189
|
data
|
1191
1190
|
end
|
1192
1191
|
|
1193
|
-
# Uploads a File
|
1192
|
+
# Uploads a File to the inbox
|
1194
1193
|
# @param xero_tenant_id [String] Xero identifier for Tenant
|
1194
|
+
# @param body [String]
|
1195
|
+
# @param name [String] exact name of the file you are uploading
|
1196
|
+
# @param filename [String]
|
1195
1197
|
# @param [Hash] opts the optional parameters
|
1196
|
-
# @option opts [String] :folder_id pass an optional folder id to save file to specific folder
|
1197
|
-
# @option opts [String] :body
|
1198
|
-
# @option opts [String] :name exact name of the file you are uploading
|
1199
|
-
# @option opts [String] :filename
|
1200
1198
|
# @option opts [String] :mime_type
|
1201
1199
|
# @return [Array<(FileObject, Integer, Hash)>] FileObject data, response status code and response headers
|
1202
|
-
def upload_file_with_http_info(xero_tenant_id, opts = {})
|
1200
|
+
def upload_file_with_http_info(xero_tenant_id, body, name, filename, opts = {})
|
1203
1201
|
if @api_client.config.debugging
|
1204
1202
|
@api_client.config.logger.debug 'Calling API: FilesApi.upload_file ...'
|
1205
1203
|
end
|
@@ -1207,6 +1205,18 @@ module XeroRuby
|
|
1207
1205
|
if @api_client.config.client_side_validation && xero_tenant_id.nil?
|
1208
1206
|
fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling FilesApi.upload_file"
|
1209
1207
|
end
|
1208
|
+
# verify the required parameter 'body' is set
|
1209
|
+
if @api_client.config.client_side_validation && body.nil?
|
1210
|
+
fail ArgumentError, "Missing the required parameter 'body' when calling FilesApi.upload_file"
|
1211
|
+
end
|
1212
|
+
# verify the required parameter 'name' is set
|
1213
|
+
if @api_client.config.client_side_validation && name.nil?
|
1214
|
+
fail ArgumentError, "Missing the required parameter 'name' when calling FilesApi.upload_file"
|
1215
|
+
end
|
1216
|
+
# verify the required parameter 'filename' is set
|
1217
|
+
if @api_client.config.client_side_validation && filename.nil?
|
1218
|
+
fail ArgumentError, "Missing the required parameter 'filename' when calling FilesApi.upload_file"
|
1219
|
+
end
|
1210
1220
|
# resource path
|
1211
1221
|
local_var_path = '/Files'
|
1212
1222
|
|
@@ -1215,7 +1225,6 @@ module XeroRuby
|
|
1215
1225
|
|
1216
1226
|
# query parameters
|
1217
1227
|
query_params = opts[:query_params] || {}
|
1218
|
-
query_params[:'FolderId'] = opts[:'folder_id'] if !opts[:'folder_id'].nil?
|
1219
1228
|
|
1220
1229
|
# XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
|
1221
1230
|
query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
|
@@ -1231,9 +1240,9 @@ module XeroRuby
|
|
1231
1240
|
|
1232
1241
|
# form parameters
|
1233
1242
|
form_params = opts[:form_params] || {}
|
1234
|
-
form_params['body'] =
|
1235
|
-
form_params['name'] =
|
1236
|
-
form_params['filename'] =
|
1243
|
+
form_params['body'] = body
|
1244
|
+
form_params['name'] = name
|
1245
|
+
form_params['filename'] = filename
|
1237
1246
|
form_params['mimeType'] = opts[:'mime_type'] if !opts[:'mime_type'].nil?
|
1238
1247
|
|
1239
1248
|
# http body (model)
|
@@ -1260,5 +1269,105 @@ module XeroRuby
|
|
1260
1269
|
end
|
1261
1270
|
return data, status_code, headers
|
1262
1271
|
end
|
1272
|
+
|
1273
|
+
# Uploads a File to a specific folder
|
1274
|
+
# @param xero_tenant_id [String] Xero identifier for Tenant
|
1275
|
+
# @param folder_id [String] pass required folder id to save file to specific folder
|
1276
|
+
# @param body [String]
|
1277
|
+
# @param name [String] exact name of the file you are uploading
|
1278
|
+
# @param filename [String]
|
1279
|
+
# @param [Hash] opts the optional parameters
|
1280
|
+
# @option opts [String] :mime_type
|
1281
|
+
# @return [FileObject]
|
1282
|
+
def upload_file_to_folder(xero_tenant_id, folder_id, body, name, filename, opts = {})
|
1283
|
+
data, _status_code, _headers = upload_file_to_folder_with_http_info(xero_tenant_id, folder_id, body, name, filename, opts)
|
1284
|
+
data
|
1285
|
+
end
|
1286
|
+
|
1287
|
+
# Uploads a File to a specific folder
|
1288
|
+
# @param xero_tenant_id [String] Xero identifier for Tenant
|
1289
|
+
# @param folder_id [String] pass required folder id to save file to specific folder
|
1290
|
+
# @param body [String]
|
1291
|
+
# @param name [String] exact name of the file you are uploading
|
1292
|
+
# @param filename [String]
|
1293
|
+
# @param [Hash] opts the optional parameters
|
1294
|
+
# @option opts [String] :mime_type
|
1295
|
+
# @return [Array<(FileObject, Integer, Hash)>] FileObject data, response status code and response headers
|
1296
|
+
def upload_file_to_folder_with_http_info(xero_tenant_id, folder_id, body, name, filename, opts = {})
|
1297
|
+
if @api_client.config.debugging
|
1298
|
+
@api_client.config.logger.debug 'Calling API: FilesApi.upload_file_to_folder ...'
|
1299
|
+
end
|
1300
|
+
# verify the required parameter 'xero_tenant_id' is set
|
1301
|
+
if @api_client.config.client_side_validation && xero_tenant_id.nil?
|
1302
|
+
fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling FilesApi.upload_file_to_folder"
|
1303
|
+
end
|
1304
|
+
# verify the required parameter 'folder_id' is set
|
1305
|
+
if @api_client.config.client_side_validation && folder_id.nil?
|
1306
|
+
fail ArgumentError, "Missing the required parameter 'folder_id' when calling FilesApi.upload_file_to_folder"
|
1307
|
+
end
|
1308
|
+
# verify the required parameter 'body' is set
|
1309
|
+
if @api_client.config.client_side_validation && body.nil?
|
1310
|
+
fail ArgumentError, "Missing the required parameter 'body' when calling FilesApi.upload_file_to_folder"
|
1311
|
+
end
|
1312
|
+
# verify the required parameter 'name' is set
|
1313
|
+
if @api_client.config.client_side_validation && name.nil?
|
1314
|
+
fail ArgumentError, "Missing the required parameter 'name' when calling FilesApi.upload_file_to_folder"
|
1315
|
+
end
|
1316
|
+
# verify the required parameter 'filename' is set
|
1317
|
+
if @api_client.config.client_side_validation && filename.nil?
|
1318
|
+
fail ArgumentError, "Missing the required parameter 'filename' when calling FilesApi.upload_file_to_folder"
|
1319
|
+
end
|
1320
|
+
# resource path
|
1321
|
+
local_var_path = '/Files/{FolderId}'.sub('{' + 'FolderId' + '}', folder_id.to_s)
|
1322
|
+
|
1323
|
+
# camelize keys of incoming `where` opts
|
1324
|
+
opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
|
1325
|
+
|
1326
|
+
# query parameters
|
1327
|
+
query_params = opts[:query_params] || {}
|
1328
|
+
|
1329
|
+
# XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
|
1330
|
+
query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
|
1331
|
+
query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
|
1332
|
+
|
1333
|
+
# header parameters
|
1334
|
+
header_params = opts[:header_params] || {}
|
1335
|
+
# HTTP header 'Accept' (if needed)
|
1336
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
1337
|
+
# HTTP header 'Content-Type'
|
1338
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
1339
|
+
header_params[:'xero-tenant-id'] = xero_tenant_id
|
1340
|
+
|
1341
|
+
# form parameters
|
1342
|
+
form_params = opts[:form_params] || {}
|
1343
|
+
form_params['body'] = body
|
1344
|
+
form_params['name'] = name
|
1345
|
+
form_params['filename'] = filename
|
1346
|
+
form_params['mimeType'] = opts[:'mime_type'] if !opts[:'mime_type'].nil?
|
1347
|
+
|
1348
|
+
# http body (model)
|
1349
|
+
post_body = opts[:body]
|
1350
|
+
|
1351
|
+
# return_type
|
1352
|
+
return_type = opts[:return_type] || 'FileObject'
|
1353
|
+
|
1354
|
+
# auth_names
|
1355
|
+
auth_names = opts[:auth_names] || ['OAuth2']
|
1356
|
+
|
1357
|
+
new_options = opts.merge(
|
1358
|
+
:header_params => header_params,
|
1359
|
+
:query_params => query_params,
|
1360
|
+
:form_params => form_params,
|
1361
|
+
:body => post_body,
|
1362
|
+
:auth_names => auth_names,
|
1363
|
+
:return_type => return_type
|
1364
|
+
)
|
1365
|
+
|
1366
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, "FilesApi", new_options)
|
1367
|
+
if @api_client.config.debugging
|
1368
|
+
@api_client.config.logger.debug "API called: FilesApi#upload_file_to_folder\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
1369
|
+
end
|
1370
|
+
return data, status_code, headers
|
1371
|
+
end
|
1263
1372
|
end
|
1264
1373
|
end
|
@@ -3548,8 +3548,7 @@ module XeroRuby
|
|
3548
3548
|
# Retrieves employees
|
3549
3549
|
# @param xero_tenant_id [String] Xero identifier for Tenant
|
3550
3550
|
# @param [Hash] opts the optional parameters
|
3551
|
-
# @option opts [String] :
|
3552
|
-
# @option opts [String] :last_name Filter by last name
|
3551
|
+
# @option opts [String] :filter Filter by first name and/or lastname
|
3553
3552
|
# @option opts [Integer] :page Page number which specifies the set of records to retrieve. By default the number of the records per set is 100.
|
3554
3553
|
# @return [Employees]
|
3555
3554
|
def get_employees(xero_tenant_id, opts = {})
|
@@ -3560,8 +3559,7 @@ module XeroRuby
|
|
3560
3559
|
# Retrieves employees
|
3561
3560
|
# @param xero_tenant_id [String] Xero identifier for Tenant
|
3562
3561
|
# @param [Hash] opts the optional parameters
|
3563
|
-
# @option opts [String] :
|
3564
|
-
# @option opts [String] :last_name Filter by last name
|
3562
|
+
# @option opts [String] :filter Filter by first name and/or lastname
|
3565
3563
|
# @option opts [Integer] :page Page number which specifies the set of records to retrieve. By default the number of the records per set is 100.
|
3566
3564
|
# @return [Array<(Employees, Integer, Hash)>] Employees data, response status code and response headers
|
3567
3565
|
def get_employees_with_http_info(xero_tenant_id, opts = {})
|
@@ -3580,8 +3578,7 @@ module XeroRuby
|
|
3580
3578
|
|
3581
3579
|
# query parameters
|
3582
3580
|
query_params = opts[:query_params] || {}
|
3583
|
-
query_params[:'
|
3584
|
-
query_params[:'lastName'] = opts[:'last_name'] if !opts[:'last_name'].nil?
|
3581
|
+
query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
|
3585
3582
|
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
3586
3583
|
|
3587
3584
|
# XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
|
@@ -4587,8 +4584,7 @@ module XeroRuby
|
|
4587
4584
|
# @param xero_tenant_id [String] Xero identifier for Tenant
|
4588
4585
|
# @param [Hash] opts the optional parameters
|
4589
4586
|
# @option opts [Integer] :page Page number which specifies the set of records to retrieve. By default the number of the records per set is 100.
|
4590
|
-
# @option opts [String] :
|
4591
|
-
# @option opts [String] :payroll_calendar_id By default get Timesheets will return all the timesheets for an organization. You can add GET https://…/timesheets?filter=payrollCalendarId=={PayrollCalendarID} to filter the timesheets by payroll calendar id
|
4587
|
+
# @option opts [String] :filter Filter by first name and/or lastname
|
4592
4588
|
# @return [Timesheets]
|
4593
4589
|
def get_timesheets(xero_tenant_id, opts = {})
|
4594
4590
|
data, _status_code, _headers = get_timesheets_with_http_info(xero_tenant_id, opts)
|
@@ -4599,8 +4595,7 @@ module XeroRuby
|
|
4599
4595
|
# @param xero_tenant_id [String] Xero identifier for Tenant
|
4600
4596
|
# @param [Hash] opts the optional parameters
|
4601
4597
|
# @option opts [Integer] :page Page number which specifies the set of records to retrieve. By default the number of the records per set is 100.
|
4602
|
-
# @option opts [String] :
|
4603
|
-
# @option opts [String] :payroll_calendar_id By default get Timesheets will return all the timesheets for an organization. You can add GET https://…/timesheets?filter=payrollCalendarId=={PayrollCalendarID} to filter the timesheets by payroll calendar id
|
4598
|
+
# @option opts [String] :filter Filter by first name and/or lastname
|
4604
4599
|
# @return [Array<(Timesheets, Integer, Hash)>] Timesheets data, response status code and response headers
|
4605
4600
|
def get_timesheets_with_http_info(xero_tenant_id, opts = {})
|
4606
4601
|
if @api_client.config.debugging
|
@@ -4619,8 +4614,7 @@ module XeroRuby
|
|
4619
4614
|
# query parameters
|
4620
4615
|
query_params = opts[:query_params] || {}
|
4621
4616
|
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
4622
|
-
query_params[:'
|
4623
|
-
query_params[:'payrollCalendarId'] = opts[:'payroll_calendar_id'] if !opts[:'payroll_calendar_id'].nil?
|
4617
|
+
query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
|
4624
4618
|
|
4625
4619
|
# XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
|
4626
4620
|
query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
|
@@ -68,6 +68,9 @@ module XeroRuby::Accounting
|
|
68
68
|
# Booelan that tells you if the batch payment has been reconciled (read-only)
|
69
69
|
attr_accessor :is_reconciled
|
70
70
|
|
71
|
+
# Displays array of validation error messages from the API
|
72
|
+
attr_accessor :validation_errors
|
73
|
+
|
71
74
|
class EnumAttributeValidator
|
72
75
|
attr_reader :datatype
|
73
76
|
attr_reader :allowable_values
|
@@ -108,7 +111,8 @@ module XeroRuby::Accounting
|
|
108
111
|
:'status' => :'Status',
|
109
112
|
:'total_amount' => :'TotalAmount',
|
110
113
|
:'updated_date_utc' => :'UpdatedDateUTC',
|
111
|
-
:'is_reconciled' => :'IsReconciled'
|
114
|
+
:'is_reconciled' => :'IsReconciled',
|
115
|
+
:'validation_errors' => :'ValidationErrors'
|
112
116
|
}
|
113
117
|
end
|
114
118
|
|
@@ -130,7 +134,8 @@ module XeroRuby::Accounting
|
|
130
134
|
:'status' => :'String',
|
131
135
|
:'total_amount' => :'String',
|
132
136
|
:'updated_date_utc' => :'DateTime',
|
133
|
-
:'is_reconciled' => :'String'
|
137
|
+
:'is_reconciled' => :'String',
|
138
|
+
:'validation_errors' => :'Array<ValidationError>'
|
134
139
|
}
|
135
140
|
end
|
136
141
|
|
@@ -214,6 +219,12 @@ module XeroRuby::Accounting
|
|
214
219
|
if attributes.key?(:'is_reconciled')
|
215
220
|
self.is_reconciled = attributes[:'is_reconciled']
|
216
221
|
end
|
222
|
+
|
223
|
+
if attributes.key?(:'validation_errors')
|
224
|
+
if (value = attributes[:'validation_errors']).is_a?(Array)
|
225
|
+
self.validation_errors = value
|
226
|
+
end
|
227
|
+
end
|
217
228
|
end
|
218
229
|
|
219
230
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -333,7 +344,8 @@ module XeroRuby::Accounting
|
|
333
344
|
status == o.status &&
|
334
345
|
total_amount == o.total_amount &&
|
335
346
|
updated_date_utc == o.updated_date_utc &&
|
336
|
-
is_reconciled == o.is_reconciled
|
347
|
+
is_reconciled == o.is_reconciled &&
|
348
|
+
validation_errors == o.validation_errors
|
337
349
|
end
|
338
350
|
|
339
351
|
# @see the `==` method
|
@@ -345,7 +357,7 @@ module XeroRuby::Accounting
|
|
345
357
|
# Calculates hash code according to all attributes.
|
346
358
|
# @return [Integer] Hash code
|
347
359
|
def hash
|
348
|
-
[account, reference, particulars, code, details, narrative, batch_payment_id, date_string, date, amount, payments, type, status, total_amount, updated_date_utc, is_reconciled].hash
|
360
|
+
[account, reference, particulars, code, details, narrative, batch_payment_id, date_string, date, amount, payments, type, status, total_amount, updated_date_utc, is_reconciled, validation_errors].hash
|
349
361
|
end
|
350
362
|
|
351
363
|
# Builds the object from hash
|
@@ -62,15 +62,15 @@ module XeroRuby::Accounting
|
|
62
62
|
# Attribute type mapping.
|
63
63
|
def self.openapi_types
|
64
64
|
{
|
65
|
-
:'total' => :'
|
66
|
-
:'new' => :'
|
67
|
-
:'updated' => :'
|
68
|
-
:'deleted' => :'
|
69
|
-
:'locked' => :'
|
70
|
-
:'system' => :'
|
71
|
-
:'errored' => :'
|
65
|
+
:'total' => :'Integer',
|
66
|
+
:'new' => :'Integer',
|
67
|
+
:'updated' => :'Integer',
|
68
|
+
:'deleted' => :'Integer',
|
69
|
+
:'locked' => :'Integer',
|
70
|
+
:'system' => :'Integer',
|
71
|
+
:'errored' => :'Integer',
|
72
72
|
:'present' => :'Boolean',
|
73
|
-
:'new_or_updated' => :'
|
73
|
+
:'new_or_updated' => :'Integer'
|
74
74
|
}
|
75
75
|
end
|
76
76
|
|
@@ -15,7 +15,7 @@ require 'date'
|
|
15
15
|
module XeroRuby::Files
|
16
16
|
require 'bigdecimal'
|
17
17
|
|
18
|
-
class
|
18
|
+
class UploadObject
|
19
19
|
|
20
20
|
attr_accessor :body
|
21
21
|
|
@@ -52,13 +52,13 @@ module XeroRuby::Files
|
|
52
52
|
# @param [Hash] attributes Model attributes in the form of hash
|
53
53
|
def initialize(attributes = {})
|
54
54
|
if (!attributes.is_a?(Hash))
|
55
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Files::
|
55
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Files::UploadObject` initialize method"
|
56
56
|
end
|
57
57
|
|
58
58
|
# check to see if the attribute exists and convert string to symbol for hash key
|
59
59
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
60
60
|
if (!self.class.attribute_map.key?(k.to_sym))
|
61
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Files::
|
61
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Files::UploadObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
62
62
|
end
|
63
63
|
h[k.to_sym] = v
|
64
64
|
}
|
@@ -84,12 +84,27 @@ module XeroRuby::Files
|
|
84
84
|
# @return Array for valid properties with the reasons
|
85
85
|
def list_invalid_properties
|
86
86
|
invalid_properties = Array.new
|
87
|
+
if @body.nil?
|
88
|
+
invalid_properties.push('invalid value for "body", body cannot be nil.')
|
89
|
+
end
|
90
|
+
|
91
|
+
if @name.nil?
|
92
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
93
|
+
end
|
94
|
+
|
95
|
+
if @filename.nil?
|
96
|
+
invalid_properties.push('invalid value for "filename", filename cannot be nil.')
|
97
|
+
end
|
98
|
+
|
87
99
|
invalid_properties
|
88
100
|
end
|
89
101
|
|
90
102
|
# Check to see if the all the properties in the model are valid
|
91
103
|
# @return true if the model is valid
|
92
104
|
def valid?
|
105
|
+
return false if @body.nil?
|
106
|
+
return false if @name.nil?
|
107
|
+
return false if @filename.nil?
|
93
108
|
true
|
94
109
|
end
|
95
110
|
|
@@ -44,6 +44,7 @@ module XeroRuby::PayrollNz
|
|
44
44
|
attr_accessor :status
|
45
45
|
ACTIVE = "Active".freeze
|
46
46
|
PENDING = "Pending".freeze
|
47
|
+
HISTORY = "History".freeze
|
47
48
|
|
48
49
|
# The type of the payment of the corresponding salary and wages
|
49
50
|
attr_accessor :payment_type
|
@@ -204,7 +205,7 @@ module XeroRuby::PayrollNz
|
|
204
205
|
return false if @effective_from.nil?
|
205
206
|
return false if @annual_salary.nil?
|
206
207
|
return false if @status.nil?
|
207
|
-
status_validator = EnumAttributeValidator.new('String', ["Active", "Pending"])
|
208
|
+
status_validator = EnumAttributeValidator.new('String', ["Active", "Pending", "History"])
|
208
209
|
return false unless status_validator.valid?(@status)
|
209
210
|
return false if @payment_type.nil?
|
210
211
|
payment_type_validator = EnumAttributeValidator.new('String', ["Salary", "Hourly"])
|
@@ -215,7 +216,7 @@ module XeroRuby::PayrollNz
|
|
215
216
|
# Custom attribute writer method checking allowed values (enum).
|
216
217
|
# @param [Object] status Object to be assigned
|
217
218
|
def status=(status)
|
218
|
-
validator = EnumAttributeValidator.new('String', ["Active", "Pending"])
|
219
|
+
validator = EnumAttributeValidator.new('String', ["Active", "Pending", "History"])
|
219
220
|
unless validator.valid?(status)
|
220
221
|
fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
|
221
222
|
end
|
@@ -36,6 +36,7 @@ module XeroRuby::PayrollNz
|
|
36
36
|
DRAFT = "Draft".freeze
|
37
37
|
APPROVED = "Approved".freeze
|
38
38
|
COMPLETED = "Completed".freeze
|
39
|
+
REQUESTED = "Requested".freeze
|
39
40
|
|
40
41
|
# The Total Hours of the Timesheet
|
41
42
|
attr_accessor :total_hours
|
@@ -182,7 +183,7 @@ module XeroRuby::PayrollNz
|
|
182
183
|
return false if @employee_id.nil?
|
183
184
|
return false if @start_date.nil?
|
184
185
|
return false if @end_date.nil?
|
185
|
-
status_validator = EnumAttributeValidator.new('String', ["Draft", "Approved", "Completed"])
|
186
|
+
status_validator = EnumAttributeValidator.new('String', ["Draft", "Approved", "Completed", "Requested"])
|
186
187
|
return false unless status_validator.valid?(@status)
|
187
188
|
true
|
188
189
|
end
|
@@ -190,7 +191,7 @@ module XeroRuby::PayrollNz
|
|
190
191
|
# Custom attribute writer method checking allowed values (enum).
|
191
192
|
# @param [Object] status Object to be assigned
|
192
193
|
def status=(status)
|
193
|
-
validator = EnumAttributeValidator.new('String', ["Draft", "Approved", "Completed"])
|
194
|
+
validator = EnumAttributeValidator.new('String', ["Draft", "Approved", "Completed", "Requested"])
|
194
195
|
unless validator.valid?(status)
|
195
196
|
fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
|
196
197
|
end
|
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.10.3
|
11
11
|
=end
|
12
12
|
|
13
13
|
module XeroRuby
|
14
|
-
VERSION = '2.8.
|
14
|
+
VERSION = '2.8.1'
|
15
15
|
end
|
@@ -14,13 +14,13 @@ require 'spec_helper'
|
|
14
14
|
require 'json'
|
15
15
|
require 'date'
|
16
16
|
|
17
|
-
# Unit tests for XeroRuby::Files::
|
17
|
+
# Unit tests for XeroRuby::Files::FileObject
|
18
18
|
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
19
19
|
# Please update as you see appropriate
|
20
20
|
describe 'InlineObject' do
|
21
21
|
before do
|
22
22
|
# run before each test
|
23
|
-
@instance = XeroRuby::Files::
|
23
|
+
@instance = XeroRuby::Files::FileObject.new
|
24
24
|
end
|
25
25
|
|
26
26
|
after do
|
@@ -29,7 +29,7 @@ describe 'InlineObject' do
|
|
29
29
|
|
30
30
|
describe 'test an instance of InlineObject' do
|
31
31
|
it 'should create an instance of InlineObject' do
|
32
|
-
expect(@instance).to be_instance_of(XeroRuby::Files::
|
32
|
+
expect(@instance).to be_instance_of(XeroRuby::Files::FileObject)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
describe 'test attribute "body"' do
|
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: 2.8.
|
4
|
+
version: 2.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Xero API Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -232,9 +232,9 @@ files:
|
|
232
232
|
- lib/xero-ruby/models/files/files.rb
|
233
233
|
- lib/xero-ruby/models/files/folder.rb
|
234
234
|
- lib/xero-ruby/models/files/folders.rb
|
235
|
-
- lib/xero-ruby/models/files/inline_object.rb
|
236
235
|
- lib/xero-ruby/models/files/object_group.rb
|
237
236
|
- lib/xero-ruby/models/files/object_type.rb
|
237
|
+
- lib/xero-ruby/models/files/upload_object.rb
|
238
238
|
- lib/xero-ruby/models/files/user.rb
|
239
239
|
- lib/xero-ruby/models/payroll_au/account.rb
|
240
240
|
- lib/xero-ruby/models/payroll_au/account_type.rb
|