open_api_smart_recruiters_sdk 0.2.3 → 0.2.5

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 (38) hide show
  1. checksums.yaml +4 -4
  2. data/.DS_Store +0 -0
  3. data/Gemfile.lock +1 -1
  4. data/lib/.DS_Store +0 -0
  5. data/lib/smart_recruiters/.DS_Store +0 -0
  6. data/lib/smart_recruiters/api/interview_types_api.rb +169 -0
  7. data/lib/smart_recruiters/api/interviews_api.rb +296 -0
  8. data/lib/smart_recruiters/api/messages_api.rb +187 -0
  9. data/lib/smart_recruiters/api/statuses_api.rb +215 -0
  10. data/lib/smart_recruiters/api/timeslots_api.rb +261 -0
  11. data/lib/smart_recruiters/api_client.rb +1 -2
  12. data/lib/smart_recruiters/authorization.rb +11 -1
  13. data/lib/smart_recruiters/configuration.rb +1 -1
  14. data/lib/smart_recruiters/models/applications.rb +192 -0
  15. data/lib/smart_recruiters/models/attendee_status.rb +202 -0
  16. data/lib/smart_recruiters/models/attendee_status_value.rb +21 -0
  17. data/lib/smart_recruiters/models/candidate_attendee_status_value.rb +22 -0
  18. data/lib/smart_recruiters/models/context.rb +197 -0
  19. data/lib/smart_recruiters/models/interview.rb +305 -0
  20. data/lib/smart_recruiters/models/interview_to_update_input.rb +216 -0
  21. data/lib/smart_recruiters/models/interview_type.rb +188 -0
  22. data/lib/smart_recruiters/models/interview_types.rb +192 -0
  23. data/lib/smart_recruiters/models/interviewer.rb +216 -0
  24. data/lib/smart_recruiters/models/interviewers.rb +192 -0
  25. data/lib/smart_recruiters/models/interviews_list.rb +199 -0
  26. data/lib/smart_recruiters/models/message.rb +222 -0
  27. data/lib/smart_recruiters/models/message_details.rb +206 -0
  28. data/lib/smart_recruiters/models/message_view.rb +233 -0
  29. data/lib/smart_recruiters/models/messages_view.rb +192 -0
  30. data/lib/smart_recruiters/models/share_with.rb +233 -0
  31. data/lib/smart_recruiters/models/timeslot.rb +275 -0
  32. data/lib/smart_recruiters/models/timeslots.rb +192 -0
  33. data/lib/smart_recruiters/models/user_id.rb +189 -0
  34. data/lib/smart_recruiters/models/uuid_read_only.rb +188 -0
  35. data/lib/smart_recruiters/models/visibility.rb +21 -0
  36. data/lib/smart_recruiters/version.rb +1 -1
  37. data/lib/smart_recruiters.rb +2 -19
  38. metadata +32 -2
@@ -0,0 +1,305 @@
1
+
2
+
3
+ require 'date'
4
+
5
+ module SmartRecruiters
6
+ class Interview
7
+ attr_accessor :id
8
+
9
+ attr_accessor :candidate
10
+
11
+ attr_accessor :job_id
12
+
13
+ attr_accessor :location
14
+
15
+ attr_accessor :organizer_id
16
+
17
+ # Name of the timezone as described in TZ database
18
+ attr_accessor :timezone
19
+
20
+ attr_accessor :timeslots
21
+
22
+ # If not set it defaults to current time
23
+ attr_accessor :created_on
24
+
25
+ attr_accessor :ref_url
26
+
27
+ attr_accessor :source
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'id' => :'id',
33
+ :'candidate' => :'candidate',
34
+ :'job_id' => :'jobId',
35
+ :'location' => :'location',
36
+ :'organizer_id' => :'organizerId',
37
+ :'timezone' => :'timezone',
38
+ :'timeslots' => :'timeslots',
39
+ :'created_on' => :'createdOn',
40
+ :'ref_url' => :'refUrl',
41
+ :'source' => :'source'
42
+ }
43
+ end
44
+
45
+ # Attribute type mapping.
46
+ def self.openapi_types
47
+ {
48
+ :'id' => :'Object',
49
+ :'candidate' => :'Object',
50
+ :'job_id' => :'Object',
51
+ :'location' => :'Object',
52
+ :'organizer_id' => :'Object',
53
+ :'timezone' => :'Object',
54
+ :'timeslots' => :'Object',
55
+ :'created_on' => :'Object',
56
+ :'ref_url' => :'Object',
57
+ :'source' => :'Object'
58
+ }
59
+ end
60
+
61
+ # List of attributes with nullable: true
62
+ def self.openapi_nullable
63
+ Set.new([
64
+ ])
65
+ end
66
+
67
+ # Initializes the object
68
+ # @param [Hash] attributes Model attributes in the form of hash
69
+ def initialize(attributes = {})
70
+ if (!attributes.is_a?(Hash))
71
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmartRecruiters::Interview` initialize method"
72
+ end
73
+
74
+ # check to see if the attribute exists and convert string to symbol for hash key
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!self.class.attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmartRecruiters::Interview`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'id')
83
+ self.id = attributes[:'id']
84
+ end
85
+
86
+ if attributes.key?(:'candidate')
87
+ self.candidate = attributes[:'candidate']
88
+ end
89
+
90
+ if attributes.key?(:'job_id')
91
+ self.job_id = attributes[:'job_id']
92
+ end
93
+
94
+ if attributes.key?(:'location')
95
+ self.location = attributes[:'location']
96
+ end
97
+
98
+ if attributes.key?(:'organizer_id')
99
+ self.organizer_id = attributes[:'organizer_id']
100
+ end
101
+
102
+ if attributes.key?(:'timezone')
103
+ self.timezone = attributes[:'timezone']
104
+ end
105
+
106
+ if attributes.key?(:'timeslots')
107
+ self.timeslots = attributes[:'timeslots']
108
+ end
109
+
110
+ if attributes.key?(:'created_on')
111
+ self.created_on = attributes[:'created_on']
112
+ end
113
+
114
+ if attributes.key?(:'ref_url')
115
+ self.ref_url = attributes[:'ref_url']
116
+ end
117
+
118
+ if attributes.key?(:'source')
119
+ self.source = attributes[:'source']
120
+ end
121
+ end
122
+
123
+ # Show invalid properties with the reasons. Usually used together with valid?
124
+ # @return Array for valid properties with the reasons
125
+ def list_invalid_properties
126
+ invalid_properties = Array.new
127
+ if @candidate.nil?
128
+ invalid_properties.push('invalid value for "candidate", candidate cannot be nil.')
129
+ end
130
+
131
+ if @job_id.nil?
132
+ invalid_properties.push('invalid value for "job_id", job_id cannot be nil.')
133
+ end
134
+
135
+ if @organizer_id.nil?
136
+ invalid_properties.push('invalid value for "organizer_id", organizer_id cannot be nil.')
137
+ end
138
+
139
+ if @timezone.nil?
140
+ invalid_properties.push('invalid value for "timezone", timezone cannot be nil.')
141
+ end
142
+
143
+ if @timeslots.nil?
144
+ invalid_properties.push('invalid value for "timeslots", timeslots cannot be nil.')
145
+ end
146
+
147
+ invalid_properties
148
+ end
149
+
150
+ # Check to see if the all the properties in the model are valid
151
+ # @return true if the model is valid
152
+ def valid?
153
+ return false if @candidate.nil?
154
+ return false if @job_id.nil?
155
+ return false if @organizer_id.nil?
156
+ return false if @timezone.nil?
157
+ return false if @timeslots.nil?
158
+ true
159
+ end
160
+
161
+ # Checks equality by comparing each attribute.
162
+ # @param [Object] Object to be compared
163
+ def ==(o)
164
+ return true if self.equal?(o)
165
+ self.class == o.class &&
166
+ id == o.id &&
167
+ candidate == o.candidate &&
168
+ job_id == o.job_id &&
169
+ location == o.location &&
170
+ organizer_id == o.organizer_id &&
171
+ timezone == o.timezone &&
172
+ timeslots == o.timeslots &&
173
+ created_on == o.created_on &&
174
+ ref_url == o.ref_url &&
175
+ source == o.source
176
+ end
177
+
178
+ # @see the `==` method
179
+ # @param [Object] Object to be compared
180
+ def eql?(o)
181
+ self == o
182
+ end
183
+
184
+ # Calculates hash code according to all attributes.
185
+ # @return [Integer] Hash code
186
+ def hash
187
+ [id, candidate, job_id, location, organizer_id, timezone, timeslots, created_on, ref_url, source].hash
188
+ end
189
+
190
+ # Builds the object from hash
191
+ # @param [Hash] attributes Model attributes in the form of hash
192
+ # @return [Object] Returns the model itself
193
+ def self.build_from_hash(attributes)
194
+ new.build_from_hash(attributes)
195
+ end
196
+
197
+ # Builds the object from hash
198
+ # @param [Hash] attributes Model attributes in the form of hash
199
+ # @return [Object] Returns the model itself
200
+ def build_from_hash(attributes)
201
+ return nil unless attributes.is_a?(Hash)
202
+ self.class.openapi_types.each_pair do |key, type|
203
+ if type =~ /\AArray<(.*)>/i
204
+ # check to ensure the input is an array given that the attribute
205
+ # is documented as an array but the input is not
206
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
207
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
208
+ end
209
+ elsif !attributes[self.class.attribute_map[key]].nil?
210
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
211
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
212
+ self.send("#{key}=", nil)
213
+ end
214
+ end
215
+
216
+ self
217
+ end
218
+
219
+ # Deserializes the data based on type
220
+ # @param string type Data type
221
+ # @param string value Value to be deserialized
222
+ # @return [Object] Deserialized data
223
+ def _deserialize(type, value)
224
+ case type.to_sym
225
+ when :DateTime
226
+ DateTime.parse(value)
227
+ when :Date
228
+ Date.parse(value)
229
+ when :String
230
+ value.to_s
231
+ when :Integer
232
+ value.to_i
233
+ when :Float
234
+ value.to_f
235
+ when :Boolean
236
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
237
+ true
238
+ else
239
+ false
240
+ end
241
+ when :Object
242
+ # generic object (usually a Hash), return directly
243
+ value
244
+ when /\AArray<(?<inner_type>.+)>\z/
245
+ inner_type = Regexp.last_match[:inner_type]
246
+ value.map { |v| _deserialize(inner_type, v) }
247
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
248
+ k_type = Regexp.last_match[:k_type]
249
+ v_type = Regexp.last_match[:v_type]
250
+ {}.tap do |hash|
251
+ value.each do |k, v|
252
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
253
+ end
254
+ end
255
+ else # model
256
+ SmartRecruiters.const_get(type).build_from_hash(value)
257
+ end
258
+ end
259
+
260
+ # Returns the string representation of the object
261
+ # @return [String] String presentation of the object
262
+ def to_s
263
+ to_hash.to_s
264
+ end
265
+
266
+ # to_body is an alias to to_hash (backward compatibility)
267
+ # @return [Hash] Returns the object in the form of hash
268
+ def to_body
269
+ to_hash
270
+ end
271
+
272
+ # Returns the object in the form of hash
273
+ # @return [Hash] Returns the object in the form of hash
274
+ def to_hash
275
+ hash = {}
276
+ self.class.attribute_map.each_pair do |attr, param|
277
+ value = self.send(attr)
278
+ if value.nil?
279
+ is_nullable = self.class.openapi_nullable.include?(attr)
280
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
281
+ end
282
+
283
+ hash[param] = _to_hash(value)
284
+ end
285
+ hash
286
+ end
287
+
288
+ # Outputs non-array value in the form of hash
289
+ # For object, use to_hash. Otherwise, just return the value
290
+ # @param [Object] value Any valid value
291
+ # @return [Hash] Returns the value in the form of hash
292
+ def _to_hash(value)
293
+ if value.is_a?(Array)
294
+ value.compact.map { |v| _to_hash(v) }
295
+ elsif value.is_a?(Hash)
296
+ {}.tap do |hash|
297
+ value.each { |k, v| hash[k] = _to_hash(v) }
298
+ end
299
+ elsif value.respond_to? :to_hash
300
+ value.to_hash
301
+ else
302
+ value
303
+ end
304
+ end end
305
+ end
@@ -0,0 +1,216 @@
1
+
2
+
3
+ require 'date'
4
+
5
+ module SmartRecruiters
6
+ class InterviewToUpdateInput
7
+ attr_accessor :location
8
+
9
+ # Name of the timezone as described in TZ database
10
+ attr_accessor :timezone
11
+
12
+ attr_accessor :candidate
13
+
14
+ # Attribute mapping from ruby-style variable name to JSON key.
15
+ def self.attribute_map
16
+ {
17
+ :'location' => :'location',
18
+ :'timezone' => :'timezone',
19
+ :'candidate' => :'candidate'
20
+ }
21
+ end
22
+
23
+ # Attribute type mapping.
24
+ def self.openapi_types
25
+ {
26
+ :'location' => :'Object',
27
+ :'timezone' => :'Object',
28
+ :'candidate' => :'Object'
29
+ }
30
+ end
31
+
32
+ # List of attributes with nullable: true
33
+ def self.openapi_nullable
34
+ Set.new([
35
+ ])
36
+ end
37
+
38
+ # Initializes the object
39
+ # @param [Hash] attributes Model attributes in the form of hash
40
+ def initialize(attributes = {})
41
+ if (!attributes.is_a?(Hash))
42
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmartRecruiters::InterviewToUpdateInput` initialize method"
43
+ end
44
+
45
+ # check to see if the attribute exists and convert string to symbol for hash key
46
+ attributes = attributes.each_with_object({}) { |(k, v), h|
47
+ if (!self.class.attribute_map.key?(k.to_sym))
48
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmartRecruiters::InterviewToUpdateInput`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
49
+ end
50
+ h[k.to_sym] = v
51
+ }
52
+
53
+ if attributes.key?(:'location')
54
+ self.location = attributes[:'location']
55
+ end
56
+
57
+ if attributes.key?(:'timezone')
58
+ self.timezone = attributes[:'timezone']
59
+ end
60
+
61
+ if attributes.key?(:'candidate')
62
+ self.candidate = attributes[:'candidate']
63
+ end
64
+ end
65
+
66
+ # Show invalid properties with the reasons. Usually used together with valid?
67
+ # @return Array for valid properties with the reasons
68
+ def list_invalid_properties
69
+ invalid_properties = Array.new
70
+ invalid_properties
71
+ end
72
+
73
+ # Check to see if the all the properties in the model are valid
74
+ # @return true if the model is valid
75
+ def valid?
76
+ true
77
+ end
78
+
79
+ # Checks equality by comparing each attribute.
80
+ # @param [Object] Object to be compared
81
+ def ==(o)
82
+ return true if self.equal?(o)
83
+ self.class == o.class &&
84
+ location == o.location &&
85
+ timezone == o.timezone &&
86
+ candidate == o.candidate
87
+ end
88
+
89
+ # @see the `==` method
90
+ # @param [Object] Object to be compared
91
+ def eql?(o)
92
+ self == o
93
+ end
94
+
95
+ # Calculates hash code according to all attributes.
96
+ # @return [Integer] Hash code
97
+ def hash
98
+ [location, timezone, candidate].hash
99
+ end
100
+
101
+ # Builds the object from hash
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ # @return [Object] Returns the model itself
104
+ def self.build_from_hash(attributes)
105
+ new.build_from_hash(attributes)
106
+ end
107
+
108
+ # Builds the object from hash
109
+ # @param [Hash] attributes Model attributes in the form of hash
110
+ # @return [Object] Returns the model itself
111
+ def build_from_hash(attributes)
112
+ return nil unless attributes.is_a?(Hash)
113
+ self.class.openapi_types.each_pair do |key, type|
114
+ if type =~ /\AArray<(.*)>/i
115
+ # check to ensure the input is an array given that the attribute
116
+ # is documented as an array but the input is not
117
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
118
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
119
+ end
120
+ elsif !attributes[self.class.attribute_map[key]].nil?
121
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
122
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
123
+ self.send("#{key}=", nil)
124
+ end
125
+ end
126
+
127
+ self
128
+ end
129
+
130
+ # Deserializes the data based on type
131
+ # @param string type Data type
132
+ # @param string value Value to be deserialized
133
+ # @return [Object] Deserialized data
134
+ def _deserialize(type, value)
135
+ case type.to_sym
136
+ when :DateTime
137
+ DateTime.parse(value)
138
+ when :Date
139
+ Date.parse(value)
140
+ when :String
141
+ value.to_s
142
+ when :Integer
143
+ value.to_i
144
+ when :Float
145
+ value.to_f
146
+ when :Boolean
147
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
148
+ true
149
+ else
150
+ false
151
+ end
152
+ when :Object
153
+ # generic object (usually a Hash), return directly
154
+ value
155
+ when /\AArray<(?<inner_type>.+)>\z/
156
+ inner_type = Regexp.last_match[:inner_type]
157
+ value.map { |v| _deserialize(inner_type, v) }
158
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
159
+ k_type = Regexp.last_match[:k_type]
160
+ v_type = Regexp.last_match[:v_type]
161
+ {}.tap do |hash|
162
+ value.each do |k, v|
163
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
164
+ end
165
+ end
166
+ else # model
167
+ SmartRecruiters.const_get(type).build_from_hash(value)
168
+ end
169
+ end
170
+
171
+ # Returns the string representation of the object
172
+ # @return [String] String presentation of the object
173
+ def to_s
174
+ to_hash.to_s
175
+ end
176
+
177
+ # to_body is an alias to to_hash (backward compatibility)
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_body
180
+ to_hash
181
+ end
182
+
183
+ # Returns the object in the form of hash
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_hash
186
+ hash = {}
187
+ self.class.attribute_map.each_pair do |attr, param|
188
+ value = self.send(attr)
189
+ if value.nil?
190
+ is_nullable = self.class.openapi_nullable.include?(attr)
191
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
192
+ end
193
+
194
+ hash[param] = _to_hash(value)
195
+ end
196
+ hash
197
+ end
198
+
199
+ # Outputs non-array value in the form of hash
200
+ # For object, use to_hash. Otherwise, just return the value
201
+ # @param [Object] value Any valid value
202
+ # @return [Hash] Returns the value in the form of hash
203
+ def _to_hash(value)
204
+ if value.is_a?(Array)
205
+ value.compact.map { |v| _to_hash(v) }
206
+ elsif value.is_a?(Hash)
207
+ {}.tap do |hash|
208
+ value.each { |k, v| hash[k] = _to_hash(v) }
209
+ end
210
+ elsif value.respond_to? :to_hash
211
+ value.to_hash
212
+ else
213
+ value
214
+ end
215
+ end end
216
+ end
@@ -0,0 +1,188 @@
1
+
2
+
3
+ require 'date'
4
+
5
+ module SmartRecruiters
6
+ class InterviewType
7
+ # Attribute mapping from ruby-style variable name to JSON key.
8
+ def self.attribute_map
9
+ {
10
+ }
11
+ end
12
+
13
+ # Attribute type mapping.
14
+ def self.openapi_types
15
+ {
16
+ }
17
+ end
18
+
19
+ # List of attributes with nullable: true
20
+ def self.openapi_nullable
21
+ Set.new([
22
+ ])
23
+ end
24
+
25
+ # Initializes the object
26
+ # @param [Hash] attributes Model attributes in the form of hash
27
+ def initialize(attributes = {})
28
+ if (!attributes.is_a?(Hash))
29
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmartRecruiters::InterviewType` initialize method"
30
+ end
31
+
32
+ # check to see if the attribute exists and convert string to symbol for hash key
33
+ attributes = attributes.each_with_object({}) { |(k, v), h|
34
+ if (!self.class.attribute_map.key?(k.to_sym))
35
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmartRecruiters::InterviewType`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
36
+ end
37
+ h[k.to_sym] = v
38
+ }
39
+ end
40
+
41
+ # Show invalid properties with the reasons. Usually used together with valid?
42
+ # @return Array for valid properties with the reasons
43
+ def list_invalid_properties
44
+ invalid_properties = Array.new
45
+ invalid_properties
46
+ end
47
+
48
+ # Check to see if the all the properties in the model are valid
49
+ # @return true if the model is valid
50
+ def valid?
51
+ true
52
+ end
53
+
54
+ # Checks equality by comparing each attribute.
55
+ # @param [Object] Object to be compared
56
+ def ==(o)
57
+ return true if self.equal?(o)
58
+ self.class == o.class
59
+ end
60
+
61
+ # @see the `==` method
62
+ # @param [Object] Object to be compared
63
+ def eql?(o)
64
+ self == o
65
+ end
66
+
67
+ # Calculates hash code according to all attributes.
68
+ # @return [Integer] Hash code
69
+ def hash
70
+ [].hash
71
+ end
72
+
73
+ # Builds the object from hash
74
+ # @param [Hash] attributes Model attributes in the form of hash
75
+ # @return [Object] Returns the model itself
76
+ def self.build_from_hash(attributes)
77
+ new.build_from_hash(attributes)
78
+ end
79
+
80
+ # Builds the object from hash
81
+ # @param [Hash] attributes Model attributes in the form of hash
82
+ # @return [Object] Returns the model itself
83
+ def build_from_hash(attributes)
84
+ return nil unless attributes.is_a?(Hash)
85
+ self.class.openapi_types.each_pair do |key, type|
86
+ if type =~ /\AArray<(.*)>/i
87
+ # check to ensure the input is an array given that the attribute
88
+ # is documented as an array but the input is not
89
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
90
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
91
+ end
92
+ elsif !attributes[self.class.attribute_map[key]].nil?
93
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
94
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
95
+ self.send("#{key}=", nil)
96
+ end
97
+ end
98
+
99
+ self
100
+ end
101
+
102
+ # Deserializes the data based on type
103
+ # @param string type Data type
104
+ # @param string value Value to be deserialized
105
+ # @return [Object] Deserialized data
106
+ def _deserialize(type, value)
107
+ case type.to_sym
108
+ when :DateTime
109
+ DateTime.parse(value)
110
+ when :Date
111
+ Date.parse(value)
112
+ when :String
113
+ value.to_s
114
+ when :Integer
115
+ value.to_i
116
+ when :Float
117
+ value.to_f
118
+ when :Boolean
119
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
120
+ true
121
+ else
122
+ false
123
+ end
124
+ when :Object
125
+ # generic object (usually a Hash), return directly
126
+ value
127
+ when /\AArray<(?<inner_type>.+)>\z/
128
+ inner_type = Regexp.last_match[:inner_type]
129
+ value.map { |v| _deserialize(inner_type, v) }
130
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
131
+ k_type = Regexp.last_match[:k_type]
132
+ v_type = Regexp.last_match[:v_type]
133
+ {}.tap do |hash|
134
+ value.each do |k, v|
135
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
136
+ end
137
+ end
138
+ else # model
139
+ SmartRecruiters.const_get(type).build_from_hash(value)
140
+ end
141
+ end
142
+
143
+ # Returns the string representation of the object
144
+ # @return [String] String presentation of the object
145
+ def to_s
146
+ to_hash.to_s
147
+ end
148
+
149
+ # to_body is an alias to to_hash (backward compatibility)
150
+ # @return [Hash] Returns the object in the form of hash
151
+ def to_body
152
+ to_hash
153
+ end
154
+
155
+ # Returns the object in the form of hash
156
+ # @return [Hash] Returns the object in the form of hash
157
+ def to_hash
158
+ hash = {}
159
+ self.class.attribute_map.each_pair do |attr, param|
160
+ value = self.send(attr)
161
+ if value.nil?
162
+ is_nullable = self.class.openapi_nullable.include?(attr)
163
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
164
+ end
165
+
166
+ hash[param] = _to_hash(value)
167
+ end
168
+ hash
169
+ end
170
+
171
+ # Outputs non-array value in the form of hash
172
+ # For object, use to_hash. Otherwise, just return the value
173
+ # @param [Object] value Any valid value
174
+ # @return [Hash] Returns the value in the form of hash
175
+ def _to_hash(value)
176
+ if value.is_a?(Array)
177
+ value.compact.map { |v| _to_hash(v) }
178
+ elsif value.is_a?(Hash)
179
+ {}.tap do |hash|
180
+ value.each { |k, v| hash[k] = _to_hash(v) }
181
+ end
182
+ elsif value.respond_to? :to_hash
183
+ value.to_hash
184
+ else
185
+ value
186
+ end
187
+ end end
188
+ end