form_api 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -32,6 +32,22 @@ module FormAPI
32
32
 
33
33
  attr_accessor :completed_at
34
34
 
35
+ attr_accessor :auth_type
36
+
37
+ attr_accessor :auth_second_factor_type
38
+
39
+ attr_accessor :auth_provider
40
+
41
+ attr_accessor :auth_session_started_at
42
+
43
+ attr_accessor :auth_session_id_hash
44
+
45
+ attr_accessor :auth_user_id_hash
46
+
47
+ attr_accessor :auth_username_hash
48
+
49
+ attr_accessor :auth_phone_number_hash
50
+
35
51
  class EnumAttributeValidator
36
52
  attr_reader :datatype
37
53
  attr_reader :allowable_values
@@ -65,7 +81,15 @@ module FormAPI
65
81
  :'metadata' => :'metadata',
66
82
  :'state' => :'state',
67
83
  :'viewed_at' => :'viewed_at',
68
- :'completed_at' => :'completed_at'
84
+ :'completed_at' => :'completed_at',
85
+ :'auth_type' => :'auth_type',
86
+ :'auth_second_factor_type' => :'auth_second_factor_type',
87
+ :'auth_provider' => :'auth_provider',
88
+ :'auth_session_started_at' => :'auth_session_started_at',
89
+ :'auth_session_id_hash' => :'auth_session_id_hash',
90
+ :'auth_user_id_hash' => :'auth_user_id_hash',
91
+ :'auth_username_hash' => :'auth_username_hash',
92
+ :'auth_phone_number_hash' => :'auth_phone_number_hash'
69
93
  }
70
94
  end
71
95
 
@@ -80,7 +104,15 @@ module FormAPI
80
104
  :'metadata' => :'Object',
81
105
  :'state' => :'String',
82
106
  :'viewed_at' => :'String',
83
- :'completed_at' => :'String'
107
+ :'completed_at' => :'String',
108
+ :'auth_type' => :'String',
109
+ :'auth_second_factor_type' => :'String',
110
+ :'auth_provider' => :'String',
111
+ :'auth_session_started_at' => :'String',
112
+ :'auth_session_id_hash' => :'String',
113
+ :'auth_user_id_hash' => :'String',
114
+ :'auth_username_hash' => :'String',
115
+ :'auth_phone_number_hash' => :'String'
84
116
  }
85
117
  end
86
118
 
@@ -129,6 +161,38 @@ module FormAPI
129
161
  if attributes.has_key?(:'completed_at')
130
162
  self.completed_at = attributes[:'completed_at']
131
163
  end
164
+
165
+ if attributes.has_key?(:'auth_type')
166
+ self.auth_type = attributes[:'auth_type']
167
+ end
168
+
169
+ if attributes.has_key?(:'auth_second_factor_type')
170
+ self.auth_second_factor_type = attributes[:'auth_second_factor_type']
171
+ end
172
+
173
+ if attributes.has_key?(:'auth_provider')
174
+ self.auth_provider = attributes[:'auth_provider']
175
+ end
176
+
177
+ if attributes.has_key?(:'auth_session_started_at')
178
+ self.auth_session_started_at = attributes[:'auth_session_started_at']
179
+ end
180
+
181
+ if attributes.has_key?(:'auth_session_id_hash')
182
+ self.auth_session_id_hash = attributes[:'auth_session_id_hash']
183
+ end
184
+
185
+ if attributes.has_key?(:'auth_user_id_hash')
186
+ self.auth_user_id_hash = attributes[:'auth_user_id_hash']
187
+ end
188
+
189
+ if attributes.has_key?(:'auth_username_hash')
190
+ self.auth_username_hash = attributes[:'auth_username_hash']
191
+ end
192
+
193
+ if attributes.has_key?(:'auth_phone_number_hash')
194
+ self.auth_phone_number_hash = attributes[:'auth_phone_number_hash']
195
+ end
132
196
  end
133
197
 
134
198
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -176,21 +240,45 @@ module FormAPI
176
240
  return false if @fields.nil?
177
241
  return false if @metadata.nil?
178
242
  return false if @state.nil?
179
- state_validator = EnumAttributeValidator.new('String', ['pending', 'complete'])
243
+ state_validator = EnumAttributeValidator.new('String', ['pending', 'completed'])
180
244
  return false unless state_validator.valid?(@state)
245
+ auth_type_validator = EnumAttributeValidator.new('String', ['none', 'password', 'oauth', 'email_link', 'phone_number', 'ldap', 'saml'])
246
+ return false unless auth_type_validator.valid?(@auth_type)
247
+ auth_second_factor_type_validator = EnumAttributeValidator.new('String', ['none', 'phone_number', 'totp', 'mobile_push', 'security_key', 'fingerprint'])
248
+ return false unless auth_second_factor_type_validator.valid?(@auth_second_factor_type)
181
249
  true
182
250
  end
183
251
 
184
252
  # Custom attribute writer method checking allowed values (enum).
185
253
  # @param [Object] state Object to be assigned
186
254
  def state=(state)
187
- validator = EnumAttributeValidator.new('String', ['pending', 'complete'])
255
+ validator = EnumAttributeValidator.new('String', ['pending', 'completed'])
188
256
  unless validator.valid?(state)
189
257
  fail ArgumentError, 'invalid value for "state", must be one of #{validator.allowable_values}.'
190
258
  end
191
259
  @state = state
192
260
  end
193
261
 
262
+ # Custom attribute writer method checking allowed values (enum).
263
+ # @param [Object] auth_type Object to be assigned
264
+ def auth_type=(auth_type)
265
+ validator = EnumAttributeValidator.new('String', ['none', 'password', 'oauth', 'email_link', 'phone_number', 'ldap', 'saml'])
266
+ unless validator.valid?(auth_type)
267
+ fail ArgumentError, 'invalid value for "auth_type", must be one of #{validator.allowable_values}.'
268
+ end
269
+ @auth_type = auth_type
270
+ end
271
+
272
+ # Custom attribute writer method checking allowed values (enum).
273
+ # @param [Object] auth_second_factor_type Object to be assigned
274
+ def auth_second_factor_type=(auth_second_factor_type)
275
+ validator = EnumAttributeValidator.new('String', ['none', 'phone_number', 'totp', 'mobile_push', 'security_key', 'fingerprint'])
276
+ unless validator.valid?(auth_second_factor_type)
277
+ fail ArgumentError, 'invalid value for "auth_second_factor_type", must be one of #{validator.allowable_values}.'
278
+ end
279
+ @auth_second_factor_type = auth_second_factor_type
280
+ end
281
+
194
282
  # Checks equality by comparing each attribute.
195
283
  # @param [Object] Object to be compared
196
284
  def ==(o)
@@ -204,7 +292,15 @@ module FormAPI
204
292
  metadata == o.metadata &&
205
293
  state == o.state &&
206
294
  viewed_at == o.viewed_at &&
207
- completed_at == o.completed_at
295
+ completed_at == o.completed_at &&
296
+ auth_type == o.auth_type &&
297
+ auth_second_factor_type == o.auth_second_factor_type &&
298
+ auth_provider == o.auth_provider &&
299
+ auth_session_started_at == o.auth_session_started_at &&
300
+ auth_session_id_hash == o.auth_session_id_hash &&
301
+ auth_user_id_hash == o.auth_user_id_hash &&
302
+ auth_username_hash == o.auth_username_hash &&
303
+ auth_phone_number_hash == o.auth_phone_number_hash
208
304
  end
209
305
 
210
306
  # @see the `==` method
@@ -216,7 +312,7 @@ module FormAPI
216
312
  # Calculates hash code according to all attributes.
217
313
  # @return [Fixnum] Hash code
218
314
  def hash
219
- [id, name, email, order, fields, metadata, state, viewed_at, completed_at].hash
315
+ [id, name, email, order, fields, metadata, state, viewed_at, completed_at, auth_type, auth_second_factor_type, auth_provider, auth_session_started_at, auth_session_id_hash, auth_user_id_hash, auth_username_hash, auth_phone_number_hash].hash
220
316
  end
221
317
 
222
318
  # Builds the object from hash
@@ -13,36 +13,50 @@ OpenAPI Generator version: 3.3.0-SNAPSHOT
13
13
  require 'date'
14
14
 
15
15
  module FormAPI
16
- class SubmissionDataRequestData
17
- attr_accessor :metadata
18
-
19
- attr_accessor :name
20
-
21
- attr_accessor :fields
22
-
23
- attr_accessor :email
16
+ class UpdateDataRequestResponse
17
+ attr_accessor :data_request
18
+
19
+ attr_accessor :errors
20
+
21
+ attr_accessor :status
22
+
23
+ class EnumAttributeValidator
24
+ attr_reader :datatype
25
+ attr_reader :allowable_values
26
+
27
+ def initialize(datatype, allowable_values)
28
+ @allowable_values = allowable_values.map do |value|
29
+ case datatype.to_s
30
+ when /Integer/i
31
+ value.to_i
32
+ when /Float/i
33
+ value.to_f
34
+ else
35
+ value
36
+ end
37
+ end
38
+ end
24
39
 
25
- attr_accessor :order
40
+ def valid?(value)
41
+ !value || allowable_values.include?(value)
42
+ end
43
+ end
26
44
 
27
45
  # Attribute mapping from ruby-style variable name to JSON key.
28
46
  def self.attribute_map
29
47
  {
30
- :'metadata' => :'metadata',
31
- :'name' => :'name',
32
- :'fields' => :'fields',
33
- :'email' => :'email',
34
- :'order' => :'order'
48
+ :'data_request' => :'data_request',
49
+ :'errors' => :'errors',
50
+ :'status' => :'status'
35
51
  }
36
52
  end
37
53
 
38
54
  # Attribute type mapping.
39
55
  def self.openapi_types
40
56
  {
41
- :'metadata' => :'Object',
42
- :'name' => :'String',
43
- :'fields' => :'Array<String>',
44
- :'email' => :'String',
45
- :'order' => :'Integer'
57
+ :'data_request' => :'SubmissionDataRequest',
58
+ :'errors' => :'Array<String>',
59
+ :'status' => :'String'
46
60
  }
47
61
  end
48
62
 
@@ -54,26 +68,18 @@ module FormAPI
54
68
  # convert string to symbol for hash key
55
69
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
56
70
 
57
- if attributes.has_key?(:'metadata')
58
- self.metadata = attributes[:'metadata']
71
+ if attributes.has_key?(:'data_request')
72
+ self.data_request = attributes[:'data_request']
59
73
  end
60
74
 
61
- if attributes.has_key?(:'name')
62
- self.name = attributes[:'name']
63
- end
64
-
65
- if attributes.has_key?(:'fields')
66
- if (value = attributes[:'fields']).is_a?(Array)
67
- self.fields = value
75
+ if attributes.has_key?(:'errors')
76
+ if (value = attributes[:'errors']).is_a?(Array)
77
+ self.errors = value
68
78
  end
69
79
  end
70
80
 
71
- if attributes.has_key?(:'email')
72
- self.email = attributes[:'email']
73
- end
74
-
75
- if attributes.has_key?(:'order')
76
- self.order = attributes[:'order']
81
+ if attributes.has_key?(:'status')
82
+ self.status = attributes[:'status']
77
83
  end
78
84
  end
79
85
 
@@ -87,19 +93,29 @@ module FormAPI
87
93
  # Check to see if the all the properties in the model are valid
88
94
  # @return true if the model is valid
89
95
  def valid?
96
+ status_validator = EnumAttributeValidator.new('String', ['success', 'error'])
97
+ return false unless status_validator.valid?(@status)
90
98
  true
91
99
  end
92
100
 
101
+ # Custom attribute writer method checking allowed values (enum).
102
+ # @param [Object] status Object to be assigned
103
+ def status=(status)
104
+ validator = EnumAttributeValidator.new('String', ['success', 'error'])
105
+ unless validator.valid?(status)
106
+ fail ArgumentError, 'invalid value for "status", must be one of #{validator.allowable_values}.'
107
+ end
108
+ @status = status
109
+ end
110
+
93
111
  # Checks equality by comparing each attribute.
94
112
  # @param [Object] Object to be compared
95
113
  def ==(o)
96
114
  return true if self.equal?(o)
97
115
  self.class == o.class &&
98
- metadata == o.metadata &&
99
- name == o.name &&
100
- fields == o.fields &&
101
- email == o.email &&
102
- order == o.order
116
+ data_request == o.data_request &&
117
+ errors == o.errors &&
118
+ status == o.status
103
119
  end
104
120
 
105
121
  # @see the `==` method
@@ -111,7 +127,7 @@ module FormAPI
111
127
  # Calculates hash code according to all attributes.
112
128
  # @return [Fixnum] Hash code
113
129
  def hash
114
- [metadata, name, fields, email, order].hash
130
+ [data_request, errors, status].hash
115
131
  end
116
132
 
117
133
  # Builds the object from hash
@@ -0,0 +1,339 @@
1
+ =begin
2
+ #API V1
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 3.3.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module FormAPI
16
+ class UpdateSubmissionDataRequestData
17
+ attr_accessor :name
18
+
19
+ attr_accessor :email
20
+
21
+ attr_accessor :order
22
+
23
+ attr_accessor :fields
24
+
25
+ attr_accessor :metadata
26
+
27
+ attr_accessor :auth_type
28
+
29
+ attr_accessor :auth_second_factor_type
30
+
31
+ attr_accessor :auth_provider
32
+
33
+ attr_accessor :auth_session_started_at
34
+
35
+ attr_accessor :auth_session_id_hash
36
+
37
+ attr_accessor :auth_user_id_hash
38
+
39
+ attr_accessor :auth_username_hash
40
+
41
+ attr_accessor :auth_phone_number_hash
42
+
43
+ class EnumAttributeValidator
44
+ attr_reader :datatype
45
+ attr_reader :allowable_values
46
+
47
+ def initialize(datatype, allowable_values)
48
+ @allowable_values = allowable_values.map do |value|
49
+ case datatype.to_s
50
+ when /Integer/i
51
+ value.to_i
52
+ when /Float/i
53
+ value.to_f
54
+ else
55
+ value
56
+ end
57
+ end
58
+ end
59
+
60
+ def valid?(value)
61
+ !value || allowable_values.include?(value)
62
+ end
63
+ end
64
+
65
+ # Attribute mapping from ruby-style variable name to JSON key.
66
+ def self.attribute_map
67
+ {
68
+ :'name' => :'name',
69
+ :'email' => :'email',
70
+ :'order' => :'order',
71
+ :'fields' => :'fields',
72
+ :'metadata' => :'metadata',
73
+ :'auth_type' => :'auth_type',
74
+ :'auth_second_factor_type' => :'auth_second_factor_type',
75
+ :'auth_provider' => :'auth_provider',
76
+ :'auth_session_started_at' => :'auth_session_started_at',
77
+ :'auth_session_id_hash' => :'auth_session_id_hash',
78
+ :'auth_user_id_hash' => :'auth_user_id_hash',
79
+ :'auth_username_hash' => :'auth_username_hash',
80
+ :'auth_phone_number_hash' => :'auth_phone_number_hash'
81
+ }
82
+ end
83
+
84
+ # Attribute type mapping.
85
+ def self.openapi_types
86
+ {
87
+ :'name' => :'String',
88
+ :'email' => :'String',
89
+ :'order' => :'Integer',
90
+ :'fields' => :'Array<String>',
91
+ :'metadata' => :'Object',
92
+ :'auth_type' => :'String',
93
+ :'auth_second_factor_type' => :'String',
94
+ :'auth_provider' => :'String',
95
+ :'auth_session_started_at' => :'String',
96
+ :'auth_session_id_hash' => :'String',
97
+ :'auth_user_id_hash' => :'String',
98
+ :'auth_username_hash' => :'String',
99
+ :'auth_phone_number_hash' => :'String'
100
+ }
101
+ end
102
+
103
+ # Initializes the object
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ def initialize(attributes = {})
106
+ return unless attributes.is_a?(Hash)
107
+
108
+ # convert string to symbol for hash key
109
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
110
+
111
+ if attributes.has_key?(:'name')
112
+ self.name = attributes[:'name']
113
+ end
114
+
115
+ if attributes.has_key?(:'email')
116
+ self.email = attributes[:'email']
117
+ end
118
+
119
+ if attributes.has_key?(:'order')
120
+ self.order = attributes[:'order']
121
+ end
122
+
123
+ if attributes.has_key?(:'fields')
124
+ if (value = attributes[:'fields']).is_a?(Array)
125
+ self.fields = value
126
+ end
127
+ end
128
+
129
+ if attributes.has_key?(:'metadata')
130
+ self.metadata = attributes[:'metadata']
131
+ end
132
+
133
+ if attributes.has_key?(:'auth_type')
134
+ self.auth_type = attributes[:'auth_type']
135
+ end
136
+
137
+ if attributes.has_key?(:'auth_second_factor_type')
138
+ self.auth_second_factor_type = attributes[:'auth_second_factor_type']
139
+ end
140
+
141
+ if attributes.has_key?(:'auth_provider')
142
+ self.auth_provider = attributes[:'auth_provider']
143
+ end
144
+
145
+ if attributes.has_key?(:'auth_session_started_at')
146
+ self.auth_session_started_at = attributes[:'auth_session_started_at']
147
+ end
148
+
149
+ if attributes.has_key?(:'auth_session_id_hash')
150
+ self.auth_session_id_hash = attributes[:'auth_session_id_hash']
151
+ end
152
+
153
+ if attributes.has_key?(:'auth_user_id_hash')
154
+ self.auth_user_id_hash = attributes[:'auth_user_id_hash']
155
+ end
156
+
157
+ if attributes.has_key?(:'auth_username_hash')
158
+ self.auth_username_hash = attributes[:'auth_username_hash']
159
+ end
160
+
161
+ if attributes.has_key?(:'auth_phone_number_hash')
162
+ self.auth_phone_number_hash = attributes[:'auth_phone_number_hash']
163
+ end
164
+ end
165
+
166
+ # Show invalid properties with the reasons. Usually used together with valid?
167
+ # @return Array for valid properties with the reasons
168
+ def list_invalid_properties
169
+ invalid_properties = Array.new
170
+ invalid_properties
171
+ end
172
+
173
+ # Check to see if the all the properties in the model are valid
174
+ # @return true if the model is valid
175
+ def valid?
176
+ auth_type_validator = EnumAttributeValidator.new('String', ['none', 'password', 'oauth', 'email_link', 'phone_number', 'ldap', 'saml'])
177
+ return false unless auth_type_validator.valid?(@auth_type)
178
+ auth_second_factor_type_validator = EnumAttributeValidator.new('String', ['none', 'phone_number', 'totp', 'mobile_push', 'security_key', 'fingerprint'])
179
+ return false unless auth_second_factor_type_validator.valid?(@auth_second_factor_type)
180
+ true
181
+ end
182
+
183
+ # Custom attribute writer method checking allowed values (enum).
184
+ # @param [Object] auth_type Object to be assigned
185
+ def auth_type=(auth_type)
186
+ validator = EnumAttributeValidator.new('String', ['none', 'password', 'oauth', 'email_link', 'phone_number', 'ldap', 'saml'])
187
+ unless validator.valid?(auth_type)
188
+ fail ArgumentError, 'invalid value for "auth_type", must be one of #{validator.allowable_values}.'
189
+ end
190
+ @auth_type = auth_type
191
+ end
192
+
193
+ # Custom attribute writer method checking allowed values (enum).
194
+ # @param [Object] auth_second_factor_type Object to be assigned
195
+ def auth_second_factor_type=(auth_second_factor_type)
196
+ validator = EnumAttributeValidator.new('String', ['none', 'phone_number', 'totp', 'mobile_push', 'security_key', 'fingerprint'])
197
+ unless validator.valid?(auth_second_factor_type)
198
+ fail ArgumentError, 'invalid value for "auth_second_factor_type", must be one of #{validator.allowable_values}.'
199
+ end
200
+ @auth_second_factor_type = auth_second_factor_type
201
+ end
202
+
203
+ # Checks equality by comparing each attribute.
204
+ # @param [Object] Object to be compared
205
+ def ==(o)
206
+ return true if self.equal?(o)
207
+ self.class == o.class &&
208
+ name == o.name &&
209
+ email == o.email &&
210
+ order == o.order &&
211
+ fields == o.fields &&
212
+ metadata == o.metadata &&
213
+ auth_type == o.auth_type &&
214
+ auth_second_factor_type == o.auth_second_factor_type &&
215
+ auth_provider == o.auth_provider &&
216
+ auth_session_started_at == o.auth_session_started_at &&
217
+ auth_session_id_hash == o.auth_session_id_hash &&
218
+ auth_user_id_hash == o.auth_user_id_hash &&
219
+ auth_username_hash == o.auth_username_hash &&
220
+ auth_phone_number_hash == o.auth_phone_number_hash
221
+ end
222
+
223
+ # @see the `==` method
224
+ # @param [Object] Object to be compared
225
+ def eql?(o)
226
+ self == o
227
+ end
228
+
229
+ # Calculates hash code according to all attributes.
230
+ # @return [Fixnum] Hash code
231
+ def hash
232
+ [name, email, order, fields, metadata, auth_type, auth_second_factor_type, auth_provider, auth_session_started_at, auth_session_id_hash, auth_user_id_hash, auth_username_hash, auth_phone_number_hash].hash
233
+ end
234
+
235
+ # Builds the object from hash
236
+ # @param [Hash] attributes Model attributes in the form of hash
237
+ # @return [Object] Returns the model itself
238
+ def build_from_hash(attributes)
239
+ return nil unless attributes.is_a?(Hash)
240
+ self.class.openapi_types.each_pair do |key, type|
241
+ if type =~ /\AArray<(.*)>/i
242
+ # check to ensure the input is an array given that the the attribute
243
+ # is documented as an array but the input is not
244
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
245
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
246
+ end
247
+ elsif !attributes[self.class.attribute_map[key]].nil?
248
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
249
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
250
+ end
251
+
252
+ self
253
+ end
254
+
255
+ # Deserializes the data based on type
256
+ # @param string type Data type
257
+ # @param string value Value to be deserialized
258
+ # @return [Object] Deserialized data
259
+ def _deserialize(type, value)
260
+ case type.to_sym
261
+ when :DateTime
262
+ DateTime.parse(value)
263
+ when :Date
264
+ Date.parse(value)
265
+ when :String
266
+ value.to_s
267
+ when :Integer
268
+ value.to_i
269
+ when :Float
270
+ value.to_f
271
+ when :BOOLEAN
272
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
273
+ true
274
+ else
275
+ false
276
+ end
277
+ when :Object
278
+ # generic object (usually a Hash), return directly
279
+ value
280
+ when /\AArray<(?<inner_type>.+)>\z/
281
+ inner_type = Regexp.last_match[:inner_type]
282
+ value.map { |v| _deserialize(inner_type, v) }
283
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
284
+ k_type = Regexp.last_match[:k_type]
285
+ v_type = Regexp.last_match[:v_type]
286
+ {}.tap do |hash|
287
+ value.each do |k, v|
288
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
289
+ end
290
+ end
291
+ else # model
292
+ temp_model = FormAPI.const_get(type).new
293
+ temp_model.build_from_hash(value)
294
+ end
295
+ end
296
+
297
+ # Returns the string representation of the object
298
+ # @return [String] String presentation of the object
299
+ def to_s
300
+ to_hash.to_s
301
+ end
302
+
303
+ # to_body is an alias to to_hash (backward compatibility)
304
+ # @return [Hash] Returns the object in the form of hash
305
+ def to_body
306
+ to_hash
307
+ end
308
+
309
+ # Returns the object in the form of hash
310
+ # @return [Hash] Returns the object in the form of hash
311
+ def to_hash
312
+ hash = {}
313
+ self.class.attribute_map.each_pair do |attr, param|
314
+ value = self.send(attr)
315
+ next if value.nil?
316
+ hash[param] = _to_hash(value)
317
+ end
318
+ hash
319
+ end
320
+
321
+ # Outputs non-array value in the form of hash
322
+ # For object, use to_hash. Otherwise, just return the value
323
+ # @param [Object] value Any valid value
324
+ # @return [Hash] Returns the value in the form of hash
325
+ def _to_hash(value)
326
+ if value.is_a?(Array)
327
+ value.compact.map { |v| _to_hash(v) }
328
+ elsif value.is_a?(Hash)
329
+ {}.tap do |hash|
330
+ value.each { |k, v| hash[k] = _to_hash(v) }
331
+ end
332
+ elsif value.respond_to? :to_hash
333
+ value.to_hash
334
+ else
335
+ value
336
+ end
337
+ end
338
+ end
339
+ end