stackone_hris_client 1.0.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +42 -15
- data/docs/Account.md +32 -0
- data/docs/AccountsApi.md +218 -0
- data/docs/CompaniesApi.md +175 -0
- data/docs/CompaniesPaginated.md +22 -0
- data/docs/Company.md +22 -0
- data/docs/CompanyResult.md +20 -0
- data/docs/ConnectSession.md +34 -0
- data/docs/ConnectSessionAuthenticate.md +18 -0
- data/docs/ConnectSessionCreate.md +28 -0
- data/docs/ConnectSessionToken.md +36 -0
- data/docs/ConnectSessionsApi.md +145 -0
- data/docs/Employee.md +36 -12
- data/docs/EmployeeResult.md +2 -2
- data/docs/EmployeesApi.md +19 -13
- data/docs/EmployeesPaginated.md +2 -2
- data/docs/Employment.md +34 -0
- data/docs/EmploymentResult.md +20 -0
- data/docs/EmploymentsApi.md +175 -0
- data/docs/EmploymentsPaginated.md +22 -0
- data/docs/Location.md +38 -0
- data/docs/LocationResult.md +20 -0
- data/docs/LocationsApi.md +175 -0
- data/docs/LocationsPaginated.md +22 -0
- data/gem-config.yml +4 -4
- data/lib/stackone_hris_client/api/accounts_api.rb +205 -0
- data/lib/stackone_hris_client/api/companies_api.rb +188 -0
- data/lib/stackone_hris_client/api/connect_sessions_api.rb +154 -0
- data/lib/stackone_hris_client/api/employees_api.rb +10 -4
- data/lib/stackone_hris_client/api/employments_api.rb +188 -0
- data/lib/stackone_hris_client/api/locations_api.rb +188 -0
- data/lib/stackone_hris_client/api_client.rb +5 -5
- data/lib/stackone_hris_client/api_error.rb +4 -4
- data/lib/stackone_hris_client/configuration.rb +13 -12
- data/lib/stackone_hris_client/models/account.rb +322 -0
- data/lib/stackone_hris_client/models/companies_paginated.rb +249 -0
- data/lib/stackone_hris_client/models/company.rb +237 -0
- data/lib/stackone_hris_client/models/company_result.rb +233 -0
- data/lib/stackone_hris_client/models/connect_session.rb +350 -0
- data/lib/stackone_hris_client/models/connect_session_authenticate.rb +225 -0
- data/lib/stackone_hris_client/models/connect_session_create.rb +304 -0
- data/lib/stackone_hris_client/models/connect_session_token.rb +364 -0
- data/lib/stackone_hris_client/models/employee.rb +145 -60
- data/lib/stackone_hris_client/models/employee_result.rb +9 -7
- data/lib/stackone_hris_client/models/employees_paginated.rb +9 -7
- data/lib/stackone_hris_client/models/employment.rb +296 -0
- data/lib/stackone_hris_client/models/employment_result.rb +233 -0
- data/lib/stackone_hris_client/models/employments_paginated.rb +249 -0
- data/lib/stackone_hris_client/models/location.rb +314 -0
- data/lib/stackone_hris_client/models/location_result.rb +233 -0
- data/lib/stackone_hris_client/models/locations_paginated.rb +249 -0
- data/lib/stackone_hris_client/version.rb +5 -5
- data/lib/stackone_hris_client.rb +23 -4
- data/spec/api/accounts_api_spec.rb +58 -0
- data/spec/api/companies_api_spec.rb +70 -0
- data/spec/api/connect_sessions_api_spec.rb +57 -0
- data/spec/api/employments_api_spec.rb +70 -0
- data/spec/api/locations_api_spec.rb +70 -0
- data/spec/api_client_spec.rb +32 -32
- data/spec/configuration_spec.rb +6 -6
- data/spec/models/account_spec.rb +76 -0
- data/spec/models/companies_paginated_spec.rb +46 -0
- data/spec/models/company_result_spec.rb +40 -0
- data/spec/models/company_spec.rb +46 -0
- data/spec/models/connect_session_authenticate_spec.rb +34 -0
- data/spec/models/connect_session_create_spec.rb +68 -0
- data/spec/models/connect_session_spec.rb +86 -0
- data/spec/models/connect_session_token_spec.rb +92 -0
- data/spec/models/employment_result_spec.rb +40 -0
- data/spec/models/employment_spec.rb +82 -0
- data/spec/models/employments_paginated_spec.rb +46 -0
- data/spec/models/location_result_spec.rb +40 -0
- data/spec/models/location_spec.rb +94 -0
- data/spec/models/locations_paginated_spec.rb +46 -0
- data/spec/spec_helper.rb +3 -3
- data/stackone_hris_client.gemspec +5 -5
- metadata +79 -3
@@ -0,0 +1,296 @@
|
|
1
|
+
=begin
|
2
|
+
#StackOne Unified API - HRIS
|
3
|
+
|
4
|
+
#The documentation for the StackOne Unified API - HRIS
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.4.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module StackOneHRIS
|
17
|
+
class Employment
|
18
|
+
attr_accessor :id
|
19
|
+
|
20
|
+
attr_accessor :employee_id
|
21
|
+
|
22
|
+
attr_accessor :job_title
|
23
|
+
|
24
|
+
attr_accessor :pay_rate
|
25
|
+
|
26
|
+
attr_accessor :pay_period
|
27
|
+
|
28
|
+
attr_accessor :pay_frequency
|
29
|
+
|
30
|
+
attr_accessor :pay_currency
|
31
|
+
|
32
|
+
attr_accessor :effective_date
|
33
|
+
|
34
|
+
attr_accessor :employment_type
|
35
|
+
|
36
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
37
|
+
def self.attribute_map
|
38
|
+
{
|
39
|
+
:'id' => :'id',
|
40
|
+
:'employee_id' => :'employee_id',
|
41
|
+
:'job_title' => :'job_title',
|
42
|
+
:'pay_rate' => :'pay_rate',
|
43
|
+
:'pay_period' => :'pay_period',
|
44
|
+
:'pay_frequency' => :'pay_frequency',
|
45
|
+
:'pay_currency' => :'pay_currency',
|
46
|
+
:'effective_date' => :'effective_date',
|
47
|
+
:'employment_type' => :'employment_type'
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
# Returns all the JSON keys this model knows about
|
52
|
+
def self.acceptable_attributes
|
53
|
+
attribute_map.values
|
54
|
+
end
|
55
|
+
|
56
|
+
# Attribute type mapping.
|
57
|
+
def self.openapi_types
|
58
|
+
{
|
59
|
+
:'id' => :'String',
|
60
|
+
:'employee_id' => :'String',
|
61
|
+
:'job_title' => :'String',
|
62
|
+
:'pay_rate' => :'String',
|
63
|
+
:'pay_period' => :'String',
|
64
|
+
:'pay_frequency' => :'String',
|
65
|
+
:'pay_currency' => :'String',
|
66
|
+
:'effective_date' => :'Time',
|
67
|
+
:'employment_type' => :'String'
|
68
|
+
}
|
69
|
+
end
|
70
|
+
|
71
|
+
# List of attributes with nullable: true
|
72
|
+
def self.openapi_nullable
|
73
|
+
Set.new([
|
74
|
+
])
|
75
|
+
end
|
76
|
+
|
77
|
+
# Initializes the object
|
78
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
79
|
+
def initialize(attributes = {})
|
80
|
+
if (!attributes.is_a?(Hash))
|
81
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `StackOneHRIS::Employment` initialize method"
|
82
|
+
end
|
83
|
+
|
84
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
85
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
86
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
87
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `StackOneHRIS::Employment`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
88
|
+
end
|
89
|
+
h[k.to_sym] = v
|
90
|
+
}
|
91
|
+
|
92
|
+
if attributes.key?(:'id')
|
93
|
+
self.id = attributes[:'id']
|
94
|
+
end
|
95
|
+
|
96
|
+
if attributes.key?(:'employee_id')
|
97
|
+
self.employee_id = attributes[:'employee_id']
|
98
|
+
end
|
99
|
+
|
100
|
+
if attributes.key?(:'job_title')
|
101
|
+
self.job_title = attributes[:'job_title']
|
102
|
+
end
|
103
|
+
|
104
|
+
if attributes.key?(:'pay_rate')
|
105
|
+
self.pay_rate = attributes[:'pay_rate']
|
106
|
+
end
|
107
|
+
|
108
|
+
if attributes.key?(:'pay_period')
|
109
|
+
self.pay_period = attributes[:'pay_period']
|
110
|
+
end
|
111
|
+
|
112
|
+
if attributes.key?(:'pay_frequency')
|
113
|
+
self.pay_frequency = attributes[:'pay_frequency']
|
114
|
+
end
|
115
|
+
|
116
|
+
if attributes.key?(:'pay_currency')
|
117
|
+
self.pay_currency = attributes[:'pay_currency']
|
118
|
+
end
|
119
|
+
|
120
|
+
if attributes.key?(:'effective_date')
|
121
|
+
self.effective_date = attributes[:'effective_date']
|
122
|
+
end
|
123
|
+
|
124
|
+
if attributes.key?(:'employment_type')
|
125
|
+
self.employment_type = attributes[:'employment_type']
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
130
|
+
# @return Array for valid properties with the reasons
|
131
|
+
def list_invalid_properties
|
132
|
+
invalid_properties = Array.new
|
133
|
+
if @employee_id.nil?
|
134
|
+
invalid_properties.push('invalid value for "employee_id", employee_id cannot be nil.')
|
135
|
+
end
|
136
|
+
|
137
|
+
invalid_properties
|
138
|
+
end
|
139
|
+
|
140
|
+
# Check to see if the all the properties in the model are valid
|
141
|
+
# @return true if the model is valid
|
142
|
+
def valid?
|
143
|
+
return false if @employee_id.nil?
|
144
|
+
true
|
145
|
+
end
|
146
|
+
|
147
|
+
# Checks equality by comparing each attribute.
|
148
|
+
# @param [Object] Object to be compared
|
149
|
+
def ==(o)
|
150
|
+
return true if self.equal?(o)
|
151
|
+
self.class == o.class &&
|
152
|
+
id == o.id &&
|
153
|
+
employee_id == o.employee_id &&
|
154
|
+
job_title == o.job_title &&
|
155
|
+
pay_rate == o.pay_rate &&
|
156
|
+
pay_period == o.pay_period &&
|
157
|
+
pay_frequency == o.pay_frequency &&
|
158
|
+
pay_currency == o.pay_currency &&
|
159
|
+
effective_date == o.effective_date &&
|
160
|
+
employment_type == o.employment_type
|
161
|
+
end
|
162
|
+
|
163
|
+
# @see the `==` method
|
164
|
+
# @param [Object] Object to be compared
|
165
|
+
def eql?(o)
|
166
|
+
self == o
|
167
|
+
end
|
168
|
+
|
169
|
+
# Calculates hash code according to all attributes.
|
170
|
+
# @return [Integer] Hash code
|
171
|
+
def hash
|
172
|
+
[id, employee_id, job_title, pay_rate, pay_period, pay_frequency, pay_currency, effective_date, employment_type].hash
|
173
|
+
end
|
174
|
+
|
175
|
+
# Builds the object from hash
|
176
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
177
|
+
# @return [Object] Returns the model itself
|
178
|
+
def self.build_from_hash(attributes)
|
179
|
+
new.build_from_hash(attributes)
|
180
|
+
end
|
181
|
+
|
182
|
+
# Builds the object from hash
|
183
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
184
|
+
# @return [Object] Returns the model itself
|
185
|
+
def build_from_hash(attributes)
|
186
|
+
return nil unless attributes.is_a?(Hash)
|
187
|
+
attributes = attributes.transform_keys(&:to_sym)
|
188
|
+
self.class.openapi_types.each_pair do |key, type|
|
189
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
190
|
+
self.send("#{key}=", nil)
|
191
|
+
elsif type =~ /\AArray<(.*)>/i
|
192
|
+
# check to ensure the input is an array given that the attribute
|
193
|
+
# is documented as an array but the input is not
|
194
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
195
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
196
|
+
end
|
197
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
198
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
self
|
203
|
+
end
|
204
|
+
|
205
|
+
# Deserializes the data based on type
|
206
|
+
# @param string type Data type
|
207
|
+
# @param string value Value to be deserialized
|
208
|
+
# @return [Object] Deserialized data
|
209
|
+
def _deserialize(type, value)
|
210
|
+
case type.to_sym
|
211
|
+
when :Time
|
212
|
+
Time.parse(value)
|
213
|
+
when :Date
|
214
|
+
Date.parse(value)
|
215
|
+
when :String
|
216
|
+
value.to_s
|
217
|
+
when :Integer
|
218
|
+
value.to_i
|
219
|
+
when :Float
|
220
|
+
value.to_f
|
221
|
+
when :Boolean
|
222
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
223
|
+
true
|
224
|
+
else
|
225
|
+
false
|
226
|
+
end
|
227
|
+
when :Object
|
228
|
+
# generic object (usually a Hash), return directly
|
229
|
+
value
|
230
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
231
|
+
inner_type = Regexp.last_match[:inner_type]
|
232
|
+
value.map { |v| _deserialize(inner_type, v) }
|
233
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
234
|
+
k_type = Regexp.last_match[:k_type]
|
235
|
+
v_type = Regexp.last_match[:v_type]
|
236
|
+
{}.tap do |hash|
|
237
|
+
value.each do |k, v|
|
238
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
239
|
+
end
|
240
|
+
end
|
241
|
+
else # model
|
242
|
+
# models (e.g. Pet) or oneOf
|
243
|
+
klass = StackOneHRIS.const_get(type)
|
244
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
# Returns the string representation of the object
|
249
|
+
# @return [String] String presentation of the object
|
250
|
+
def to_s
|
251
|
+
to_hash.to_s
|
252
|
+
end
|
253
|
+
|
254
|
+
# to_body is an alias to to_hash (backward compatibility)
|
255
|
+
# @return [Hash] Returns the object in the form of hash
|
256
|
+
def to_body
|
257
|
+
to_hash
|
258
|
+
end
|
259
|
+
|
260
|
+
# Returns the object in the form of hash
|
261
|
+
# @return [Hash] Returns the object in the form of hash
|
262
|
+
def to_hash
|
263
|
+
hash = {}
|
264
|
+
self.class.attribute_map.each_pair do |attr, param|
|
265
|
+
value = self.send(attr)
|
266
|
+
if value.nil?
|
267
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
268
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
269
|
+
end
|
270
|
+
|
271
|
+
hash[param] = _to_hash(value)
|
272
|
+
end
|
273
|
+
hash
|
274
|
+
end
|
275
|
+
|
276
|
+
# Outputs non-array value in the form of hash
|
277
|
+
# For object, use to_hash. Otherwise, just return the value
|
278
|
+
# @param [Object] value Any valid value
|
279
|
+
# @return [Hash] Returns the value in the form of hash
|
280
|
+
def _to_hash(value)
|
281
|
+
if value.is_a?(Array)
|
282
|
+
value.compact.map { |v| _to_hash(v) }
|
283
|
+
elsif value.is_a?(Hash)
|
284
|
+
{}.tap do |hash|
|
285
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
286
|
+
end
|
287
|
+
elsif value.respond_to? :to_hash
|
288
|
+
value.to_hash
|
289
|
+
else
|
290
|
+
value
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
294
|
+
end
|
295
|
+
|
296
|
+
end
|
@@ -0,0 +1,233 @@
|
|
1
|
+
=begin
|
2
|
+
#StackOne Unified API - HRIS
|
3
|
+
|
4
|
+
#The documentation for the StackOne Unified API - HRIS
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.4.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module StackOneHRIS
|
17
|
+
class EmploymentResult
|
18
|
+
attr_accessor :data
|
19
|
+
|
20
|
+
attr_accessor :raw
|
21
|
+
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
+
def self.attribute_map
|
24
|
+
{
|
25
|
+
:'data' => :'data',
|
26
|
+
:'raw' => :'raw'
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
# Returns all the JSON keys this model knows about
|
31
|
+
def self.acceptable_attributes
|
32
|
+
attribute_map.values
|
33
|
+
end
|
34
|
+
|
35
|
+
# Attribute type mapping.
|
36
|
+
def self.openapi_types
|
37
|
+
{
|
38
|
+
:'data' => :'Employment',
|
39
|
+
:'raw' => :'String'
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
# List of attributes with nullable: true
|
44
|
+
def self.openapi_nullable
|
45
|
+
Set.new([
|
46
|
+
])
|
47
|
+
end
|
48
|
+
|
49
|
+
# Initializes the object
|
50
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
51
|
+
def initialize(attributes = {})
|
52
|
+
if (!attributes.is_a?(Hash))
|
53
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `StackOneHRIS::EmploymentResult` initialize method"
|
54
|
+
end
|
55
|
+
|
56
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
57
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
58
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
59
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `StackOneHRIS::EmploymentResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
60
|
+
end
|
61
|
+
h[k.to_sym] = v
|
62
|
+
}
|
63
|
+
|
64
|
+
if attributes.key?(:'data')
|
65
|
+
self.data = attributes[:'data']
|
66
|
+
end
|
67
|
+
|
68
|
+
if attributes.key?(:'raw')
|
69
|
+
self.raw = attributes[:'raw']
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
74
|
+
# @return Array for valid properties with the reasons
|
75
|
+
def list_invalid_properties
|
76
|
+
invalid_properties = Array.new
|
77
|
+
if @data.nil?
|
78
|
+
invalid_properties.push('invalid value for "data", data cannot be nil.')
|
79
|
+
end
|
80
|
+
|
81
|
+
invalid_properties
|
82
|
+
end
|
83
|
+
|
84
|
+
# Check to see if the all the properties in the model are valid
|
85
|
+
# @return true if the model is valid
|
86
|
+
def valid?
|
87
|
+
return false if @data.nil?
|
88
|
+
true
|
89
|
+
end
|
90
|
+
|
91
|
+
# Checks equality by comparing each attribute.
|
92
|
+
# @param [Object] Object to be compared
|
93
|
+
def ==(o)
|
94
|
+
return true if self.equal?(o)
|
95
|
+
self.class == o.class &&
|
96
|
+
data == o.data &&
|
97
|
+
raw == o.raw
|
98
|
+
end
|
99
|
+
|
100
|
+
# @see the `==` method
|
101
|
+
# @param [Object] Object to be compared
|
102
|
+
def eql?(o)
|
103
|
+
self == o
|
104
|
+
end
|
105
|
+
|
106
|
+
# Calculates hash code according to all attributes.
|
107
|
+
# @return [Integer] Hash code
|
108
|
+
def hash
|
109
|
+
[data, raw].hash
|
110
|
+
end
|
111
|
+
|
112
|
+
# Builds the object from hash
|
113
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
114
|
+
# @return [Object] Returns the model itself
|
115
|
+
def self.build_from_hash(attributes)
|
116
|
+
new.build_from_hash(attributes)
|
117
|
+
end
|
118
|
+
|
119
|
+
# Builds the object from hash
|
120
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
121
|
+
# @return [Object] Returns the model itself
|
122
|
+
def build_from_hash(attributes)
|
123
|
+
return nil unless attributes.is_a?(Hash)
|
124
|
+
attributes = attributes.transform_keys(&:to_sym)
|
125
|
+
self.class.openapi_types.each_pair do |key, type|
|
126
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
127
|
+
self.send("#{key}=", nil)
|
128
|
+
elsif type =~ /\AArray<(.*)>/i
|
129
|
+
# check to ensure the input is an array given that the attribute
|
130
|
+
# is documented as an array but the input is not
|
131
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
132
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
133
|
+
end
|
134
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
135
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
self
|
140
|
+
end
|
141
|
+
|
142
|
+
# Deserializes the data based on type
|
143
|
+
# @param string type Data type
|
144
|
+
# @param string value Value to be deserialized
|
145
|
+
# @return [Object] Deserialized data
|
146
|
+
def _deserialize(type, value)
|
147
|
+
case type.to_sym
|
148
|
+
when :Time
|
149
|
+
Time.parse(value)
|
150
|
+
when :Date
|
151
|
+
Date.parse(value)
|
152
|
+
when :String
|
153
|
+
value.to_s
|
154
|
+
when :Integer
|
155
|
+
value.to_i
|
156
|
+
when :Float
|
157
|
+
value.to_f
|
158
|
+
when :Boolean
|
159
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
160
|
+
true
|
161
|
+
else
|
162
|
+
false
|
163
|
+
end
|
164
|
+
when :Object
|
165
|
+
# generic object (usually a Hash), return directly
|
166
|
+
value
|
167
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
168
|
+
inner_type = Regexp.last_match[:inner_type]
|
169
|
+
value.map { |v| _deserialize(inner_type, v) }
|
170
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
171
|
+
k_type = Regexp.last_match[:k_type]
|
172
|
+
v_type = Regexp.last_match[:v_type]
|
173
|
+
{}.tap do |hash|
|
174
|
+
value.each do |k, v|
|
175
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
176
|
+
end
|
177
|
+
end
|
178
|
+
else # model
|
179
|
+
# models (e.g. Pet) or oneOf
|
180
|
+
klass = StackOneHRIS.const_get(type)
|
181
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
# Returns the string representation of the object
|
186
|
+
# @return [String] String presentation of the object
|
187
|
+
def to_s
|
188
|
+
to_hash.to_s
|
189
|
+
end
|
190
|
+
|
191
|
+
# to_body is an alias to to_hash (backward compatibility)
|
192
|
+
# @return [Hash] Returns the object in the form of hash
|
193
|
+
def to_body
|
194
|
+
to_hash
|
195
|
+
end
|
196
|
+
|
197
|
+
# Returns the object in the form of hash
|
198
|
+
# @return [Hash] Returns the object in the form of hash
|
199
|
+
def to_hash
|
200
|
+
hash = {}
|
201
|
+
self.class.attribute_map.each_pair do |attr, param|
|
202
|
+
value = self.send(attr)
|
203
|
+
if value.nil?
|
204
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
205
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
206
|
+
end
|
207
|
+
|
208
|
+
hash[param] = _to_hash(value)
|
209
|
+
end
|
210
|
+
hash
|
211
|
+
end
|
212
|
+
|
213
|
+
# Outputs non-array value in the form of hash
|
214
|
+
# For object, use to_hash. Otherwise, just return the value
|
215
|
+
# @param [Object] value Any valid value
|
216
|
+
# @return [Hash] Returns the value in the form of hash
|
217
|
+
def _to_hash(value)
|
218
|
+
if value.is_a?(Array)
|
219
|
+
value.compact.map { |v| _to_hash(v) }
|
220
|
+
elsif value.is_a?(Hash)
|
221
|
+
{}.tap do |hash|
|
222
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
223
|
+
end
|
224
|
+
elsif value.respond_to? :to_hash
|
225
|
+
value.to_hash
|
226
|
+
else
|
227
|
+
value
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
end
|
232
|
+
|
233
|
+
end
|