wheniwork-ruby 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +19 -0
- data/Gemfile.lock +106 -0
- data/LICENSE +201 -0
- data/README.md +111 -0
- data/docs/DefaultApi.md +240 -0
- data/docs/InlineResponse200.md +8 -0
- data/docs/InlineResponse2001.md +10 -0
- data/docs/InlineResponse2002.md +8 -0
- data/docs/InlineResponse2003.md +8 -0
- data/docs/Position.md +11 -0
- data/docs/Shift.md +20 -0
- data/docs/User.md +17 -0
- data/git_push.sh +67 -0
- data/lib/wheniwork-ruby.rb +56 -0
- data/lib/wheniwork-ruby/api/api.rb +279 -0
- data/lib/wheniwork-ruby/api_client.rb +371 -0
- data/lib/wheniwork-ruby/api_error.rb +45 -0
- data/lib/wheniwork-ruby/configuration.rb +191 -0
- data/lib/wheniwork-ruby/models/inline_response_200.rb +195 -0
- data/lib/wheniwork-ruby/models/inline_response_200_1.rb +215 -0
- data/lib/wheniwork-ruby/models/inline_response_200_2.rb +195 -0
- data/lib/wheniwork-ruby/models/inline_response_200_3.rb +195 -0
- data/lib/wheniwork-ruby/models/position.rb +222 -0
- data/lib/wheniwork-ruby/models/shift.rb +303 -0
- data/lib/wheniwork-ruby/models/user.rb +280 -0
- data/lib/wheniwork-ruby/version.rb +24 -0
- data/spec/api/api_spec.rb +99 -0
- data/spec/api_client_spec.rb +260 -0
- data/spec/configuration_spec.rb +46 -0
- data/spec/models/inline_response_200_1_spec.rb +63 -0
- data/spec/models/inline_response_200_2_spec.rb +51 -0
- data/spec/models/inline_response_200_3_spec.rb +51 -0
- data/spec/models/inline_response_200_spec.rb +51 -0
- data/spec/models/position_spec.rb +69 -0
- data/spec/models/shift_spec.rb +123 -0
- data/spec/models/user_spec.rb +105 -0
- data/spec/spec_helper.rb +120 -0
- data/wheniwork-ruby.gemspec +53 -0
- metadata +273 -0
data/docs/DefaultApi.md
ADDED
@@ -0,0 +1,240 @@
|
|
1
|
+
# WhenIWork::Api
|
2
|
+
|
3
|
+
All URIs are relative to *https://api.wheniwork.com/2*
|
4
|
+
|
5
|
+
Method | HTTP request | Description
|
6
|
+
------------- | ------------- | -------------
|
7
|
+
[**get_positions**](Api.md#get_positions) | **GET** /positions |
|
8
|
+
[**get_shift**](Api.md#get_shift) | **GET** /shifts/{shift-id} |
|
9
|
+
[**get_shifts**](Api.md#get_shifts) | **GET** /shifts |
|
10
|
+
[**get_user**](Api.md#get_user) | **GET** /users/{user-id} |
|
11
|
+
|
12
|
+
|
13
|
+
# **get_positions**
|
14
|
+
> InlineResponse200 get_positions(opts)
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
This method allows you to get a list of all positions in your account.
|
19
|
+
|
20
|
+
### Example
|
21
|
+
```ruby
|
22
|
+
# load the gem
|
23
|
+
require 'wheniwork-ruby'
|
24
|
+
# setup authorization
|
25
|
+
WhenIWork.configure do |config|
|
26
|
+
# Configure API key authorization: apiKey
|
27
|
+
config.api_key['W-Token'] = 'YOUR API KEY'
|
28
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
29
|
+
#config.api_key_prefix['W-Token'] = 'Bearer'
|
30
|
+
end
|
31
|
+
|
32
|
+
api_instance = WhenIWork::Api.new
|
33
|
+
|
34
|
+
opts = {
|
35
|
+
show_deleted: true # BOOLEAN | Whether to show positions that have been deleted.
|
36
|
+
}
|
37
|
+
|
38
|
+
begin
|
39
|
+
result = api_instance.get_positions(opts)
|
40
|
+
p result
|
41
|
+
rescue WhenIWork::ApiError => e
|
42
|
+
puts "Exception when calling Api->get_positions: #{e}"
|
43
|
+
end
|
44
|
+
```
|
45
|
+
|
46
|
+
### Parameters
|
47
|
+
|
48
|
+
Name | Type | Description | Notes
|
49
|
+
------------- | ------------- | ------------- | -------------
|
50
|
+
**show_deleted** | **BOOLEAN**| Whether to show positions that have been deleted. | [optional]
|
51
|
+
|
52
|
+
### Return type
|
53
|
+
|
54
|
+
[**InlineResponse200**](InlineResponse200.md)
|
55
|
+
|
56
|
+
### Authorization
|
57
|
+
|
58
|
+
[apiKey](../README.md#apiKey)
|
59
|
+
|
60
|
+
### HTTP request headers
|
61
|
+
|
62
|
+
- **Content-Type**: application/json
|
63
|
+
- **Accept**: application/json
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
# **get_shift**
|
68
|
+
> InlineResponse2002 get_shift(shift_id)
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
Gets the details of an existing shift.
|
73
|
+
|
74
|
+
### Example
|
75
|
+
```ruby
|
76
|
+
# load the gem
|
77
|
+
require 'wheniwork-ruby'
|
78
|
+
# setup authorization
|
79
|
+
WhenIWork.configure do |config|
|
80
|
+
# Configure API key authorization: apiKey
|
81
|
+
config.api_key['W-Token'] = 'YOUR API KEY'
|
82
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
83
|
+
#config.api_key_prefix['W-Token'] = 'Bearer'
|
84
|
+
end
|
85
|
+
|
86
|
+
api_instance = WhenIWork::Api.new
|
87
|
+
|
88
|
+
shift_id = 56 # Integer | max records to return
|
89
|
+
|
90
|
+
|
91
|
+
begin
|
92
|
+
result = api_instance.get_shift(shift_id)
|
93
|
+
p result
|
94
|
+
rescue WhenIWork::ApiError => e
|
95
|
+
puts "Exception when calling Api->get_shift: #{e}"
|
96
|
+
end
|
97
|
+
```
|
98
|
+
|
99
|
+
### Parameters
|
100
|
+
|
101
|
+
Name | Type | Description | Notes
|
102
|
+
------------- | ------------- | ------------- | -------------
|
103
|
+
**shift_id** | **Integer**| max records to return |
|
104
|
+
|
105
|
+
### Return type
|
106
|
+
|
107
|
+
[**InlineResponse2002**](InlineResponse2002.md)
|
108
|
+
|
109
|
+
### Authorization
|
110
|
+
|
111
|
+
[apiKey](../README.md#apiKey)
|
112
|
+
|
113
|
+
### HTTP request headers
|
114
|
+
|
115
|
+
- **Content-Type**: application/json
|
116
|
+
- **Accept**: application/json
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
# **get_shifts**
|
121
|
+
> InlineResponse2001 get_shifts(opts)
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
Get a list of shifts.
|
126
|
+
|
127
|
+
### Example
|
128
|
+
```ruby
|
129
|
+
# load the gem
|
130
|
+
require 'wheniwork-ruby'
|
131
|
+
# setup authorization
|
132
|
+
WhenIWork.configure do |config|
|
133
|
+
# Configure API key authorization: apiKey
|
134
|
+
config.api_key['W-Token'] = 'YOUR API KEY'
|
135
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
136
|
+
#config.api_key_prefix['W-Token'] = 'Bearer'
|
137
|
+
end
|
138
|
+
|
139
|
+
api_instance = WhenIWork::Api.new
|
140
|
+
|
141
|
+
opts = {
|
142
|
+
user_id: "user_id_example", # String | The ID of the user to get shifts for. For multiple users, enter a list of user IDs separated by commas (e.g. 1,5,3).
|
143
|
+
start: DateTime.parse("2013-10-20T19:20:30+01:00"), # DateTime | Start time for the search window. The default is the current date and time
|
144
|
+
_end: DateTime.parse("2013-10-20T19:20:30+01:00"), # DateTime | End time for the search window. The default is exactly three days from the start time.
|
145
|
+
location_id: "location_id_example", # String | The ID of the location to get shifts for. For multiple locations, enter a list of location IDs separated by commas.
|
146
|
+
position_id: "position_id_example", # String | The ID of the position to get shifts for. For multiple position, enter a list of position IDs separated by commas.
|
147
|
+
include_open: true, # BOOLEAN | Whether to include OpenShifts in the results.
|
148
|
+
include_onlyopen: true, # BOOLEAN | Whether to include OpenShifts in the results.
|
149
|
+
unpublished: true # BOOLEAN | Whether unpublished shifts should be included in the results.
|
150
|
+
}
|
151
|
+
|
152
|
+
begin
|
153
|
+
result = api_instance.get_shifts(opts)
|
154
|
+
p result
|
155
|
+
rescue WhenIWork::ApiError => e
|
156
|
+
puts "Exception when calling Api->get_shifts: #{e}"
|
157
|
+
end
|
158
|
+
```
|
159
|
+
|
160
|
+
### Parameters
|
161
|
+
|
162
|
+
Name | Type | Description | Notes
|
163
|
+
------------- | ------------- | ------------- | -------------
|
164
|
+
**user_id** | **String**| The ID of the user to get shifts for. For multiple users, enter a list of user IDs separated by commas (e.g. 1,5,3). | [optional]
|
165
|
+
**start** | **DateTime**| Start time for the search window. The default is the current date and time | [optional]
|
166
|
+
**_end** | **DateTime**| End time for the search window. The default is exactly three days from the start time. | [optional]
|
167
|
+
**location_id** | **String**| The ID of the location to get shifts for. For multiple locations, enter a list of location IDs separated by commas. | [optional]
|
168
|
+
**position_id** | **String**| The ID of the position to get shifts for. For multiple position, enter a list of position IDs separated by commas. | [optional]
|
169
|
+
**include_open** | **BOOLEAN**| Whether to include OpenShifts in the results. | [optional]
|
170
|
+
**include_onlyopen** | **BOOLEAN**| Whether to include OpenShifts in the results. | [optional]
|
171
|
+
**unpublished** | **BOOLEAN**| Whether unpublished shifts should be included in the results. | [optional]
|
172
|
+
|
173
|
+
### Return type
|
174
|
+
|
175
|
+
[**InlineResponse2001**](InlineResponse2001.md)
|
176
|
+
|
177
|
+
### Authorization
|
178
|
+
|
179
|
+
[apiKey](../README.md#apiKey)
|
180
|
+
|
181
|
+
### HTTP request headers
|
182
|
+
|
183
|
+
- **Content-Type**: application/json
|
184
|
+
- **Accept**: application/json
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
# **get_user**
|
189
|
+
> InlineResponse2003 get_user(user_id)
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
Get a specific user by their ID.
|
194
|
+
|
195
|
+
### Example
|
196
|
+
```ruby
|
197
|
+
# load the gem
|
198
|
+
require 'wheniwork-ruby'
|
199
|
+
# setup authorization
|
200
|
+
WhenIWork.configure do |config|
|
201
|
+
# Configure API key authorization: apiKey
|
202
|
+
config.api_key['W-Token'] = 'YOUR API KEY'
|
203
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
204
|
+
#config.api_key_prefix['W-Token'] = 'Bearer'
|
205
|
+
end
|
206
|
+
|
207
|
+
api_instance = WhenIWork::Api.new
|
208
|
+
|
209
|
+
user_id = 56 # Integer | The user identifier number
|
210
|
+
|
211
|
+
|
212
|
+
begin
|
213
|
+
result = api_instance.get_user(user_id)
|
214
|
+
p result
|
215
|
+
rescue WhenIWork::ApiError => e
|
216
|
+
puts "Exception when calling Api->get_user: #{e}"
|
217
|
+
end
|
218
|
+
```
|
219
|
+
|
220
|
+
### Parameters
|
221
|
+
|
222
|
+
Name | Type | Description | Notes
|
223
|
+
------------- | ------------- | ------------- | -------------
|
224
|
+
**user_id** | **Integer**| The user identifier number |
|
225
|
+
|
226
|
+
### Return type
|
227
|
+
|
228
|
+
[**InlineResponse2003**](InlineResponse2003.md)
|
229
|
+
|
230
|
+
### Authorization
|
231
|
+
|
232
|
+
[apiKey](../README.md#apiKey)
|
233
|
+
|
234
|
+
### HTTP request headers
|
235
|
+
|
236
|
+
- **Content-Type**: application/json
|
237
|
+
- **Accept**: application/json
|
238
|
+
|
239
|
+
|
240
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# WhenIWork::InlineResponse2001
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**start** | **DateTime** | | [optional]
|
7
|
+
**_end** | **DateTime** | | [optional]
|
8
|
+
**shifts** | [**Array<Shift>**](Shift.md) | | [optional]
|
9
|
+
|
10
|
+
|
data/docs/Position.md
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# WhenIWork::Position
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**id** | **Integer** | | [optional]
|
7
|
+
**name** | **String** | | [optional]
|
8
|
+
**color** | **String** | | [optional]
|
9
|
+
**sort** | **Integer** | | [optional]
|
10
|
+
|
11
|
+
|
data/docs/Shift.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# WhenIWork::Shift
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**start_time** | **DateTime** | | [optional]
|
7
|
+
**end_time** | **DateTime** | | [optional]
|
8
|
+
**created_at** | **DateTime** | | [optional]
|
9
|
+
**updated_at** | **DateTime** | | [optional]
|
10
|
+
**notified_at** | **DateTime** | | [optional]
|
11
|
+
**id** | **Integer** | | [optional]
|
12
|
+
**account_id** | **Integer** | | [optional]
|
13
|
+
**user_id** | **Integer** | | [optional]
|
14
|
+
**location_id** | **Integer** | | [optional]
|
15
|
+
**alerted** | **BOOLEAN** | | [optional]
|
16
|
+
**is_open** | **BOOLEAN** | | [optional]
|
17
|
+
**acknowledged** | **Integer** | | [optional]
|
18
|
+
**notes** | **String** | | [optional]
|
19
|
+
|
20
|
+
|
data/docs/User.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# WhenIWork::User
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**id** | **Integer** | | [optional]
|
7
|
+
**account_id** | **Integer** | | [optional]
|
8
|
+
**role** | **Integer** | | [optional]
|
9
|
+
**email** | **String** | | [optional]
|
10
|
+
**first_name** | **String** | | [optional]
|
11
|
+
**last_name** | **String** | | [optional]
|
12
|
+
**phone_number** | **String** | | [optional]
|
13
|
+
**employee_code** | **String** | | [optional]
|
14
|
+
**positions** | **Array<Integer>** | | [optional]
|
15
|
+
**locations** | **Array<Integer>** | | [optional]
|
16
|
+
|
17
|
+
|
data/git_push.sh
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# Generated by: https://github.com/swagger-api/swagger-codegen.git
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
18
|
+
#
|
19
|
+
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
|
20
|
+
|
21
|
+
git_user_id=$1
|
22
|
+
git_repo_id=$2
|
23
|
+
release_note=$3
|
24
|
+
|
25
|
+
if [ "$git_user_id" = "" ]; then
|
26
|
+
git_user_id="GIT_USER_ID"
|
27
|
+
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
28
|
+
fi
|
29
|
+
|
30
|
+
if [ "$git_repo_id" = "" ]; then
|
31
|
+
git_repo_id="GIT_REPO_ID"
|
32
|
+
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
33
|
+
fi
|
34
|
+
|
35
|
+
if [ "$release_note" = "" ]; then
|
36
|
+
release_note="Minor update"
|
37
|
+
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
38
|
+
fi
|
39
|
+
|
40
|
+
# Initialize the local directory as a Git repository
|
41
|
+
git init
|
42
|
+
|
43
|
+
# Adds the files in the local repository and stages them for commit.
|
44
|
+
git add .
|
45
|
+
|
46
|
+
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
47
|
+
git commit -m "$release_note"
|
48
|
+
|
49
|
+
# Sets the new remote
|
50
|
+
git_remote=`git remote`
|
51
|
+
if [ "$git_remote" = "" ]; then # git remote not defined
|
52
|
+
|
53
|
+
if [ "$GIT_TOKEN" = "" ]; then
|
54
|
+
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment."
|
55
|
+
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
|
56
|
+
else
|
57
|
+
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
58
|
+
fi
|
59
|
+
|
60
|
+
fi
|
61
|
+
|
62
|
+
git pull origin master
|
63
|
+
|
64
|
+
# Pushes (Forces) the changes in the local repository up to the remote repository
|
65
|
+
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
|
66
|
+
git push origin master 2>&1 | grep -v 'To https'
|
67
|
+
|
@@ -0,0 +1,56 @@
|
|
1
|
+
=begin
|
2
|
+
Wheniwork
|
3
|
+
|
4
|
+
OpenAPI spec version: v2
|
5
|
+
|
6
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
7
|
+
|
8
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
+
you may not use this file except in compliance with the License.
|
10
|
+
You may obtain a copy of the License at
|
11
|
+
|
12
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
|
14
|
+
Unless required by applicable law or agreed to in writing, software
|
15
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
See the License for the specific language governing permissions and
|
18
|
+
limitations under the License.
|
19
|
+
|
20
|
+
=end
|
21
|
+
|
22
|
+
# Common files
|
23
|
+
require 'wheniwork-ruby/api_client'
|
24
|
+
require 'wheniwork-ruby/api_error'
|
25
|
+
require 'wheniwork-ruby/version'
|
26
|
+
require 'wheniwork-ruby/configuration'
|
27
|
+
|
28
|
+
# Models
|
29
|
+
require 'wheniwork-ruby/models/inline_response_200'
|
30
|
+
require 'wheniwork-ruby/models/inline_response_200_1'
|
31
|
+
require 'wheniwork-ruby/models/inline_response_200_2'
|
32
|
+
require 'wheniwork-ruby/models/inline_response_200_3'
|
33
|
+
require 'wheniwork-ruby/models/position'
|
34
|
+
require 'wheniwork-ruby/models/shift'
|
35
|
+
require 'wheniwork-ruby/models/user'
|
36
|
+
|
37
|
+
# APIs
|
38
|
+
require 'wheniwork-ruby/api/api'
|
39
|
+
|
40
|
+
module WhenIWork
|
41
|
+
class << self
|
42
|
+
# Customize default settings for the SDK using block.
|
43
|
+
# WhenIWork.configure do |config|
|
44
|
+
# config.username = "xxx"
|
45
|
+
# config.password = "xxx"
|
46
|
+
# end
|
47
|
+
# If no block given, return the default Configuration object.
|
48
|
+
def configure
|
49
|
+
if block_given?
|
50
|
+
yield(Configuration.default)
|
51
|
+
else
|
52
|
+
Configuration.default
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|