open_api_smart_recruiters_sdk 0.2.9 → 0.2.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/smart_recruiters/api/users_api.rb +777 -0
- data/lib/smart_recruiters/models/user.rb +311 -0
- data/lib/smart_recruiters/models/user_entity.rb +367 -0
- data/lib/smart_recruiters/models/user_entity_access_groups.rb +204 -0
- data/lib/smart_recruiters/models/user_ids.rb +201 -0
- data/lib/smart_recruiters/models/user_language.rb +200 -0
- data/lib/smart_recruiters/models/user_language_code.rb +50 -0
- data/lib/smart_recruiters/models/user_list_item.rb +367 -0
- data/lib/smart_recruiters/models/user_list_item_access_groups.rb +195 -0
- data/lib/smart_recruiters/models/users.rb +213 -0
- data/lib/smart_recruiters/version.rb +1 -1
- metadata +12 -2
@@ -0,0 +1,367 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module SmartRecruiters
|
4
|
+
class UserListItem
|
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 :access_groups
|
29
|
+
|
30
|
+
attr_accessor :seats
|
31
|
+
|
32
|
+
class EnumAttributeValidator
|
33
|
+
attr_reader :datatype
|
34
|
+
attr_reader :allowable_values
|
35
|
+
|
36
|
+
def initialize(datatype, allowable_values)
|
37
|
+
@allowable_values = allowable_values.map do |value|
|
38
|
+
case datatype.to_s
|
39
|
+
when /Integer/i
|
40
|
+
value.to_i
|
41
|
+
when /Float/i
|
42
|
+
value.to_f
|
43
|
+
else
|
44
|
+
value
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def valid?(value)
|
50
|
+
!value || allowable_values.include?(value)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
55
|
+
def self.attribute_map
|
56
|
+
{
|
57
|
+
:'email' => :'email',
|
58
|
+
:'first_name' => :'firstName',
|
59
|
+
:'last_name' => :'lastName',
|
60
|
+
:'system_role' => :'systemRole',
|
61
|
+
:'external_data' => :'externalData',
|
62
|
+
:'sso_identifier' => :'ssoIdentifier',
|
63
|
+
:'sso_login_mode' => :'ssoLoginMode',
|
64
|
+
:'language' => :'language',
|
65
|
+
:'id' => :'id',
|
66
|
+
:'active' => :'active',
|
67
|
+
:'updated_on' => :'updatedOn',
|
68
|
+
:'access_groups' => :'accessGroups',
|
69
|
+
:'seats' => :'seats'
|
70
|
+
}
|
71
|
+
end
|
72
|
+
|
73
|
+
# Attribute type mapping.
|
74
|
+
def self.openapi_types
|
75
|
+
{
|
76
|
+
:'email' => :'',
|
77
|
+
:'first_name' => :'',
|
78
|
+
:'last_name' => :'',
|
79
|
+
:'system_role' => :'',
|
80
|
+
:'external_data' => :'',
|
81
|
+
:'sso_identifier' => :'',
|
82
|
+
:'sso_login_mode' => :'',
|
83
|
+
:'language' => :'',
|
84
|
+
:'id' => :'',
|
85
|
+
:'active' => :'',
|
86
|
+
:'updated_on' => :'',
|
87
|
+
:'access_groups' => :'',
|
88
|
+
:'seats' => :''
|
89
|
+
}
|
90
|
+
end
|
91
|
+
|
92
|
+
# List of attributes with nullable: true
|
93
|
+
def self.openapi_nullable
|
94
|
+
Set.new([
|
95
|
+
:'external_data',
|
96
|
+
:'sso_identifier',
|
97
|
+
:'sso_login_mode',
|
98
|
+
])
|
99
|
+
end
|
100
|
+
|
101
|
+
# Initializes the object
|
102
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
103
|
+
def initialize(attributes = {})
|
104
|
+
if (!attributes.is_a?(Hash))
|
105
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SmartRecruiters::UserListItem` initialize method"
|
106
|
+
end
|
107
|
+
|
108
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
109
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
110
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
111
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SmartRecruiters::UserListItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
112
|
+
end
|
113
|
+
h[k.to_sym] = v
|
114
|
+
}
|
115
|
+
|
116
|
+
# call parent's initialize
|
117
|
+
super(attributes)
|
118
|
+
|
119
|
+
if attributes.key?(:'email')
|
120
|
+
self.email = attributes[:'email']
|
121
|
+
end
|
122
|
+
|
123
|
+
if attributes.key?(:'first_name')
|
124
|
+
self.first_name = attributes[:'first_name']
|
125
|
+
end
|
126
|
+
|
127
|
+
if attributes.key?(:'last_name')
|
128
|
+
self.last_name = attributes[:'last_name']
|
129
|
+
end
|
130
|
+
|
131
|
+
if attributes.key?(:'system_role')
|
132
|
+
self.system_role = attributes[:'system_role']
|
133
|
+
end
|
134
|
+
|
135
|
+
if attributes.key?(:'external_data')
|
136
|
+
self.external_data = attributes[:'external_data']
|
137
|
+
end
|
138
|
+
|
139
|
+
if attributes.key?(:'sso_identifier')
|
140
|
+
self.sso_identifier = attributes[:'sso_identifier']
|
141
|
+
end
|
142
|
+
|
143
|
+
if attributes.key?(:'sso_login_mode')
|
144
|
+
self.sso_login_mode = attributes[:'sso_login_mode']
|
145
|
+
end
|
146
|
+
|
147
|
+
if attributes.key?(:'language')
|
148
|
+
self.language = attributes[:'language']
|
149
|
+
end
|
150
|
+
|
151
|
+
if attributes.key?(:'id')
|
152
|
+
self.id = attributes[:'id']
|
153
|
+
end
|
154
|
+
|
155
|
+
if attributes.key?(:'active')
|
156
|
+
self.active = attributes[:'active']
|
157
|
+
end
|
158
|
+
|
159
|
+
if attributes.key?(:'updated_on')
|
160
|
+
self.updated_on = attributes[:'updated_on']
|
161
|
+
end
|
162
|
+
|
163
|
+
if attributes.key?(:'access_groups')
|
164
|
+
if (value = attributes[:'access_groups']).is_a?(Array)
|
165
|
+
self.access_groups = value
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
if attributes.key?(:'seats')
|
170
|
+
self.seats = attributes[:'seats']
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
175
|
+
# @return Array for valid properties with the reasons
|
176
|
+
def list_invalid_properties
|
177
|
+
invalid_properties = super
|
178
|
+
if @first_name.nil?
|
179
|
+
invalid_properties.push('invalid value for "first_name", first_name cannot be nil.')
|
180
|
+
end
|
181
|
+
|
182
|
+
if @last_name.nil?
|
183
|
+
invalid_properties.push('invalid value for "last_name", last_name cannot be nil.')
|
184
|
+
end
|
185
|
+
|
186
|
+
if @system_role.nil?
|
187
|
+
invalid_properties.push('invalid value for "system_role", system_role cannot be nil.')
|
188
|
+
end
|
189
|
+
|
190
|
+
if @language.nil?
|
191
|
+
invalid_properties.push('invalid value for "language", language cannot be nil.')
|
192
|
+
end
|
193
|
+
|
194
|
+
invalid_properties
|
195
|
+
end
|
196
|
+
|
197
|
+
# Check to see if the all the properties in the model are valid
|
198
|
+
# @return true if the model is valid
|
199
|
+
def valid?
|
200
|
+
return false if @first_name.nil?
|
201
|
+
return false if @last_name.nil?
|
202
|
+
return false if @system_role.nil?
|
203
|
+
sso_login_mode_validator = EnumAttributeValidator.new('', ['SSO', 'PASSWORD'])
|
204
|
+
return false unless sso_login_mode_validator.valid?(@sso_login_mode)
|
205
|
+
return false if @language.nil?
|
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
|
+
access_groups == o.access_groups &&
|
236
|
+
seats == o.seats && super(o)
|
237
|
+
end
|
238
|
+
|
239
|
+
# @see the `==` method
|
240
|
+
# @param [Object] Object to be compared
|
241
|
+
def eql?(o)
|
242
|
+
self == o
|
243
|
+
end
|
244
|
+
|
245
|
+
# Calculates hash code according to all attributes.
|
246
|
+
# @return [Integer] Hash code
|
247
|
+
def hash
|
248
|
+
[email, first_name, last_name, system_role, external_data, sso_identifier, sso_login_mode, language, id, active, updated_on, access_groups, seats].hash
|
249
|
+
end
|
250
|
+
|
251
|
+
# Builds the object from hash
|
252
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
253
|
+
# @return [Object] Returns the model itself
|
254
|
+
def self.build_from_hash(attributes)
|
255
|
+
new.build_from_hash(attributes)
|
256
|
+
end
|
257
|
+
|
258
|
+
# Builds the object from hash
|
259
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
260
|
+
# @return [Object] Returns the model itself
|
261
|
+
def build_from_hash(attributes)
|
262
|
+
return nil unless attributes.is_a?(Hash)
|
263
|
+
super(attributes)
|
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 = super
|
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
|
@@ -0,0 +1,195 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module SmartRecruiters
|
4
|
+
class UserListItemAccessGroups
|
5
|
+
attr_accessor :id
|
6
|
+
|
7
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
8
|
+
def self.attribute_map
|
9
|
+
{
|
10
|
+
:'id' => :'id'
|
11
|
+
}
|
12
|
+
end
|
13
|
+
|
14
|
+
# Attribute type mapping.
|
15
|
+
def self.openapi_types
|
16
|
+
{
|
17
|
+
:'id' => :'Object'
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
# List of attributes with nullable: true
|
22
|
+
def self.openapi_nullable
|
23
|
+
Set.new([
|
24
|
+
])
|
25
|
+
end
|
26
|
+
|
27
|
+
# Initializes the object
|
28
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
29
|
+
def initialize(attributes = {})
|
30
|
+
if (!attributes.is_a?(Hash))
|
31
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SmartRecruiters::UserListItemAccessGroups` initialize method"
|
32
|
+
end
|
33
|
+
|
34
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
35
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
36
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
37
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SmartRecruiters::UserListItemAccessGroups`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
38
|
+
end
|
39
|
+
h[k.to_sym] = v
|
40
|
+
}
|
41
|
+
|
42
|
+
if attributes.key?(:'id')
|
43
|
+
self.id = attributes[:'id']
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
48
|
+
# @return Array for valid properties with the reasons
|
49
|
+
def list_invalid_properties
|
50
|
+
invalid_properties = Array.new
|
51
|
+
invalid_properties
|
52
|
+
end
|
53
|
+
|
54
|
+
# Check to see if the all the properties in the model are valid
|
55
|
+
# @return true if the model is valid
|
56
|
+
def valid?
|
57
|
+
true
|
58
|
+
end
|
59
|
+
|
60
|
+
# Checks equality by comparing each attribute.
|
61
|
+
# @param [Object] Object to be compared
|
62
|
+
def ==(o)
|
63
|
+
return true if self.equal?(o)
|
64
|
+
self.class == o.class &&
|
65
|
+
id == o.id
|
66
|
+
end
|
67
|
+
|
68
|
+
# @see the `==` method
|
69
|
+
# @param [Object] Object to be compared
|
70
|
+
def eql?(o)
|
71
|
+
self == o
|
72
|
+
end
|
73
|
+
|
74
|
+
# Calculates hash code according to all attributes.
|
75
|
+
# @return [Integer] Hash code
|
76
|
+
def hash
|
77
|
+
[id].hash
|
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 self.build_from_hash(attributes)
|
84
|
+
new.build_from_hash(attributes)
|
85
|
+
end
|
86
|
+
|
87
|
+
# Builds the object from hash
|
88
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
89
|
+
# @return [Object] Returns the model itself
|
90
|
+
def build_from_hash(attributes)
|
91
|
+
return nil unless attributes.is_a?(Hash)
|
92
|
+
self.class.openapi_types.each_pair do |key, type|
|
93
|
+
if type =~ /\AArray<(.*)>/i
|
94
|
+
# check to ensure the input is an array given that the attribute
|
95
|
+
# is documented as an array but the input is not
|
96
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
97
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
98
|
+
end
|
99
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
100
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
101
|
+
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
102
|
+
self.send("#{key}=", nil)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
self
|
107
|
+
end
|
108
|
+
|
109
|
+
# Deserializes the data based on type
|
110
|
+
# @param string type Data type
|
111
|
+
# @param string value Value to be deserialized
|
112
|
+
# @return [Object] Deserialized data
|
113
|
+
def _deserialize(type, value)
|
114
|
+
case type.to_sym
|
115
|
+
when :DateTime
|
116
|
+
DateTime.parse(value)
|
117
|
+
when :Date
|
118
|
+
Date.parse(value)
|
119
|
+
when :String
|
120
|
+
value.to_s
|
121
|
+
when :Integer
|
122
|
+
value.to_i
|
123
|
+
when :Float
|
124
|
+
value.to_f
|
125
|
+
when :Boolean
|
126
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
127
|
+
true
|
128
|
+
else
|
129
|
+
false
|
130
|
+
end
|
131
|
+
when :Object
|
132
|
+
# generic object (usually a Hash), return directly
|
133
|
+
value
|
134
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
135
|
+
inner_type = Regexp.last_match[:inner_type]
|
136
|
+
value.map { |v| _deserialize(inner_type, v) }
|
137
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
138
|
+
k_type = Regexp.last_match[:k_type]
|
139
|
+
v_type = Regexp.last_match[:v_type]
|
140
|
+
{}.tap do |hash|
|
141
|
+
value.each do |k, v|
|
142
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
else # model
|
146
|
+
SmartRecruiters.const_get(type).build_from_hash(value)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
# Returns the string representation of the object
|
151
|
+
# @return [String] String presentation of the object
|
152
|
+
def to_s
|
153
|
+
to_hash.to_s
|
154
|
+
end
|
155
|
+
|
156
|
+
# to_body is an alias to to_hash (backward compatibility)
|
157
|
+
# @return [Hash] Returns the object in the form of hash
|
158
|
+
def to_body
|
159
|
+
to_hash
|
160
|
+
end
|
161
|
+
|
162
|
+
# Returns the object in the form of hash
|
163
|
+
# @return [Hash] Returns the object in the form of hash
|
164
|
+
def to_hash
|
165
|
+
hash = {}
|
166
|
+
self.class.attribute_map.each_pair do |attr, param|
|
167
|
+
value = self.send(attr)
|
168
|
+
if value.nil?
|
169
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
170
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
171
|
+
end
|
172
|
+
|
173
|
+
hash[param] = _to_hash(value)
|
174
|
+
end
|
175
|
+
hash
|
176
|
+
end
|
177
|
+
|
178
|
+
# Outputs non-array value in the form of hash
|
179
|
+
# For object, use to_hash. Otherwise, just return the value
|
180
|
+
# @param [Object] value Any valid value
|
181
|
+
# @return [Hash] Returns the value in the form of hash
|
182
|
+
def _to_hash(value)
|
183
|
+
if value.is_a?(Array)
|
184
|
+
value.compact.map { |v| _to_hash(v) }
|
185
|
+
elsif value.is_a?(Hash)
|
186
|
+
{}.tap do |hash|
|
187
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
188
|
+
end
|
189
|
+
elsif value.respond_to? :to_hash
|
190
|
+
value.to_hash
|
191
|
+
else
|
192
|
+
value
|
193
|
+
end
|
194
|
+
end end
|
195
|
+
end
|