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