stackone_hris_client 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +4 -4
- data/gem-config.yml +1 -1
- data/lib/stackone_hris_client/api/accounts_api.rb +1 -1
- data/lib/stackone_hris_client/api/companies_api.rb +1 -1
- data/lib/stackone_hris_client/api/connect_sessions_api.rb +1 -1
- data/lib/stackone_hris_client/api/employees_api.rb +1 -1
- data/lib/stackone_hris_client/api/employments_api.rb +1 -1
- data/lib/stackone_hris_client/api/locations_api.rb +1 -1
- data/lib/stackone_hris_client/api_client.rb +43 -2
- data/lib/stackone_hris_client/api_error.rb +1 -1
- data/lib/stackone_hris_client/configuration.rb +24 -1
- data/lib/stackone_hris_client/models/account.rb +1 -1
- data/lib/stackone_hris_client/models/companies_paginated.rb +1 -1
- data/lib/stackone_hris_client/models/company.rb +1 -1
- data/lib/stackone_hris_client/models/company_result.rb +1 -1
- data/lib/stackone_hris_client/models/connect_session.rb +1 -1
- data/lib/stackone_hris_client/models/connect_session_authenticate.rb +1 -1
- data/lib/stackone_hris_client/models/connect_session_create.rb +1 -1
- data/lib/stackone_hris_client/models/connect_session_token.rb +1 -1
- data/lib/stackone_hris_client/models/employee.rb +83 -1
- data/lib/stackone_hris_client/models/employee_result.rb +1 -1
- data/lib/stackone_hris_client/models/employees_paginated.rb +1 -1
- data/lib/stackone_hris_client/models/employment.rb +59 -1
- data/lib/stackone_hris_client/models/employment_result.rb +1 -1
- data/lib/stackone_hris_client/models/employments_paginated.rb +1 -1
- data/lib/stackone_hris_client/models/location.rb +35 -1
- data/lib/stackone_hris_client/models/location_result.rb +1 -1
- data/lib/stackone_hris_client/models/locations_paginated.rb +1 -1
- data/lib/stackone_hris_client/version.rb +2 -2
- data/lib/stackone_hris_client.rb +1 -1
- data/spec/api_client_spec.rb +1 -1
- data/spec/configuration_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- data/stackone_hris_client.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dd0114d0ac370241598829a838c46bfddb6ccec8b4a03f3a3daa03241df32410
|
|
4
|
+
data.tar.gz: cf4c1f56e1b9ed94b542fc649ce6dd60f37b5a21d1234d3fcde08bc96e4729ad
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cd9b24135b34572c928be4254ab41a8f2e49b371928049b628d3e1d833e1805964da9d767a480d07c6029c49c10f3ce097cc194762a007f5db913d5002ea451a
|
|
7
|
+
data.tar.gz: 27f5caeec05e7216f9ca0b31c3c9b09e76d88878c3660cd3c33703cdf2acf663558c7a6ba9829e0ac910b639cb751462c1c88318317a51d088b316d9d9556a90
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -7,7 +7,7 @@ The documentation for the StackOne Unified API - HRIS
|
|
|
7
7
|
This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
|
|
8
8
|
|
|
9
9
|
- API version: 1.0.0
|
|
10
|
-
- Package version: 1.
|
|
10
|
+
- Package version: 1.3.0
|
|
11
11
|
- Build package: org.openapitools.codegen.languages.RubyClientCodegen
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
@@ -23,16 +23,16 @@ gem build stackone_hris_client.gemspec
|
|
|
23
23
|
Then either install the gem locally:
|
|
24
24
|
|
|
25
25
|
```shell
|
|
26
|
-
gem install ./stackone_hris_client-1.
|
|
26
|
+
gem install ./stackone_hris_client-1.3.0.gem
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
(for development, run `gem install --dev ./stackone_hris_client-1.
|
|
29
|
+
(for development, run `gem install --dev ./stackone_hris_client-1.3.0.gem` to install the development dependencies)
|
|
30
30
|
|
|
31
31
|
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
|
|
32
32
|
|
|
33
33
|
Finally add this to the Gemfile:
|
|
34
34
|
|
|
35
|
-
gem 'stackone_hris_client', '~> 1.
|
|
35
|
+
gem 'stackone_hris_client', '~> 1.3.0'
|
|
36
36
|
|
|
37
37
|
### Install from Git
|
|
38
38
|
|
data/gem-config.yml
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
The version of the OpenAPI document: 1.0.0
|
|
7
7
|
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
OpenAPI Generator version: 6.
|
|
9
|
+
OpenAPI Generator version: 6.5.0
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -46,7 +46,7 @@ module StackOneHRIS
|
|
|
46
46
|
#
|
|
47
47
|
# @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
|
|
48
48
|
# the data deserialized from response body (could be nil), response status code and response headers.
|
|
49
|
-
def
|
|
49
|
+
def call_api_basic(http_method, path, opts = {})
|
|
50
50
|
request = build_request(http_method, path, opts)
|
|
51
51
|
response = request.run
|
|
52
52
|
|
|
@@ -77,6 +77,12 @@ module StackOneHRIS
|
|
|
77
77
|
return data, response.code, response.headers
|
|
78
78
|
end
|
|
79
79
|
|
|
80
|
+
def call_api(http_method, path, opts = {})
|
|
81
|
+
retries_errors_with_exponential_backoff do
|
|
82
|
+
return call_api_basic(http_method, path, opts)
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
80
86
|
# Builds the HTTP request
|
|
81
87
|
#
|
|
82
88
|
# @param [String] http_method HTTP method/verb (e.g. POST)
|
|
@@ -158,6 +164,41 @@ module StackOneHRIS
|
|
|
158
164
|
data
|
|
159
165
|
end
|
|
160
166
|
|
|
167
|
+
def retries_errors_with_exponential_backoff(
|
|
168
|
+
max_retries: @config.max_retries,
|
|
169
|
+
initial_backoff_seconds: @config.initial_backoff_seconds,
|
|
170
|
+
max_backoff_seconds: @config.max_backoff_seconds,
|
|
171
|
+
&block
|
|
172
|
+
)
|
|
173
|
+
retry_count = 0
|
|
174
|
+
backoff_seconds = initial_backoff_seconds
|
|
175
|
+
|
|
176
|
+
loop do
|
|
177
|
+
begin
|
|
178
|
+
yield
|
|
179
|
+
break
|
|
180
|
+
rescue ApiError => e
|
|
181
|
+
raise e unless @config.retry_status_codes.include? e.code
|
|
182
|
+
|
|
183
|
+
if @config.debugging
|
|
184
|
+
@config.logger.debug "The error code (#{e.code}) matches retry_status_codes list. Retrying #(#{retry_count}) in #{backoff_seconds}s..."
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
if retry_count >= max_retries
|
|
188
|
+
if @config.debugging
|
|
189
|
+
@config.logger.debug "Maximum number of retries (#{max_retries}) reached. Raising exception: #{e}"
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
raise e
|
|
193
|
+
else
|
|
194
|
+
sleep backoff_seconds
|
|
195
|
+
retry_count += 1
|
|
196
|
+
backoff_seconds = [backoff_seconds * 2, max_backoff_seconds].min
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
end
|
|
200
|
+
end
|
|
201
|
+
|
|
161
202
|
# Save response body into a file in (the defined) temporary folder, using the filename
|
|
162
203
|
# from the "Content-Disposition" header if provided, otherwise a random filename.
|
|
163
204
|
# The response body is written to the file in chunks in order to handle files which
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
The version of the OpenAPI document: 1.0.0
|
|
7
7
|
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
OpenAPI Generator version: 6.
|
|
9
|
+
OpenAPI Generator version: 6.5.0
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -72,6 +72,11 @@ module StackOneHRIS
|
|
|
72
72
|
# @return [Proc]
|
|
73
73
|
attr_accessor :access_token_getter
|
|
74
74
|
|
|
75
|
+
# Set this to return data as binary instead of downloading a temp file. When enabled (set to true)
|
|
76
|
+
# HTTP responses with return type `File` will be returned as a stream of binary data.
|
|
77
|
+
# Default to false.
|
|
78
|
+
attr_accessor :return_binary_data
|
|
79
|
+
|
|
75
80
|
# Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
|
|
76
81
|
# details will be logged with `logger.debug` (see the `logger` attribute).
|
|
77
82
|
# Default to false.
|
|
@@ -147,6 +152,18 @@ module StackOneHRIS
|
|
|
147
152
|
|
|
148
153
|
attr_accessor :force_ending_format
|
|
149
154
|
|
|
155
|
+
# Set this to customize the number of times to retry an API call when a server error occurs.
|
|
156
|
+
attr_accessor :max_retries
|
|
157
|
+
|
|
158
|
+
# Set this to customize the initial number of seconds to wait before retrying an API call when a server error occurs.
|
|
159
|
+
attr_accessor :initial_backoff_seconds
|
|
160
|
+
|
|
161
|
+
# Set this to customize the maximum number of seconds to keep retrying an API call when a server error occurs.
|
|
162
|
+
attr_accessor :max_backoff_seconds
|
|
163
|
+
|
|
164
|
+
# Define the status codes that should be retried.
|
|
165
|
+
attr_accessor :retry_status_codes
|
|
166
|
+
|
|
150
167
|
def initialize
|
|
151
168
|
@scheme = 'https'
|
|
152
169
|
@host = 'stackone.com'
|
|
@@ -168,6 +185,12 @@ module StackOneHRIS
|
|
|
168
185
|
@debugging = false
|
|
169
186
|
@inject_format = false
|
|
170
187
|
@force_ending_format = false
|
|
188
|
+
|
|
189
|
+
@max_retries = 5
|
|
190
|
+
@initial_backoff_seconds = 1
|
|
191
|
+
@max_backoff_seconds = 60
|
|
192
|
+
@retry_status_codes = [429]
|
|
193
|
+
|
|
171
194
|
@logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
|
|
172
195
|
|
|
173
196
|
yield(self) if block_given?
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
The version of the OpenAPI document: 1.0.0
|
|
7
7
|
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
OpenAPI Generator version: 6.
|
|
9
|
+
OpenAPI Generator version: 6.5.0
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -79,6 +79,28 @@ module StackOneHRIS
|
|
|
79
79
|
|
|
80
80
|
attr_accessor :employments
|
|
81
81
|
|
|
82
|
+
class EnumAttributeValidator
|
|
83
|
+
attr_reader :datatype
|
|
84
|
+
attr_reader :allowable_values
|
|
85
|
+
|
|
86
|
+
def initialize(datatype, allowable_values)
|
|
87
|
+
@allowable_values = allowable_values.map do |value|
|
|
88
|
+
case datatype.to_s
|
|
89
|
+
when /Integer/i
|
|
90
|
+
value.to_i
|
|
91
|
+
when /Float/i
|
|
92
|
+
value.to_f
|
|
93
|
+
else
|
|
94
|
+
value
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def valid?(value)
|
|
100
|
+
!value || allowable_values.include?(value)
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
82
104
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
83
105
|
def self.attribute_map
|
|
84
106
|
{
|
|
@@ -368,13 +390,73 @@ module StackOneHRIS
|
|
|
368
390
|
return false if @name.nil?
|
|
369
391
|
return false if @display_name.nil?
|
|
370
392
|
return false if @gender.nil?
|
|
393
|
+
gender_validator = EnumAttributeValidator.new('String', ["male", "female", "non_binary", "other", "not_disclosed", "unmapped_value"])
|
|
394
|
+
return false unless gender_validator.valid?(@gender)
|
|
395
|
+
ethnicity_validator = EnumAttributeValidator.new('String', ["white", "black_or_african_american", "asian", "hispanic_or_latino", "american_indian_or_alaska_native", "native_hawaiian_or_pacific_islander", "two_or_more_races", "not_disclosed", "unmapped_value"])
|
|
396
|
+
return false unless ethnicity_validator.valid?(@ethnicity)
|
|
397
|
+
marital_status_validator = EnumAttributeValidator.new('String', ["single", "married", "divorced", "widowed", "domestic_partnership", "separated", "other", "unmapped_value"])
|
|
398
|
+
return false unless marital_status_validator.valid?(@marital_status)
|
|
371
399
|
return false if @personal_phone_number.nil?
|
|
372
400
|
return false if @work_email.nil?
|
|
373
401
|
return false if @work_phone_number.nil?
|
|
374
402
|
return false if @department.nil?
|
|
403
|
+
employment_type_validator = EnumAttributeValidator.new('String', ["full_time", "part_time", "contractor", "intern", "freelance", "terminated", "unmapped_value"])
|
|
404
|
+
return false unless employment_type_validator.valid?(@employment_type)
|
|
405
|
+
employment_status_validator = EnumAttributeValidator.new('String', ["active", "pending", "terminated", "unmapped_value"])
|
|
406
|
+
return false unless employment_status_validator.valid?(@employment_status)
|
|
375
407
|
true
|
|
376
408
|
end
|
|
377
409
|
|
|
410
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
411
|
+
# @param [Object] gender Object to be assigned
|
|
412
|
+
def gender=(gender)
|
|
413
|
+
validator = EnumAttributeValidator.new('String', ["male", "female", "non_binary", "other", "not_disclosed", "unmapped_value"])
|
|
414
|
+
unless validator.valid?(gender)
|
|
415
|
+
fail ArgumentError, "invalid value for \"gender\", must be one of #{validator.allowable_values}."
|
|
416
|
+
end
|
|
417
|
+
@gender = gender
|
|
418
|
+
end
|
|
419
|
+
|
|
420
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
421
|
+
# @param [Object] ethnicity Object to be assigned
|
|
422
|
+
def ethnicity=(ethnicity)
|
|
423
|
+
validator = EnumAttributeValidator.new('String', ["white", "black_or_african_american", "asian", "hispanic_or_latino", "american_indian_or_alaska_native", "native_hawaiian_or_pacific_islander", "two_or_more_races", "not_disclosed", "unmapped_value"])
|
|
424
|
+
unless validator.valid?(ethnicity)
|
|
425
|
+
fail ArgumentError, "invalid value for \"ethnicity\", must be one of #{validator.allowable_values}."
|
|
426
|
+
end
|
|
427
|
+
@ethnicity = ethnicity
|
|
428
|
+
end
|
|
429
|
+
|
|
430
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
431
|
+
# @param [Object] marital_status Object to be assigned
|
|
432
|
+
def marital_status=(marital_status)
|
|
433
|
+
validator = EnumAttributeValidator.new('String', ["single", "married", "divorced", "widowed", "domestic_partnership", "separated", "other", "unmapped_value"])
|
|
434
|
+
unless validator.valid?(marital_status)
|
|
435
|
+
fail ArgumentError, "invalid value for \"marital_status\", must be one of #{validator.allowable_values}."
|
|
436
|
+
end
|
|
437
|
+
@marital_status = marital_status
|
|
438
|
+
end
|
|
439
|
+
|
|
440
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
441
|
+
# @param [Object] employment_type Object to be assigned
|
|
442
|
+
def employment_type=(employment_type)
|
|
443
|
+
validator = EnumAttributeValidator.new('String', ["full_time", "part_time", "contractor", "intern", "freelance", "terminated", "unmapped_value"])
|
|
444
|
+
unless validator.valid?(employment_type)
|
|
445
|
+
fail ArgumentError, "invalid value for \"employment_type\", must be one of #{validator.allowable_values}."
|
|
446
|
+
end
|
|
447
|
+
@employment_type = employment_type
|
|
448
|
+
end
|
|
449
|
+
|
|
450
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
451
|
+
# @param [Object] employment_status Object to be assigned
|
|
452
|
+
def employment_status=(employment_status)
|
|
453
|
+
validator = EnumAttributeValidator.new('String', ["active", "pending", "terminated", "unmapped_value"])
|
|
454
|
+
unless validator.valid?(employment_status)
|
|
455
|
+
fail ArgumentError, "invalid value for \"employment_status\", must be one of #{validator.allowable_values}."
|
|
456
|
+
end
|
|
457
|
+
@employment_status = employment_status
|
|
458
|
+
end
|
|
459
|
+
|
|
378
460
|
# Checks equality by comparing each attribute.
|
|
379
461
|
# @param [Object] Object to be compared
|
|
380
462
|
def ==(o)
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
The version of the OpenAPI document: 1.0.0
|
|
7
7
|
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
OpenAPI Generator version: 6.
|
|
9
|
+
OpenAPI Generator version: 6.5.0
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -33,6 +33,28 @@ module StackOneHRIS
|
|
|
33
33
|
|
|
34
34
|
attr_accessor :employment_type
|
|
35
35
|
|
|
36
|
+
class EnumAttributeValidator
|
|
37
|
+
attr_reader :datatype
|
|
38
|
+
attr_reader :allowable_values
|
|
39
|
+
|
|
40
|
+
def initialize(datatype, allowable_values)
|
|
41
|
+
@allowable_values = allowable_values.map do |value|
|
|
42
|
+
case datatype.to_s
|
|
43
|
+
when /Integer/i
|
|
44
|
+
value.to_i
|
|
45
|
+
when /Float/i
|
|
46
|
+
value.to_f
|
|
47
|
+
else
|
|
48
|
+
value
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def valid?(value)
|
|
54
|
+
!value || allowable_values.include?(value)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
36
58
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
37
59
|
def self.attribute_map
|
|
38
60
|
{
|
|
@@ -141,9 +163,45 @@ module StackOneHRIS
|
|
|
141
163
|
# @return true if the model is valid
|
|
142
164
|
def valid?
|
|
143
165
|
return false if @employee_id.nil?
|
|
166
|
+
pay_period_validator = EnumAttributeValidator.new('String', ["hour", "day", "week", "every_two_weeks", "month", "quarter", "every_six_months", "year", "unmapped_value"])
|
|
167
|
+
return false unless pay_period_validator.valid?(@pay_period)
|
|
168
|
+
pay_frequency_validator = EnumAttributeValidator.new('String', ["hourly", "weekly", "bi_weekly", "monthly", "quarterly", "semi_annually", "yearly", "thirteen_monthly", "pro_rata", "unmapped_value"])
|
|
169
|
+
return false unless pay_frequency_validator.valid?(@pay_frequency)
|
|
170
|
+
employment_type_validator = EnumAttributeValidator.new('String', ["full_time", "part_time", "contractor", "intern", "freelance", "terminated", "unmapped_value"])
|
|
171
|
+
return false unless employment_type_validator.valid?(@employment_type)
|
|
144
172
|
true
|
|
145
173
|
end
|
|
146
174
|
|
|
175
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
176
|
+
# @param [Object] pay_period Object to be assigned
|
|
177
|
+
def pay_period=(pay_period)
|
|
178
|
+
validator = EnumAttributeValidator.new('String', ["hour", "day", "week", "every_two_weeks", "month", "quarter", "every_six_months", "year", "unmapped_value"])
|
|
179
|
+
unless validator.valid?(pay_period)
|
|
180
|
+
fail ArgumentError, "invalid value for \"pay_period\", must be one of #{validator.allowable_values}."
|
|
181
|
+
end
|
|
182
|
+
@pay_period = pay_period
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
186
|
+
# @param [Object] pay_frequency Object to be assigned
|
|
187
|
+
def pay_frequency=(pay_frequency)
|
|
188
|
+
validator = EnumAttributeValidator.new('String', ["hourly", "weekly", "bi_weekly", "monthly", "quarterly", "semi_annually", "yearly", "thirteen_monthly", "pro_rata", "unmapped_value"])
|
|
189
|
+
unless validator.valid?(pay_frequency)
|
|
190
|
+
fail ArgumentError, "invalid value for \"pay_frequency\", must be one of #{validator.allowable_values}."
|
|
191
|
+
end
|
|
192
|
+
@pay_frequency = pay_frequency
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
196
|
+
# @param [Object] employment_type Object to be assigned
|
|
197
|
+
def employment_type=(employment_type)
|
|
198
|
+
validator = EnumAttributeValidator.new('String', ["full_time", "part_time", "contractor", "intern", "freelance", "terminated", "unmapped_value"])
|
|
199
|
+
unless validator.valid?(employment_type)
|
|
200
|
+
fail ArgumentError, "invalid value for \"employment_type\", must be one of #{validator.allowable_values}."
|
|
201
|
+
end
|
|
202
|
+
@employment_type = employment_type
|
|
203
|
+
end
|
|
204
|
+
|
|
147
205
|
# Checks equality by comparing each attribute.
|
|
148
206
|
# @param [Object] Object to be compared
|
|
149
207
|
def ==(o)
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
The version of the OpenAPI document: 1.0.0
|
|
7
7
|
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
OpenAPI Generator version: 6.
|
|
9
|
+
OpenAPI Generator version: 6.5.0
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -37,6 +37,28 @@ module StackOneHRIS
|
|
|
37
37
|
|
|
38
38
|
attr_accessor :location_type
|
|
39
39
|
|
|
40
|
+
class EnumAttributeValidator
|
|
41
|
+
attr_reader :datatype
|
|
42
|
+
attr_reader :allowable_values
|
|
43
|
+
|
|
44
|
+
def initialize(datatype, allowable_values)
|
|
45
|
+
@allowable_values = allowable_values.map do |value|
|
|
46
|
+
case datatype.to_s
|
|
47
|
+
when /Integer/i
|
|
48
|
+
value.to_i
|
|
49
|
+
when /Float/i
|
|
50
|
+
value.to_f
|
|
51
|
+
else
|
|
52
|
+
value
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def valid?(value)
|
|
58
|
+
!value || allowable_values.include?(value)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
40
62
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
41
63
|
def self.attribute_map
|
|
42
64
|
{
|
|
@@ -157,9 +179,21 @@ module StackOneHRIS
|
|
|
157
179
|
# @return true if the model is valid
|
|
158
180
|
def valid?
|
|
159
181
|
return false if @employee_id.nil?
|
|
182
|
+
location_type_validator = EnumAttributeValidator.new('String', ["home", "work", "unmapped_value"])
|
|
183
|
+
return false unless location_type_validator.valid?(@location_type)
|
|
160
184
|
true
|
|
161
185
|
end
|
|
162
186
|
|
|
187
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
188
|
+
# @param [Object] location_type Object to be assigned
|
|
189
|
+
def location_type=(location_type)
|
|
190
|
+
validator = EnumAttributeValidator.new('String', ["home", "work", "unmapped_value"])
|
|
191
|
+
unless validator.valid?(location_type)
|
|
192
|
+
fail ArgumentError, "invalid value for \"location_type\", must be one of #{validator.allowable_values}."
|
|
193
|
+
end
|
|
194
|
+
@location_type = location_type
|
|
195
|
+
end
|
|
196
|
+
|
|
163
197
|
# Checks equality by comparing each attribute.
|
|
164
198
|
# @param [Object] Object to be compared
|
|
165
199
|
def ==(o)
|
data/lib/stackone_hris_client.rb
CHANGED
data/spec/api_client_spec.rb
CHANGED
data/spec/configuration_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: stackone_hris_client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- StackOne
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-
|
|
11
|
+
date: 2023-04-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: typhoeus
|