stackone_hris_client 1.6.0 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/README.md +31 -5
  4. data/docs/Account.md +1 -1
  5. data/docs/AccountMeta.md +22 -0
  6. data/docs/AccountsApi.md +70 -2
  7. data/docs/CompaniesApi.md +1 -1
  8. data/docs/ConnectSessionsApi.md +1 -1
  9. data/docs/CreateEmployeeResult.md +22 -0
  10. data/docs/Employee.md +56 -54
  11. data/docs/EmployeeApiModel.md +80 -0
  12. data/docs/EmployeeApiModelAvatar.md +20 -0
  13. data/docs/EmployeeApiModelEmploymentStatus.md +20 -0
  14. data/docs/EmployeeApiModelEmploymentType.md +20 -0
  15. data/docs/EmployeeApiModelEthnicity.md +20 -0
  16. data/docs/EmployeeApiModelGender.md +20 -0
  17. data/docs/EmployeeApiModelHomeLocation.md +38 -0
  18. data/docs/EmployeeApiModelMaritalStatus.md +20 -0
  19. data/docs/EmployeeApiModelWorkLocation.md +38 -0
  20. data/docs/EmployeeCustomFieldTypeEnum.md +20 -0
  21. data/docs/EmployeeCustomFields.md +30 -0
  22. data/docs/EmployeeCustomFieldsType.md +20 -0
  23. data/docs/EmployeeResult.md +1 -1
  24. data/docs/EmployeesApi.md +219 -5
  25. data/docs/EmployeesPaginated.md +1 -1
  26. data/docs/Employment.md +17 -15
  27. data/docs/EmploymentEmploymentContractType.md +20 -0
  28. data/docs/EmploymentEmploymentType.md +20 -0
  29. data/docs/EmploymentPayFrequency.md +20 -0
  30. data/docs/EmploymentPayPeriod.md +20 -0
  31. data/docs/EmploymentScheduleTypeEnum.md +20 -0
  32. data/docs/EmploymentsApi.md +3 -3
  33. data/docs/HrisCreateEmployeeRequestDto.md +80 -0
  34. data/docs/Location.md +20 -20
  35. data/docs/LocationCountry.md +20 -0
  36. data/docs/LocationLocationType.md +20 -0
  37. data/docs/LocationsApi.md +1 -1
  38. data/gem-config.yml +2 -2
  39. data/generate_gem.sh +0 -0
  40. data/lib/stackone_hris_client/api/accounts_api.rb +61 -0
  41. data/lib/stackone_hris_client/api/employees_api.rb +231 -0
  42. data/lib/stackone_hris_client/models/account.rb +0 -5
  43. data/lib/stackone_hris_client/models/account_meta.rb +284 -0
  44. data/lib/stackone_hris_client/models/country_code_enum.rb +0 -6
  45. data/lib/stackone_hris_client/models/create_employee_result.rb +250 -0
  46. data/lib/stackone_hris_client/models/employee.rb +110 -126
  47. data/lib/stackone_hris_client/models/employee_api_model.rb +523 -0
  48. data/lib/stackone_hris_client/models/employee_api_model_avatar.rb +234 -0
  49. data/lib/stackone_hris_client/models/employee_api_model_employment_status.rb +272 -0
  50. data/lib/stackone_hris_client/models/employee_api_model_employment_type.rb +272 -0
  51. data/lib/stackone_hris_client/models/employee_api_model_ethnicity.rb +272 -0
  52. data/lib/stackone_hris_client/models/employee_api_model_gender.rb +272 -0
  53. data/lib/stackone_hris_client/models/employee_api_model_home_location.rb +324 -0
  54. data/lib/stackone_hris_client/models/employee_api_model_marital_status.rb +272 -0
  55. data/lib/stackone_hris_client/models/employee_api_model_work_location.rb +324 -0
  56. data/lib/stackone_hris_client/models/employee_custom_field_type_enum.rb +264 -0
  57. data/lib/stackone_hris_client/models/employee_custom_fields.rb +279 -0
  58. data/lib/stackone_hris_client/models/employee_custom_fields_type.rb +272 -0
  59. data/lib/stackone_hris_client/models/employment.rb +21 -6
  60. data/lib/stackone_hris_client/models/employment_employment_contract_type.rb +272 -0
  61. data/lib/stackone_hris_client/models/employment_employment_type.rb +272 -0
  62. data/lib/stackone_hris_client/models/employment_pay_frequency.rb +272 -0
  63. data/lib/stackone_hris_client/models/employment_pay_period.rb +272 -0
  64. data/lib/stackone_hris_client/models/employment_schedule_type_enum.rb +264 -0
  65. data/lib/stackone_hris_client/models/employment_status_enum.rb +0 -6
  66. data/lib/stackone_hris_client/models/employment_type_enum.rb +0 -6
  67. data/lib/stackone_hris_client/models/ethnicity_enum.rb +0 -6
  68. data/lib/stackone_hris_client/models/gender_enum.rb +0 -6
  69. data/lib/stackone_hris_client/models/hris_create_employee_request_dto.rb +523 -0
  70. data/lib/stackone_hris_client/models/location.rb +11 -7
  71. data/lib/stackone_hris_client/models/location_country.rb +272 -0
  72. data/lib/stackone_hris_client/models/location_location_type.rb +272 -0
  73. data/lib/stackone_hris_client/models/location_type_enum.rb +0 -6
  74. data/lib/stackone_hris_client/models/marital_status_enum.rb +0 -6
  75. data/lib/stackone_hris_client/models/pay_frequency_enum.rb +0 -6
  76. data/lib/stackone_hris_client/models/pay_period_enum.rb +0 -6
  77. data/lib/stackone_hris_client/version.rb +1 -1
  78. data/lib/stackone_hris_client.rb +22 -0
  79. data/spec/api/accounts_api_spec.rb +30 -8
  80. data/spec/api/companies_api_spec.rb +13 -13
  81. data/spec/api/connect_sessions_api_spec.rb +8 -8
  82. data/spec/api/employees_api_spec.rb +60 -18
  83. data/spec/api/employments_api_spec.rb +13 -13
  84. data/spec/api/locations_api_spec.rb +9 -9
  85. data/spec/models/account_meta_spec.rb +50 -0
  86. data/spec/models/account_spec.rb +18 -12
  87. data/spec/models/companies_paginated_spec.rb +4 -4
  88. data/spec/models/company_result_spec.rb +3 -3
  89. data/spec/models/company_spec.rb +4 -4
  90. data/spec/models/connect_session_authenticate_spec.rb +5 -5
  91. data/spec/models/connect_session_create_spec.rb +17 -11
  92. data/spec/models/connect_session_spec.rb +14 -14
  93. data/spec/models/connect_session_token_spec.rb +15 -15
  94. data/spec/models/country_code_enum_spec.rb +4 -4
  95. data/spec/models/create_employee_result_spec.rb +46 -0
  96. data/spec/models/employee.rb +220 -0
  97. data/spec/models/employee_api_model_avatar_spec.rb +40 -0
  98. data/spec/models/employee_api_model_employment_status_spec.rb +44 -0
  99. data/spec/models/employee_api_model_employment_type_spec.rb +44 -0
  100. data/spec/models/employee_api_model_ethnicity_spec.rb +44 -0
  101. data/spec/models/employee_api_model_gender_spec.rb +44 -0
  102. data/spec/models/employee_api_model_home_location_spec.rb +94 -0
  103. data/spec/models/employee_api_model_marital_status_spec.rb +44 -0
  104. data/spec/models/employee_api_model_spec.rb +220 -0
  105. data/spec/models/employee_api_model_work_location_spec.rb +94 -0
  106. data/spec/models/employee_custom_field_type_enum_spec.rb +44 -0
  107. data/spec/models/employee_custom_fields_spec.rb +70 -0
  108. data/spec/models/employee_custom_fields_type_spec.rb +44 -0
  109. data/spec/models/employee_result_spec.rb +6 -6
  110. data/spec/models/employees_paginated_spec.rb +7 -7
  111. data/spec/models/employment_employment_contract_type_spec.rb +44 -0
  112. data/spec/models/employment_employment_type_spec.rb +44 -0
  113. data/spec/models/employment_pay_frequency_spec.rb +44 -0
  114. data/spec/models/employment_pay_period_spec.rb +44 -0
  115. data/spec/models/employment_result_spec.rb +3 -3
  116. data/spec/models/employment_schedule_type_enum_spec.rb +44 -0
  117. data/spec/models/employment_spec.rb +16 -10
  118. data/spec/models/employment_status_enum_spec.rb +4 -4
  119. data/spec/models/employment_type_enum_spec.rb +4 -4
  120. data/spec/models/employments_paginated_spec.rb +4 -4
  121. data/spec/models/ethnicity_enum_spec.rb +4 -4
  122. data/spec/models/gender_enum_spec.rb +4 -4
  123. data/spec/models/hris_create_employee_request_dto_spec.rb +220 -0
  124. data/spec/models/image_spec.rb +3 -3
  125. data/spec/models/location_country_spec.rb +44 -0
  126. data/spec/models/location_location_type_spec.rb +44 -0
  127. data/spec/models/location_result_spec.rb +3 -3
  128. data/spec/models/location_spec.rb +12 -12
  129. data/spec/models/location_type_enum_spec.rb +3 -3
  130. data/spec/models/locations_paginated_spec.rb +4 -4
  131. data/spec/models/marital_status_enum_spec.rb +4 -4
  132. data/spec/models/pay_frequency_enum_spec.rb +4 -4
  133. data/spec/models/pay_period_enum_spec.rb +3 -3
  134. metadata +92 -4
  135. data/spec/models/employee_spec.rb +0 -124
@@ -0,0 +1,272 @@
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.6.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module StackOneHRIS
17
+ # The pay period
18
+ class EmploymentPayPeriod
19
+ attr_accessor :value
20
+
21
+ attr_accessor :source_value
22
+
23
+ class EnumAttributeValidator
24
+ attr_reader :datatype
25
+ attr_reader :allowable_values
26
+
27
+ def initialize(datatype, allowable_values)
28
+ @allowable_values = allowable_values.map do |value|
29
+ case datatype.to_s
30
+ when /Integer/i
31
+ value.to_i
32
+ when /Float/i
33
+ value.to_f
34
+ else
35
+ value
36
+ end
37
+ end
38
+ end
39
+
40
+ def valid?(value)
41
+ !value || allowable_values.include?(value)
42
+ end
43
+ end
44
+
45
+ # Attribute mapping from ruby-style variable name to JSON key.
46
+ def self.attribute_map
47
+ {
48
+ :'value' => :'value',
49
+ :'source_value' => :'source_value'
50
+ }
51
+ end
52
+
53
+ # Returns all the JSON keys this model knows about
54
+ def self.acceptable_attributes
55
+ attribute_map.values
56
+ end
57
+
58
+ # Attribute type mapping.
59
+ def self.openapi_types
60
+ {
61
+ :'value' => :'String',
62
+ :'source_value' => :'String'
63
+ }
64
+ end
65
+
66
+ # List of attributes with nullable: true
67
+ def self.openapi_nullable
68
+ Set.new([
69
+ ])
70
+ end
71
+
72
+ # List of class defined in allOf (OpenAPI v3)
73
+ def self.openapi_all_of
74
+ [
75
+ :'PayPeriodEnum'
76
+ ]
77
+ end
78
+
79
+ # Initializes the object
80
+ # @param [Hash] attributes Model attributes in the form of hash
81
+ def initialize(attributes = {})
82
+ if (!attributes.is_a?(Hash))
83
+ fail ArgumentError, "The input argument (attributes) must be a hash in `StackOneHRIS::EmploymentPayPeriod` initialize method"
84
+ end
85
+
86
+ # check to see if the attribute exists and convert string to symbol for hash key
87
+ attributes = attributes.each_with_object({}) { |(k, v), h|
88
+ if (!self.class.attribute_map.key?(k.to_sym))
89
+ fail ArgumentError, "`#{k}` is not a valid attribute in `StackOneHRIS::EmploymentPayPeriod`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
90
+ end
91
+ h[k.to_sym] = v
92
+ }
93
+
94
+ if attributes.key?(:'value')
95
+ self.value = attributes[:'value']
96
+ end
97
+
98
+ if attributes.key?(:'source_value')
99
+ self.source_value = attributes[:'source_value']
100
+ end
101
+ end
102
+
103
+ # Show invalid properties with the reasons. Usually used together with valid?
104
+ # @return Array for valid properties with the reasons
105
+ def list_invalid_properties
106
+ invalid_properties = Array.new
107
+ if @value.nil?
108
+ invalid_properties.push('invalid value for "value", value cannot be nil.')
109
+ end
110
+
111
+ if @source_value.nil?
112
+ invalid_properties.push('invalid value for "source_value", source_value cannot be nil.')
113
+ end
114
+
115
+ invalid_properties
116
+ end
117
+
118
+ # Check to see if the all the properties in the model are valid
119
+ # @return true if the model is valid
120
+ def valid?
121
+ return false if @value.nil?
122
+ return false if @source_value.nil?
123
+ true
124
+ end
125
+
126
+ # Custom attribute writer method checking allowed values (enum).
127
+ # @param [Object] value Object to be assigned
128
+ def value=(value)
129
+ @value = value
130
+ end
131
+
132
+ # Checks equality by comparing each attribute.
133
+ # @param [Object] Object to be compared
134
+ def ==(o)
135
+ return true if self.equal?(o)
136
+ self.class == o.class &&
137
+ value == o.value &&
138
+ source_value == o.source_value
139
+ end
140
+
141
+ # @see the `==` method
142
+ # @param [Object] Object to be compared
143
+ def eql?(o)
144
+ self == o
145
+ end
146
+
147
+ # Calculates hash code according to all attributes.
148
+ # @return [Integer] Hash code
149
+ def hash
150
+ [value, source_value].hash
151
+ end
152
+
153
+ # Builds the object from hash
154
+ # @param [Hash] attributes Model attributes in the form of hash
155
+ # @return [Object] Returns the model itself
156
+ def self.build_from_hash(attributes)
157
+ new.build_from_hash(attributes)
158
+ end
159
+
160
+ # Builds the object from hash
161
+ # @param [Hash] attributes Model attributes in the form of hash
162
+ # @return [Object] Returns the model itself
163
+ def build_from_hash(attributes)
164
+ return nil unless attributes.is_a?(Hash)
165
+ attributes = attributes.transform_keys(&:to_sym)
166
+ self.class.openapi_types.each_pair do |key, type|
167
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
168
+ self.send("#{key}=", nil)
169
+ elsif type =~ /\AArray<(.*)>/i
170
+ # check to ensure the input is an array given that the attribute
171
+ # is documented as an array but the input is not
172
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
173
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
174
+ end
175
+ elsif !attributes[self.class.attribute_map[key]].nil?
176
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
177
+ end
178
+ end
179
+
180
+ self
181
+ end
182
+
183
+ # Deserializes the data based on type
184
+ # @param string type Data type
185
+ # @param string value Value to be deserialized
186
+ # @return [Object] Deserialized data
187
+ def _deserialize(type, value)
188
+ case type.to_sym
189
+ when :Time
190
+ Time.parse(value)
191
+ when :Date
192
+ Date.parse(value)
193
+ when :String
194
+ value.to_s
195
+ when :Integer
196
+ value.to_i
197
+ when :Float
198
+ value.to_f
199
+ when :Boolean
200
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
201
+ true
202
+ else
203
+ false
204
+ end
205
+ when :Object
206
+ # generic object (usually a Hash), return directly
207
+ value
208
+ when /\AArray<(?<inner_type>.+)>\z/
209
+ inner_type = Regexp.last_match[:inner_type]
210
+ value.map { |v| _deserialize(inner_type, v) }
211
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
212
+ k_type = Regexp.last_match[:k_type]
213
+ v_type = Regexp.last_match[:v_type]
214
+ {}.tap do |hash|
215
+ value.each do |k, v|
216
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
217
+ end
218
+ end
219
+ else # model
220
+ # models (e.g. Pet) or oneOf
221
+ klass = StackOneHRIS.const_get(type)
222
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
223
+ end
224
+ end
225
+
226
+ # Returns the string representation of the object
227
+ # @return [String] String presentation of the object
228
+ def to_s
229
+ to_hash.to_s
230
+ end
231
+
232
+ # to_body is an alias to to_hash (backward compatibility)
233
+ # @return [Hash] Returns the object in the form of hash
234
+ def to_body
235
+ to_hash
236
+ end
237
+
238
+ # Returns the object in the form of hash
239
+ # @return [Hash] Returns the object in the form of hash
240
+ def to_hash
241
+ hash = {}
242
+ self.class.attribute_map.each_pair do |attr, param|
243
+ value = self.send(attr)
244
+ if value.nil?
245
+ is_nullable = self.class.openapi_nullable.include?(attr)
246
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
247
+ end
248
+
249
+ hash[param] = _to_hash(value)
250
+ end
251
+ hash
252
+ end
253
+
254
+ # Outputs non-array value in the form of hash
255
+ # For object, use to_hash. Otherwise, just return the value
256
+ # @param [Object] value Any valid value
257
+ # @return [Hash] Returns the value in the form of hash
258
+ def _to_hash(value)
259
+ if value.is_a?(Array)
260
+ value.compact.map { |v| _to_hash(v) }
261
+ elsif value.is_a?(Hash)
262
+ {}.tap do |hash|
263
+ value.each { |k, v| hash[k] = _to_hash(v) }
264
+ end
265
+ elsif value.respond_to? :to_hash
266
+ value.to_hash
267
+ else
268
+ value
269
+ end
270
+ end
271
+ end
272
+ end
@@ -0,0 +1,264 @@
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.6.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module StackOneHRIS
17
+ class EmploymentScheduleTypeEnum
18
+ attr_accessor :value
19
+
20
+ attr_accessor :source_value
21
+
22
+ class EnumAttributeValidator
23
+ attr_reader :datatype
24
+ attr_reader :allowable_values
25
+
26
+ def initialize(datatype, allowable_values)
27
+ @allowable_values = allowable_values.map do |value|
28
+ case datatype.to_s
29
+ when /Integer/i
30
+ value.to_i
31
+ when /Float/i
32
+ value.to_f
33
+ else
34
+ value
35
+ end
36
+ end
37
+ end
38
+
39
+ def valid?(value)
40
+ !value || allowable_values.include?(value)
41
+ end
42
+ end
43
+
44
+ # Attribute mapping from ruby-style variable name to JSON key.
45
+ def self.attribute_map
46
+ {
47
+ :'value' => :'value',
48
+ :'source_value' => :'source_value'
49
+ }
50
+ end
51
+
52
+ # Returns all the JSON keys this model knows about
53
+ def self.acceptable_attributes
54
+ attribute_map.values
55
+ end
56
+
57
+ # Attribute type mapping.
58
+ def self.openapi_types
59
+ {
60
+ :'value' => :'String',
61
+ :'source_value' => :'String'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ ])
69
+ end
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ def initialize(attributes = {})
74
+ if (!attributes.is_a?(Hash))
75
+ fail ArgumentError, "The input argument (attributes) must be a hash in `StackOneHRIS::EmploymentScheduleTypeEnum` initialize method"
76
+ end
77
+
78
+ # check to see if the attribute exists and convert string to symbol for hash key
79
+ attributes = attributes.each_with_object({}) { |(k, v), h|
80
+ if (!self.class.attribute_map.key?(k.to_sym))
81
+ fail ArgumentError, "`#{k}` is not a valid attribute in `StackOneHRIS::EmploymentScheduleTypeEnum`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
82
+ end
83
+ h[k.to_sym] = v
84
+ }
85
+
86
+ if attributes.key?(:'value')
87
+ self.value = attributes[:'value']
88
+ end
89
+
90
+ if attributes.key?(:'source_value')
91
+ self.source_value = attributes[:'source_value']
92
+ end
93
+ end
94
+
95
+ # Show invalid properties with the reasons. Usually used together with valid?
96
+ # @return Array for valid properties with the reasons
97
+ def list_invalid_properties
98
+ invalid_properties = Array.new
99
+ if @value.nil?
100
+ invalid_properties.push('invalid value for "value", value cannot be nil.')
101
+ end
102
+
103
+ if @source_value.nil?
104
+ invalid_properties.push('invalid value for "source_value", source_value cannot be nil.')
105
+ end
106
+
107
+ invalid_properties
108
+ end
109
+
110
+ # Check to see if the all the properties in the model are valid
111
+ # @return true if the model is valid
112
+ def valid?
113
+ return false if @value.nil?
114
+ return false if @source_value.nil?
115
+ true
116
+ end
117
+
118
+ # Custom attribute writer method checking allowed values (enum).
119
+ # @param [Object] value Object to be assigned
120
+ def value=(value)
121
+ @value = value
122
+ end
123
+
124
+ # Checks equality by comparing each attribute.
125
+ # @param [Object] Object to be compared
126
+ def ==(o)
127
+ return true if self.equal?(o)
128
+ self.class == o.class &&
129
+ value == o.value &&
130
+ source_value == o.source_value
131
+ end
132
+
133
+ # @see the `==` method
134
+ # @param [Object] Object to be compared
135
+ def eql?(o)
136
+ self == o
137
+ end
138
+
139
+ # Calculates hash code according to all attributes.
140
+ # @return [Integer] Hash code
141
+ def hash
142
+ [value, source_value].hash
143
+ end
144
+
145
+ # Builds the object from hash
146
+ # @param [Hash] attributes Model attributes in the form of hash
147
+ # @return [Object] Returns the model itself
148
+ def self.build_from_hash(attributes)
149
+ new.build_from_hash(attributes)
150
+ end
151
+
152
+ # Builds the object from hash
153
+ # @param [Hash] attributes Model attributes in the form of hash
154
+ # @return [Object] Returns the model itself
155
+ def build_from_hash(attributes)
156
+ return nil unless attributes.is_a?(Hash)
157
+ attributes = attributes.transform_keys(&:to_sym)
158
+ self.class.openapi_types.each_pair do |key, type|
159
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
160
+ self.send("#{key}=", nil)
161
+ elsif type =~ /\AArray<(.*)>/i
162
+ # check to ensure the input is an array given that the attribute
163
+ # is documented as an array but the input is not
164
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
165
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
166
+ end
167
+ elsif !attributes[self.class.attribute_map[key]].nil?
168
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
169
+ end
170
+ end
171
+
172
+ self
173
+ end
174
+
175
+ # Deserializes the data based on type
176
+ # @param string type Data type
177
+ # @param string value Value to be deserialized
178
+ # @return [Object] Deserialized data
179
+ def _deserialize(type, value)
180
+ case type.to_sym
181
+ when :Time
182
+ Time.parse(value)
183
+ when :Date
184
+ Date.parse(value)
185
+ when :String
186
+ value.to_s
187
+ when :Integer
188
+ value.to_i
189
+ when :Float
190
+ value.to_f
191
+ when :Boolean
192
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
193
+ true
194
+ else
195
+ false
196
+ end
197
+ when :Object
198
+ # generic object (usually a Hash), return directly
199
+ value
200
+ when /\AArray<(?<inner_type>.+)>\z/
201
+ inner_type = Regexp.last_match[:inner_type]
202
+ value.map { |v| _deserialize(inner_type, v) }
203
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
204
+ k_type = Regexp.last_match[:k_type]
205
+ v_type = Regexp.last_match[:v_type]
206
+ {}.tap do |hash|
207
+ value.each do |k, v|
208
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
209
+ end
210
+ end
211
+ else # model
212
+ # models (e.g. Pet) or oneOf
213
+ klass = StackOneHRIS.const_get(type)
214
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
215
+ end
216
+ end
217
+
218
+ # Returns the string representation of the object
219
+ # @return [String] String presentation of the object
220
+ def to_s
221
+ to_hash.to_s
222
+ end
223
+
224
+ # to_body is an alias to to_hash (backward compatibility)
225
+ # @return [Hash] Returns the object in the form of hash
226
+ def to_body
227
+ to_hash
228
+ end
229
+
230
+ # Returns the object in the form of hash
231
+ # @return [Hash] Returns the object in the form of hash
232
+ def to_hash
233
+ hash = {}
234
+ self.class.attribute_map.each_pair do |attr, param|
235
+ value = self.send(attr)
236
+ if value.nil?
237
+ is_nullable = self.class.openapi_nullable.include?(attr)
238
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
239
+ end
240
+
241
+ hash[param] = _to_hash(value)
242
+ end
243
+ hash
244
+ end
245
+
246
+ # Outputs non-array value in the form of hash
247
+ # For object, use to_hash. Otherwise, just return the value
248
+ # @param [Object] value Any valid value
249
+ # @return [Hash] Returns the value in the form of hash
250
+ def _to_hash(value)
251
+ if value.is_a?(Array)
252
+ value.compact.map { |v| _to_hash(v) }
253
+ elsif value.is_a?(Hash)
254
+ {}.tap do |hash|
255
+ value.each { |k, v| hash[k] = _to_hash(v) }
256
+ end
257
+ elsif value.respond_to? :to_hash
258
+ value.to_hash
259
+ else
260
+ value
261
+ end
262
+ end
263
+ end
264
+ end
@@ -111,8 +111,6 @@ module StackOneHRIS
111
111
  # @return true if the model is valid
112
112
  def valid?
113
113
  return false if @value.nil?
114
- value_validator = EnumAttributeValidator.new('String', ["active", "pending", "terminated", "leave", "unmapped_value"])
115
- return false unless value_validator.valid?(@value)
116
114
  return false if @source_value.nil?
117
115
  true
118
116
  end
@@ -120,10 +118,6 @@ module StackOneHRIS
120
118
  # Custom attribute writer method checking allowed values (enum).
121
119
  # @param [Object] value Object to be assigned
122
120
  def value=(value)
123
- validator = EnumAttributeValidator.new('String', ["active", "pending", "terminated", "leave", "unmapped_value"])
124
- unless validator.valid?(value)
125
- fail ArgumentError, "invalid value for \"value\", must be one of #{validator.allowable_values}."
126
- end
127
121
  @value = value
128
122
  end
129
123
 
@@ -111,8 +111,6 @@ module StackOneHRIS
111
111
  # @return true if the model is valid
112
112
  def valid?
113
113
  return false if @value.nil?
114
- value_validator = EnumAttributeValidator.new('String', ["full_time", "part_time", "contractor", "intern", "freelance", "terminated", "temporary", "seasonal", "volunteer", "probation", "internal", "external", "unmapped_value"])
115
- return false unless value_validator.valid?(@value)
116
114
  return false if @source_value.nil?
117
115
  true
118
116
  end
@@ -120,10 +118,6 @@ module StackOneHRIS
120
118
  # Custom attribute writer method checking allowed values (enum).
121
119
  # @param [Object] value Object to be assigned
122
120
  def value=(value)
123
- validator = EnumAttributeValidator.new('String', ["full_time", "part_time", "contractor", "intern", "freelance", "terminated", "temporary", "seasonal", "volunteer", "probation", "internal", "external", "unmapped_value"])
124
- unless validator.valid?(value)
125
- fail ArgumentError, "invalid value for \"value\", must be one of #{validator.allowable_values}."
126
- end
127
121
  @value = value
128
122
  end
129
123
 
@@ -111,8 +111,6 @@ module StackOneHRIS
111
111
  # @return true if the model is valid
112
112
  def valid?
113
113
  return false if @value.nil?
114
- value_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", "other", "unmapped_value"])
115
- return false unless value_validator.valid?(@value)
116
114
  return false if @source_value.nil?
117
115
  true
118
116
  end
@@ -120,10 +118,6 @@ module StackOneHRIS
120
118
  # Custom attribute writer method checking allowed values (enum).
121
119
  # @param [Object] value Object to be assigned
122
120
  def value=(value)
123
- 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", "other", "unmapped_value"])
124
- unless validator.valid?(value)
125
- fail ArgumentError, "invalid value for \"value\", must be one of #{validator.allowable_values}."
126
- end
127
121
  @value = value
128
122
  end
129
123
 
@@ -111,8 +111,6 @@ module StackOneHRIS
111
111
  # @return true if the model is valid
112
112
  def valid?
113
113
  return false if @value.nil?
114
- value_validator = EnumAttributeValidator.new('String', ["male", "female", "non_binary", "other", "not_disclosed", "diverse", "unmapped_value"])
115
- return false unless value_validator.valid?(@value)
116
114
  return false if @source_value.nil?
117
115
  true
118
116
  end
@@ -120,10 +118,6 @@ module StackOneHRIS
120
118
  # Custom attribute writer method checking allowed values (enum).
121
119
  # @param [Object] value Object to be assigned
122
120
  def value=(value)
123
- validator = EnumAttributeValidator.new('String', ["male", "female", "non_binary", "other", "not_disclosed", "diverse", "unmapped_value"])
124
- unless validator.valid?(value)
125
- fail ArgumentError, "invalid value for \"value\", must be one of #{validator.allowable_values}."
126
- end
127
121
  @value = value
128
122
  end
129
123