open_api_smart_recruiters_sdk 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/Gemfile.lock +1 -1
- data/lib/.DS_Store +0 -0
- data/lib/smart_recruiters/.DS_Store +0 -0
- data/lib/smart_recruiters/api/interview_types_api.rb +169 -0
- data/lib/smart_recruiters/api/interviews_api.rb +296 -0
- data/lib/smart_recruiters/api/messages_api.rb +187 -0
- data/lib/smart_recruiters/api/statuses_api.rb +215 -0
- data/lib/smart_recruiters/api/timeslots_api.rb +261 -0
- data/lib/smart_recruiters/configuration.rb +1 -1
- data/lib/smart_recruiters/models/applications.rb +192 -0
- data/lib/smart_recruiters/models/attendee_status.rb +202 -0
- data/lib/smart_recruiters/models/attendee_status_value.rb +21 -0
- data/lib/smart_recruiters/models/candidate_attendee_status_value.rb +22 -0
- data/lib/smart_recruiters/models/context.rb +197 -0
- data/lib/smart_recruiters/models/interview.rb +305 -0
- data/lib/smart_recruiters/models/interview_to_update_input.rb +216 -0
- data/lib/smart_recruiters/models/interview_type.rb +188 -0
- data/lib/smart_recruiters/models/interview_types.rb +192 -0
- data/lib/smart_recruiters/models/interviewer.rb +216 -0
- data/lib/smart_recruiters/models/interviewers.rb +192 -0
- data/lib/smart_recruiters/models/interviews_list.rb +199 -0
- data/lib/smart_recruiters/models/message.rb +222 -0
- data/lib/smart_recruiters/models/message_details.rb +206 -0
- data/lib/smart_recruiters/models/message_view.rb +233 -0
- data/lib/smart_recruiters/models/messages_view.rb +192 -0
- data/lib/smart_recruiters/models/share_with.rb +233 -0
- data/lib/smart_recruiters/models/timeslot.rb +275 -0
- data/lib/smart_recruiters/models/timeslots.rb +192 -0
- data/lib/smart_recruiters/models/user_id.rb +189 -0
- data/lib/smart_recruiters/models/uuid_read_only.rb +188 -0
- data/lib/smart_recruiters/models/visibility.rb +21 -0
- data/lib/smart_recruiters/version.rb +1 -1
- data/lib/smart_recruiters.rb +2 -19
- metadata +31 -1
@@ -0,0 +1,192 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
require 'date'
|
4
|
+
|
5
|
+
module SmartRecruiters
|
6
|
+
class InterviewTypes
|
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::InterviewTypes` 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::InterviewTypes`. 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
|
+
|
40
|
+
# call parent's initialize
|
41
|
+
super(attributes)
|
42
|
+
end
|
43
|
+
|
44
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
45
|
+
# @return Array for valid properties with the reasons
|
46
|
+
def list_invalid_properties
|
47
|
+
invalid_properties = super
|
48
|
+
invalid_properties
|
49
|
+
end
|
50
|
+
|
51
|
+
# Check to see if the all the properties in the model are valid
|
52
|
+
# @return true if the model is valid
|
53
|
+
def valid?
|
54
|
+
true
|
55
|
+
end
|
56
|
+
|
57
|
+
# Checks equality by comparing each attribute.
|
58
|
+
# @param [Object] Object to be compared
|
59
|
+
def ==(o)
|
60
|
+
return true if self.equal?(o)
|
61
|
+
self.class == o.class && super(o)
|
62
|
+
end
|
63
|
+
|
64
|
+
# @see the `==` method
|
65
|
+
# @param [Object] Object to be compared
|
66
|
+
def eql?(o)
|
67
|
+
self == o
|
68
|
+
end
|
69
|
+
|
70
|
+
# Calculates hash code according to all attributes.
|
71
|
+
# @return [Integer] Hash code
|
72
|
+
def hash
|
73
|
+
[].hash
|
74
|
+
end
|
75
|
+
|
76
|
+
# Builds the object from hash
|
77
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
78
|
+
# @return [Object] Returns the model itself
|
79
|
+
def self.build_from_hash(attributes)
|
80
|
+
new.build_from_hash(attributes)
|
81
|
+
end
|
82
|
+
|
83
|
+
# Builds the object from hash
|
84
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
85
|
+
# @return [Object] Returns the model itself
|
86
|
+
def build_from_hash(attributes)
|
87
|
+
return nil unless attributes.is_a?(Hash)
|
88
|
+
super(attributes)
|
89
|
+
self.class.openapi_types.each_pair do |key, type|
|
90
|
+
if type =~ /\AArray<(.*)>/i
|
91
|
+
# check to ensure the input is an array given that the attribute
|
92
|
+
# is documented as an array but the input is not
|
93
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
94
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
95
|
+
end
|
96
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
97
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
98
|
+
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
99
|
+
self.send("#{key}=", nil)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
self
|
104
|
+
end
|
105
|
+
|
106
|
+
# Deserializes the data based on type
|
107
|
+
# @param string type Data type
|
108
|
+
# @param string value Value to be deserialized
|
109
|
+
# @return [Object] Deserialized data
|
110
|
+
def _deserialize(type, value)
|
111
|
+
case type.to_sym
|
112
|
+
when :DateTime
|
113
|
+
DateTime.parse(value)
|
114
|
+
when :Date
|
115
|
+
Date.parse(value)
|
116
|
+
when :String
|
117
|
+
value.to_s
|
118
|
+
when :Integer
|
119
|
+
value.to_i
|
120
|
+
when :Float
|
121
|
+
value.to_f
|
122
|
+
when :Boolean
|
123
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
124
|
+
true
|
125
|
+
else
|
126
|
+
false
|
127
|
+
end
|
128
|
+
when :Object
|
129
|
+
# generic object (usually a Hash), return directly
|
130
|
+
value
|
131
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
132
|
+
inner_type = Regexp.last_match[:inner_type]
|
133
|
+
value.map { |v| _deserialize(inner_type, v) }
|
134
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
135
|
+
k_type = Regexp.last_match[:k_type]
|
136
|
+
v_type = Regexp.last_match[:v_type]
|
137
|
+
{}.tap do |hash|
|
138
|
+
value.each do |k, v|
|
139
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
else # model
|
143
|
+
SmartRecruiters.const_get(type).build_from_hash(value)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
# Returns the string representation of the object
|
148
|
+
# @return [String] String presentation of the object
|
149
|
+
def to_s
|
150
|
+
to_hash.to_s
|
151
|
+
end
|
152
|
+
|
153
|
+
# to_body is an alias to to_hash (backward compatibility)
|
154
|
+
# @return [Hash] Returns the object in the form of hash
|
155
|
+
def to_body
|
156
|
+
to_hash
|
157
|
+
end
|
158
|
+
|
159
|
+
# Returns the object in the form of hash
|
160
|
+
# @return [Hash] Returns the object in the form of hash
|
161
|
+
def to_hash
|
162
|
+
hash = super
|
163
|
+
self.class.attribute_map.each_pair do |attr, param|
|
164
|
+
value = self.send(attr)
|
165
|
+
if value.nil?
|
166
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
167
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
168
|
+
end
|
169
|
+
|
170
|
+
hash[param] = _to_hash(value)
|
171
|
+
end
|
172
|
+
hash
|
173
|
+
end
|
174
|
+
|
175
|
+
# Outputs non-array value in the form of hash
|
176
|
+
# For object, use to_hash. Otherwise, just return the value
|
177
|
+
# @param [Object] value Any valid value
|
178
|
+
# @return [Hash] Returns the value in the form of hash
|
179
|
+
def _to_hash(value)
|
180
|
+
if value.is_a?(Array)
|
181
|
+
value.compact.map { |v| _to_hash(v) }
|
182
|
+
elsif value.is_a?(Hash)
|
183
|
+
{}.tap do |hash|
|
184
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
185
|
+
end
|
186
|
+
elsif value.respond_to? :to_hash
|
187
|
+
value.to_hash
|
188
|
+
else
|
189
|
+
value
|
190
|
+
end
|
191
|
+
end end
|
192
|
+
end
|
@@ -0,0 +1,216 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
require 'date'
|
4
|
+
|
5
|
+
module SmartRecruiters
|
6
|
+
class Interviewer
|
7
|
+
attr_accessor :id
|
8
|
+
|
9
|
+
attr_accessor :status
|
10
|
+
|
11
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
12
|
+
def self.attribute_map
|
13
|
+
{
|
14
|
+
:'id' => :'id',
|
15
|
+
:'status' => :'status'
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
# Attribute type mapping.
|
20
|
+
def self.openapi_types
|
21
|
+
{
|
22
|
+
:'id' => :'Object',
|
23
|
+
:'status' => :'Object'
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
# List of attributes with nullable: true
|
28
|
+
def self.openapi_nullable
|
29
|
+
Set.new([
|
30
|
+
])
|
31
|
+
end
|
32
|
+
|
33
|
+
# Initializes the object
|
34
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
35
|
+
def initialize(attributes = {})
|
36
|
+
if (!attributes.is_a?(Hash))
|
37
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SmartRecruiters::Interviewer` initialize method"
|
38
|
+
end
|
39
|
+
|
40
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
41
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
42
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
43
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SmartRecruiters::Interviewer`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
44
|
+
end
|
45
|
+
h[k.to_sym] = v
|
46
|
+
}
|
47
|
+
|
48
|
+
if attributes.key?(:'id')
|
49
|
+
self.id = attributes[:'id']
|
50
|
+
end
|
51
|
+
|
52
|
+
if attributes.key?(:'status')
|
53
|
+
self.status = attributes[:'status']
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
58
|
+
# @return Array for valid properties with the reasons
|
59
|
+
def list_invalid_properties
|
60
|
+
invalid_properties = Array.new
|
61
|
+
if @id.nil?
|
62
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
63
|
+
end
|
64
|
+
|
65
|
+
if @status.nil?
|
66
|
+
invalid_properties.push('invalid value for "status", status cannot be nil.')
|
67
|
+
end
|
68
|
+
|
69
|
+
invalid_properties
|
70
|
+
end
|
71
|
+
|
72
|
+
# Check to see if the all the properties in the model are valid
|
73
|
+
# @return true if the model is valid
|
74
|
+
def valid?
|
75
|
+
return false if @id.nil?
|
76
|
+
return false if @status.nil?
|
77
|
+
true
|
78
|
+
end
|
79
|
+
|
80
|
+
# Checks equality by comparing each attribute.
|
81
|
+
# @param [Object] Object to be compared
|
82
|
+
def ==(o)
|
83
|
+
return true if self.equal?(o)
|
84
|
+
self.class == o.class &&
|
85
|
+
id == o.id &&
|
86
|
+
status == o.status
|
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
|
+
[id, status].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,192 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
require 'date'
|
4
|
+
|
5
|
+
module SmartRecruiters
|
6
|
+
class Interviewers
|
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::Interviewers` 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::Interviewers`. 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
|
+
|
40
|
+
# call parent's initialize
|
41
|
+
super(attributes)
|
42
|
+
end
|
43
|
+
|
44
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
45
|
+
# @return Array for valid properties with the reasons
|
46
|
+
def list_invalid_properties
|
47
|
+
invalid_properties = super
|
48
|
+
invalid_properties
|
49
|
+
end
|
50
|
+
|
51
|
+
# Check to see if the all the properties in the model are valid
|
52
|
+
# @return true if the model is valid
|
53
|
+
def valid?
|
54
|
+
true
|
55
|
+
end
|
56
|
+
|
57
|
+
# Checks equality by comparing each attribute.
|
58
|
+
# @param [Object] Object to be compared
|
59
|
+
def ==(o)
|
60
|
+
return true if self.equal?(o)
|
61
|
+
self.class == o.class && super(o)
|
62
|
+
end
|
63
|
+
|
64
|
+
# @see the `==` method
|
65
|
+
# @param [Object] Object to be compared
|
66
|
+
def eql?(o)
|
67
|
+
self == o
|
68
|
+
end
|
69
|
+
|
70
|
+
# Calculates hash code according to all attributes.
|
71
|
+
# @return [Integer] Hash code
|
72
|
+
def hash
|
73
|
+
[].hash
|
74
|
+
end
|
75
|
+
|
76
|
+
# Builds the object from hash
|
77
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
78
|
+
# @return [Object] Returns the model itself
|
79
|
+
def self.build_from_hash(attributes)
|
80
|
+
new.build_from_hash(attributes)
|
81
|
+
end
|
82
|
+
|
83
|
+
# Builds the object from hash
|
84
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
85
|
+
# @return [Object] Returns the model itself
|
86
|
+
def build_from_hash(attributes)
|
87
|
+
return nil unless attributes.is_a?(Hash)
|
88
|
+
super(attributes)
|
89
|
+
self.class.openapi_types.each_pair do |key, type|
|
90
|
+
if type =~ /\AArray<(.*)>/i
|
91
|
+
# check to ensure the input is an array given that the attribute
|
92
|
+
# is documented as an array but the input is not
|
93
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
94
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
95
|
+
end
|
96
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
97
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
98
|
+
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
99
|
+
self.send("#{key}=", nil)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
self
|
104
|
+
end
|
105
|
+
|
106
|
+
# Deserializes the data based on type
|
107
|
+
# @param string type Data type
|
108
|
+
# @param string value Value to be deserialized
|
109
|
+
# @return [Object] Deserialized data
|
110
|
+
def _deserialize(type, value)
|
111
|
+
case type.to_sym
|
112
|
+
when :DateTime
|
113
|
+
DateTime.parse(value)
|
114
|
+
when :Date
|
115
|
+
Date.parse(value)
|
116
|
+
when :String
|
117
|
+
value.to_s
|
118
|
+
when :Integer
|
119
|
+
value.to_i
|
120
|
+
when :Float
|
121
|
+
value.to_f
|
122
|
+
when :Boolean
|
123
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
124
|
+
true
|
125
|
+
else
|
126
|
+
false
|
127
|
+
end
|
128
|
+
when :Object
|
129
|
+
# generic object (usually a Hash), return directly
|
130
|
+
value
|
131
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
132
|
+
inner_type = Regexp.last_match[:inner_type]
|
133
|
+
value.map { |v| _deserialize(inner_type, v) }
|
134
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
135
|
+
k_type = Regexp.last_match[:k_type]
|
136
|
+
v_type = Regexp.last_match[:v_type]
|
137
|
+
{}.tap do |hash|
|
138
|
+
value.each do |k, v|
|
139
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
else # model
|
143
|
+
SmartRecruiters.const_get(type).build_from_hash(value)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
# Returns the string representation of the object
|
148
|
+
# @return [String] String presentation of the object
|
149
|
+
def to_s
|
150
|
+
to_hash.to_s
|
151
|
+
end
|
152
|
+
|
153
|
+
# to_body is an alias to to_hash (backward compatibility)
|
154
|
+
# @return [Hash] Returns the object in the form of hash
|
155
|
+
def to_body
|
156
|
+
to_hash
|
157
|
+
end
|
158
|
+
|
159
|
+
# Returns the object in the form of hash
|
160
|
+
# @return [Hash] Returns the object in the form of hash
|
161
|
+
def to_hash
|
162
|
+
hash = super
|
163
|
+
self.class.attribute_map.each_pair do |attr, param|
|
164
|
+
value = self.send(attr)
|
165
|
+
if value.nil?
|
166
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
167
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
168
|
+
end
|
169
|
+
|
170
|
+
hash[param] = _to_hash(value)
|
171
|
+
end
|
172
|
+
hash
|
173
|
+
end
|
174
|
+
|
175
|
+
# Outputs non-array value in the form of hash
|
176
|
+
# For object, use to_hash. Otherwise, just return the value
|
177
|
+
# @param [Object] value Any valid value
|
178
|
+
# @return [Hash] Returns the value in the form of hash
|
179
|
+
def _to_hash(value)
|
180
|
+
if value.is_a?(Array)
|
181
|
+
value.compact.map { |v| _to_hash(v) }
|
182
|
+
elsif value.is_a?(Hash)
|
183
|
+
{}.tap do |hash|
|
184
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
185
|
+
end
|
186
|
+
elsif value.respond_to? :to_hash
|
187
|
+
value.to_hash
|
188
|
+
else
|
189
|
+
value
|
190
|
+
end
|
191
|
+
end end
|
192
|
+
end
|