open_api_smart_recruiters_sdk 0.2.6 → 0.2.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/lib/smart_recruiters/api/application_api.rb +3 -3
  4. data/lib/smart_recruiters/api/users_api.rb +777 -0
  5. data/lib/smart_recruiters/api_client.rb +1 -0
  6. data/lib/smart_recruiters/models/actions.rb +3 -3
  7. data/lib/smart_recruiters/models/all_of_candidate_details_primary_assignment.rb +3 -3
  8. data/lib/smart_recruiters/models/all_of_candidate_details_secondary_assignments_items.rb +3 -3
  9. data/lib/smart_recruiters/models/application_attachment_webhook_payload.rb +3 -3
  10. data/lib/smart_recruiters/models/applications.rb +3 -3
  11. data/lib/smart_recruiters/models/callback_requests.rb +3 -3
  12. data/lib/smart_recruiters/models/dependent_job_property_value.rb +3 -3
  13. data/lib/smart_recruiters/models/hiring_team_member.rb +3 -3
  14. data/lib/smart_recruiters/models/hiring_team_member_response.rb +3 -3
  15. data/lib/smart_recruiters/models/interview_types.rb +3 -3
  16. data/lib/smart_recruiters/models/interviewers.rb +3 -3
  17. data/lib/smart_recruiters/models/job.rb +2 -1
  18. data/lib/smart_recruiters/models/job_ads.rb +3 -3
  19. data/lib/smart_recruiters/models/job_details.rb +25 -25
  20. data/lib/smart_recruiters/models/job_property_input.rb +3 -3
  21. data/lib/smart_recruiters/models/job_summary.rb +3 -3
  22. data/lib/smart_recruiters/models/json_patch.rb +3 -3
  23. data/lib/smart_recruiters/models/label_translations.rb +3 -3
  24. data/lib/smart_recruiters/models/messages_view.rb +3 -3
  25. data/lib/smart_recruiters/models/subscriptions.rb +3 -3
  26. data/lib/smart_recruiters/models/timeslots.rb +3 -3
  27. data/lib/smart_recruiters/models/user.rb +311 -0
  28. data/lib/smart_recruiters/models/user_entity.rb +367 -0
  29. data/lib/smart_recruiters/models/user_entity_access_groups.rb +204 -0
  30. data/lib/smart_recruiters/models/user_ids.rb +201 -0
  31. data/lib/smart_recruiters/models/user_language.rb +200 -0
  32. data/lib/smart_recruiters/models/user_language_code.rb +50 -0
  33. data/lib/smart_recruiters/models/user_list_item.rb +367 -0
  34. data/lib/smart_recruiters/models/user_list_item_access_groups.rb +195 -0
  35. data/lib/smart_recruiters/models/users.rb +213 -0
  36. data/lib/smart_recruiters/version.rb +1 -1
  37. metadata +12 -2
@@ -0,0 +1,311 @@
1
+ require 'date'
2
+
3
+ module SmartRecruiters
4
+ class User
5
+ attr_accessor :email
6
+
7
+ attr_accessor :first_name
8
+
9
+ attr_accessor :last_name
10
+
11
+ attr_accessor :system_role
12
+
13
+ attr_accessor :external_data
14
+
15
+ attr_accessor :sso_identifier
16
+
17
+ # User level login mode setting. Possible values are: - SSO - user can login only through SSO - PASSWORD - user can login only by password Notice: This setting _CAN_ be configured always, but it will be respected only if: - SSO is enabled at company level - employee level SSO configuration functionality is enabled for company
18
+ attr_accessor :sso_login_mode
19
+
20
+ attr_accessor :language
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
+ :'email' => :'email',
48
+ :'first_name' => :'firstName',
49
+ :'last_name' => :'lastName',
50
+ :'system_role' => :'systemRole',
51
+ :'external_data' => :'externalData',
52
+ :'sso_identifier' => :'ssoIdentifier',
53
+ :'sso_login_mode' => :'ssoLoginMode',
54
+ :'language' => :'language'
55
+ }
56
+ end
57
+
58
+ # Attribute type mapping.
59
+ def self.openapi_types
60
+ {
61
+ :'email' => :'Object',
62
+ :'first_name' => :'Object',
63
+ :'last_name' => :'Object',
64
+ :'system_role' => :'Object',
65
+ :'external_data' => :'Object',
66
+ :'sso_identifier' => :'Object',
67
+ :'sso_login_mode' => :'Object',
68
+ :'language' => :'Object'
69
+ }
70
+ end
71
+
72
+ # List of attributes with nullable: true
73
+ def self.openapi_nullable
74
+ Set.new([
75
+ :'external_data',
76
+ :'sso_identifier',
77
+ :'sso_login_mode',
78
+ ])
79
+ end
80
+
81
+ # Initializes the object
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ def initialize(attributes = {})
84
+ if (!attributes.is_a?(Hash))
85
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmartRecruiters::User` initialize method"
86
+ end
87
+
88
+ # check to see if the attribute exists and convert string to symbol for hash key
89
+ attributes = attributes.each_with_object({}) { |(k, v), h|
90
+ if (!self.class.attribute_map.key?(k.to_sym))
91
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmartRecruiters::User`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
92
+ end
93
+ h[k.to_sym] = v
94
+ }
95
+
96
+ if attributes.key?(:'email')
97
+ self.email = attributes[:'email']
98
+ end
99
+
100
+ if attributes.key?(:'first_name')
101
+ self.first_name = attributes[:'first_name']
102
+ end
103
+
104
+ if attributes.key?(:'last_name')
105
+ self.last_name = attributes[:'last_name']
106
+ end
107
+
108
+ if attributes.key?(:'system_role')
109
+ self.system_role = attributes[:'system_role']
110
+ end
111
+
112
+ if attributes.key?(:'external_data')
113
+ self.external_data = attributes[:'external_data']
114
+ end
115
+
116
+ if attributes.key?(:'sso_identifier')
117
+ self.sso_identifier = attributes[:'sso_identifier']
118
+ end
119
+
120
+ if attributes.key?(:'sso_login_mode')
121
+ self.sso_login_mode = attributes[:'sso_login_mode']
122
+ end
123
+
124
+ if attributes.key?(:'language')
125
+ self.language = attributes[:'language']
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 @first_name.nil?
134
+ invalid_properties.push('invalid value for "first_name", first_name cannot be nil.')
135
+ end
136
+
137
+ if @last_name.nil?
138
+ invalid_properties.push('invalid value for "last_name", last_name cannot be nil.')
139
+ end
140
+
141
+ if @system_role.nil?
142
+ invalid_properties.push('invalid value for "system_role", system_role cannot be nil.')
143
+ end
144
+
145
+ invalid_properties
146
+ end
147
+
148
+ # Check to see if the all the properties in the model are valid
149
+ # @return true if the model is valid
150
+ def valid?
151
+ return false if @first_name.nil?
152
+ return false if @last_name.nil?
153
+ return false if @system_role.nil?
154
+ sso_login_mode_validator = EnumAttributeValidator.new('Object', ['SSO', 'PASSWORD'])
155
+ return false unless sso_login_mode_validator.valid?(@sso_login_mode)
156
+ true
157
+ end
158
+
159
+ # Custom attribute writer method checking allowed values (enum).
160
+ # @param [Object] sso_login_mode Object to be assigned
161
+ def sso_login_mode=(sso_login_mode)
162
+ validator = EnumAttributeValidator.new('Object', ['SSO', 'PASSWORD'])
163
+ unless validator.valid?(sso_login_mode)
164
+ fail ArgumentError, "invalid value for \"sso_login_mode\", must be one of #{validator.allowable_values}."
165
+ end
166
+ @sso_login_mode = sso_login_mode
167
+ end
168
+
169
+ # Checks equality by comparing each attribute.
170
+ # @param [Object] Object to be compared
171
+ def ==(o)
172
+ return true if self.equal?(o)
173
+ self.class == o.class &&
174
+ email == o.email &&
175
+ first_name == o.first_name &&
176
+ last_name == o.last_name &&
177
+ system_role == o.system_role &&
178
+ external_data == o.external_data &&
179
+ sso_identifier == o.sso_identifier &&
180
+ sso_login_mode == o.sso_login_mode &&
181
+ language == o.language
182
+ end
183
+
184
+ # @see the `==` method
185
+ # @param [Object] Object to be compared
186
+ def eql?(o)
187
+ self == o
188
+ end
189
+
190
+ # Calculates hash code according to all attributes.
191
+ # @return [Integer] Hash code
192
+ def hash
193
+ [email, first_name, last_name, system_role, external_data, sso_identifier, sso_login_mode, language].hash
194
+ end
195
+
196
+ # Builds the object from hash
197
+ # @param [Hash] attributes Model attributes in the form of hash
198
+ # @return [Object] Returns the model itself
199
+ def self.build_from_hash(attributes)
200
+ new.build_from_hash(attributes)
201
+ end
202
+
203
+ # Builds the object from hash
204
+ # @param [Hash] attributes Model attributes in the form of hash
205
+ # @return [Object] Returns the model itself
206
+ def build_from_hash(attributes)
207
+ return nil unless attributes.is_a?(Hash)
208
+ self.class.openapi_types.each_pair do |key, type|
209
+ if type =~ /\AArray<(.*)>/i
210
+ # check to ensure the input is an array given that the attribute
211
+ # is documented as an array but the input is not
212
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
213
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
214
+ end
215
+ elsif !attributes[self.class.attribute_map[key]].nil?
216
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
217
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
218
+ self.send("#{key}=", nil)
219
+ end
220
+ end
221
+
222
+ self
223
+ end
224
+
225
+ # Deserializes the data based on type
226
+ # @param string type Data type
227
+ # @param string value Value to be deserialized
228
+ # @return [Object] Deserialized data
229
+ def _deserialize(type, value)
230
+ case type.to_sym
231
+ when :DateTime
232
+ DateTime.parse(value)
233
+ when :Date
234
+ Date.parse(value)
235
+ when :String
236
+ value.to_s
237
+ when :Integer
238
+ value.to_i
239
+ when :Float
240
+ value.to_f
241
+ when :Boolean
242
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
243
+ true
244
+ else
245
+ false
246
+ end
247
+ when :Object
248
+ # generic object (usually a Hash), return directly
249
+ value
250
+ when /\AArray<(?<inner_type>.+)>\z/
251
+ inner_type = Regexp.last_match[:inner_type]
252
+ value.map { |v| _deserialize(inner_type, v) }
253
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
254
+ k_type = Regexp.last_match[:k_type]
255
+ v_type = Regexp.last_match[:v_type]
256
+ {}.tap do |hash|
257
+ value.each do |k, v|
258
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
259
+ end
260
+ end
261
+ else # model
262
+ SmartRecruiters.const_get(type).build_from_hash(value)
263
+ end
264
+ end
265
+
266
+ # Returns the string representation of the object
267
+ # @return [String] String presentation of the object
268
+ def to_s
269
+ to_hash.to_s
270
+ end
271
+
272
+ # to_body is an alias to to_hash (backward compatibility)
273
+ # @return [Hash] Returns the object in the form of hash
274
+ def to_body
275
+ to_hash
276
+ end
277
+
278
+ # Returns the object in the form of hash
279
+ # @return [Hash] Returns the object in the form of hash
280
+ def to_hash
281
+ hash = {}
282
+ self.class.attribute_map.each_pair do |attr, param|
283
+ value = self.send(attr)
284
+ if value.nil?
285
+ is_nullable = self.class.openapi_nullable.include?(attr)
286
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
287
+ end
288
+
289
+ hash[param] = _to_hash(value)
290
+ end
291
+ hash
292
+ end
293
+
294
+ # Outputs non-array value in the form of hash
295
+ # For object, use to_hash. Otherwise, just return the value
296
+ # @param [Object] value Any valid value
297
+ # @return [Hash] Returns the value in the form of hash
298
+ def _to_hash(value)
299
+ if value.is_a?(Array)
300
+ value.compact.map { |v| _to_hash(v) }
301
+ elsif value.is_a?(Hash)
302
+ {}.tap do |hash|
303
+ value.each { |k, v| hash[k] = _to_hash(v) }
304
+ end
305
+ elsif value.respond_to? :to_hash
306
+ value.to_hash
307
+ else
308
+ value
309
+ end
310
+ end end
311
+ end
@@ -0,0 +1,367 @@
1
+ require 'date'
2
+
3
+ module SmartRecruiters
4
+ class UserEntity
5
+ attr_accessor :email
6
+
7
+ attr_accessor :first_name
8
+
9
+ attr_accessor :last_name
10
+
11
+ attr_accessor :system_role
12
+
13
+ attr_accessor :external_data
14
+
15
+ attr_accessor :sso_identifier
16
+
17
+ # User level login mode setting. Possible values are: - SSO - user can login only through SSO - PASSWORD - user can login only by password Notice: This setting _CAN_ be configured always, but it will be respected only if: - SSO is enabled at company level - employee level SSO configuration functionality is enabled for company
18
+ attr_accessor :sso_login_mode
19
+
20
+ attr_accessor :language
21
+
22
+ attr_accessor :id
23
+
24
+ attr_accessor :active
25
+
26
+ attr_accessor :updated_on
27
+
28
+ attr_accessor :location
29
+
30
+ attr_accessor :access_groups
31
+
32
+ attr_accessor :seats
33
+
34
+ class EnumAttributeValidator
35
+ attr_reader :datatype
36
+ attr_reader :allowable_values
37
+
38
+ def initialize(datatype, allowable_values)
39
+ @allowable_values = allowable_values.map do |value|
40
+ case datatype.to_s
41
+ when /Integer/i
42
+ value.to_i
43
+ when /Float/i
44
+ value.to_f
45
+ else
46
+ value
47
+ end
48
+ end
49
+ end
50
+
51
+ def valid?(value)
52
+ !value || allowable_values.include?(value)
53
+ end
54
+ end
55
+
56
+ # Attribute mapping from ruby-style variable name to JSON key.
57
+ def self.attribute_map
58
+ {
59
+ :'email' => :'email',
60
+ :'first_name' => :'firstName',
61
+ :'last_name' => :'lastName',
62
+ :'system_role' => :'systemRole',
63
+ :'external_data' => :'externalData',
64
+ :'sso_identifier' => :'ssoIdentifier',
65
+ :'sso_login_mode' => :'ssoLoginMode',
66
+ :'language' => :'language',
67
+ :'id' => :'id',
68
+ :'active' => :'active',
69
+ :'updated_on' => :'updatedOn',
70
+ :'location' => :'location',
71
+ :'access_groups' => :'accessGroups',
72
+ :'seats' => :'seats'
73
+ }
74
+ end
75
+
76
+ # Attribute type mapping.
77
+ def self.openapi_types
78
+ {
79
+ :'email' => :'Object',
80
+ :'first_name' => :'Object',
81
+ :'last_name' => :'Object',
82
+ :'system_role' => :'Object',
83
+ :'external_data' => :'Object',
84
+ :'sso_identifier' => :'Object',
85
+ :'sso_login_mode' => :'Object',
86
+ :'language' => :'Object',
87
+ :'id' => :'Object',
88
+ :'active' => :'Object',
89
+ :'updated_on' => :'Object',
90
+ :'location' => :'Object',
91
+ :'access_groups' => :'Object',
92
+ :'seats' => :'Object'
93
+ }
94
+ end
95
+
96
+ # List of attributes with nullable: true
97
+ def self.openapi_nullable
98
+ Set.new([
99
+ :'external_data',
100
+ :'sso_identifier',
101
+ :'sso_login_mode',
102
+ ])
103
+ end
104
+
105
+ # Initializes the object
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ def initialize(attributes = {})
108
+ if (!attributes.is_a?(Hash))
109
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmartRecruiters::UserEntity` initialize method"
110
+ end
111
+
112
+ # check to see if the attribute exists and convert string to symbol for hash key
113
+ attributes = attributes.each_with_object({}) { |(k, v), h|
114
+ if (!self.class.attribute_map.key?(k.to_sym))
115
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmartRecruiters::UserEntity`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
116
+ end
117
+ h[k.to_sym] = v
118
+ }
119
+
120
+ if attributes.key?(:'email')
121
+ self.email = attributes[:'email']
122
+ end
123
+
124
+ if attributes.key?(:'first_name')
125
+ self.first_name = attributes[:'first_name']
126
+ end
127
+
128
+ if attributes.key?(:'last_name')
129
+ self.last_name = attributes[:'last_name']
130
+ end
131
+
132
+ if attributes.key?(:'system_role')
133
+ self.system_role = attributes[:'system_role']
134
+ end
135
+
136
+ if attributes.key?(:'external_data')
137
+ self.external_data = attributes[:'external_data']
138
+ end
139
+
140
+ if attributes.key?(:'sso_identifier')
141
+ self.sso_identifier = attributes[:'sso_identifier']
142
+ end
143
+
144
+ if attributes.key?(:'sso_login_mode')
145
+ self.sso_login_mode = attributes[:'sso_login_mode']
146
+ end
147
+
148
+ if attributes.key?(:'language')
149
+ self.language = attributes[:'language']
150
+ end
151
+
152
+ if attributes.key?(:'id')
153
+ self.id = attributes[:'id']
154
+ end
155
+
156
+ if attributes.key?(:'active')
157
+ self.active = attributes[:'active']
158
+ end
159
+
160
+ if attributes.key?(:'updated_on')
161
+ self.updated_on = attributes[:'updated_on']
162
+ end
163
+
164
+ if attributes.key?(:'location')
165
+ self.location = attributes[:'location']
166
+ end
167
+
168
+ if attributes.key?(:'access_groups')
169
+ if (value = attributes[:'access_groups']).is_a?(Array)
170
+ self.access_groups = value
171
+ end
172
+ end
173
+
174
+ if attributes.key?(:'seats')
175
+ self.seats = attributes[:'seats']
176
+ end
177
+ end
178
+
179
+ # Show invalid properties with the reasons. Usually used together with valid?
180
+ # @return Array for valid properties with the reasons
181
+ def list_invalid_properties
182
+ invalid_properties = Array.new
183
+ if @first_name.nil?
184
+ invalid_properties.push('invalid value for "first_name", first_name cannot be nil.')
185
+ end
186
+
187
+ if @last_name.nil?
188
+ invalid_properties.push('invalid value for "last_name", last_name cannot be nil.')
189
+ end
190
+
191
+ if @system_role.nil?
192
+ invalid_properties.push('invalid value for "system_role", system_role cannot be nil.')
193
+ end
194
+
195
+ invalid_properties
196
+ end
197
+
198
+ # Check to see if the all the properties in the model are valid
199
+ # @return true if the model is valid
200
+ def valid?
201
+ return false if @first_name.nil?
202
+ return false if @last_name.nil?
203
+ return false if @system_role.nil?
204
+ sso_login_mode_validator = EnumAttributeValidator.new('', ['SSO', 'PASSWORD'])
205
+ return false unless sso_login_mode_validator.valid?(@sso_login_mode)
206
+ true
207
+ end
208
+
209
+ # Custom attribute writer method checking allowed values (enum).
210
+ # @param [Object] sso_login_mode Object to be assigned
211
+ def sso_login_mode=(sso_login_mode)
212
+ validator = EnumAttributeValidator.new('', ['SSO', 'PASSWORD'])
213
+ unless validator.valid?(sso_login_mode)
214
+ fail ArgumentError, "invalid value for \"sso_login_mode\", must be one of #{validator.allowable_values}."
215
+ end
216
+ @sso_login_mode = sso_login_mode
217
+ end
218
+
219
+ # Checks equality by comparing each attribute.
220
+ # @param [Object] Object to be compared
221
+ def ==(o)
222
+ return true if self.equal?(o)
223
+ self.class == o.class &&
224
+ email == o.email &&
225
+ first_name == o.first_name &&
226
+ last_name == o.last_name &&
227
+ system_role == o.system_role &&
228
+ external_data == o.external_data &&
229
+ sso_identifier == o.sso_identifier &&
230
+ sso_login_mode == o.sso_login_mode &&
231
+ language == o.language &&
232
+ id == o.id &&
233
+ active == o.active &&
234
+ updated_on == o.updated_on &&
235
+ location == o.location &&
236
+ access_groups == o.access_groups &&
237
+ seats == o.seats
238
+ end
239
+
240
+ # @see the `==` method
241
+ # @param [Object] Object to be compared
242
+ def eql?(o)
243
+ self == o
244
+ end
245
+
246
+ # Calculates hash code according to all attributes.
247
+ # @return [Integer] Hash code
248
+ def hash
249
+ [email, first_name, last_name, system_role, external_data, sso_identifier, sso_login_mode, language, id, active, updated_on, location, access_groups, seats].hash
250
+ end
251
+
252
+ # Builds the object from hash
253
+ # @param [Hash] attributes Model attributes in the form of hash
254
+ # @return [Object] Returns the model itself
255
+ def self.build_from_hash(attributes)
256
+ new.build_from_hash(attributes)
257
+ end
258
+
259
+ # Builds the object from hash
260
+ # @param [Hash] attributes Model attributes in the form of hash
261
+ # @return [Object] Returns the model itself
262
+ def build_from_hash(attributes)
263
+ return nil unless attributes.is_a?(Hash)
264
+ self.class.openapi_types.each_pair do |key, type|
265
+ if type =~ /\AArray<(.*)>/i
266
+ # check to ensure the input is an array given that the attribute
267
+ # is documented as an array but the input is not
268
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
269
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
270
+ end
271
+ elsif !attributes[self.class.attribute_map[key]].nil?
272
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
273
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
274
+ self.send("#{key}=", nil)
275
+ end
276
+ end
277
+
278
+ self
279
+ end
280
+
281
+ # Deserializes the data based on type
282
+ # @param string type Data type
283
+ # @param string value Value to be deserialized
284
+ # @return [Object] Deserialized data
285
+ def _deserialize(type, value)
286
+ case type.to_sym
287
+ when :DateTime
288
+ DateTime.parse(value)
289
+ when :Date
290
+ Date.parse(value)
291
+ when :String
292
+ value.to_s
293
+ when :Integer
294
+ value.to_i
295
+ when :Float
296
+ value.to_f
297
+ when :Boolean
298
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
299
+ true
300
+ else
301
+ false
302
+ end
303
+ when :Object
304
+ # generic object (usually a Hash), return directly
305
+ value
306
+ when /\AArray<(?<inner_type>.+)>\z/
307
+ inner_type = Regexp.last_match[:inner_type]
308
+ value.map { |v| _deserialize(inner_type, v) }
309
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
310
+ k_type = Regexp.last_match[:k_type]
311
+ v_type = Regexp.last_match[:v_type]
312
+ {}.tap do |hash|
313
+ value.each do |k, v|
314
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
315
+ end
316
+ end
317
+ else # model
318
+ SmartRecruiters.const_get(type).build_from_hash(value)
319
+ end
320
+ end
321
+
322
+ # Returns the string representation of the object
323
+ # @return [String] String presentation of the object
324
+ def to_s
325
+ to_hash.to_s
326
+ end
327
+
328
+ # to_body is an alias to to_hash (backward compatibility)
329
+ # @return [Hash] Returns the object in the form of hash
330
+ def to_body
331
+ to_hash
332
+ end
333
+
334
+ # Returns the object in the form of hash
335
+ # @return [Hash] Returns the object in the form of hash
336
+ def to_hash
337
+ hash = {}
338
+ self.class.attribute_map.each_pair do |attr, param|
339
+ value = self.send(attr)
340
+ if value.nil?
341
+ is_nullable = self.class.openapi_nullable.include?(attr)
342
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
343
+ end
344
+
345
+ hash[param] = _to_hash(value)
346
+ end
347
+ hash
348
+ end
349
+
350
+ # Outputs non-array value in the form of hash
351
+ # For object, use to_hash. Otherwise, just return the value
352
+ # @param [Object] value Any valid value
353
+ # @return [Hash] Returns the value in the form of hash
354
+ def _to_hash(value)
355
+ if value.is_a?(Array)
356
+ value.compact.map { |v| _to_hash(v) }
357
+ elsif value.is_a?(Hash)
358
+ {}.tap do |hash|
359
+ value.each { |k, v| hash[k] = _to_hash(v) }
360
+ end
361
+ elsif value.respond_to? :to_hash
362
+ value.to_hash
363
+ else
364
+ value
365
+ end
366
+ end end
367
+ end