turnkey_client 0.0.4 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/lib/turnkey_client/api/organizations_api.rb +58 -0
  3. data/lib/turnkey_client/api/policies_api.rb +58 -0
  4. data/lib/turnkey_client/api/private_keys_api.rb +58 -0
  5. data/lib/turnkey_client/api/sessions_api.rb +116 -0
  6. data/lib/turnkey_client/api/signing_api.rb +58 -0
  7. data/lib/turnkey_client/api/users_api.rb +232 -0
  8. data/lib/turnkey_client/api/wallets_api.rb +58 -0
  9. data/lib/turnkey_client/models/activity.rb +13 -4
  10. data/lib/turnkey_client/models/activity_type.rb +13 -0
  11. data/lib/turnkey_client/models/any.rb +200 -0
  12. data/lib/turnkey_client/models/api_key_curve.rb +28 -0
  13. data/lib/turnkey_client/models/api_key_params_v2.rb +250 -0
  14. data/lib/turnkey_client/models/config.rb +216 -0
  15. data/lib/turnkey_client/models/create_api_keys_intent_v2.rb +228 -0
  16. data/lib/turnkey_client/models/create_api_keys_request.rb +2 -2
  17. data/lib/turnkey_client/models/create_oauth_providers_intent.rb +228 -0
  18. data/lib/turnkey_client/models/create_oauth_providers_request.rb +288 -0
  19. data/lib/turnkey_client/models/create_oauth_providers_result.rb +213 -0
  20. data/lib/turnkey_client/models/create_policies_intent.rb +213 -0
  21. data/lib/turnkey_client/models/create_policies_request.rb +288 -0
  22. data/lib/turnkey_client/models/create_policies_result.rb +213 -0
  23. data/lib/turnkey_client/models/create_read_only_session_intent.rb +196 -0
  24. data/lib/turnkey_client/models/create_read_only_session_request.rb +288 -0
  25. data/lib/turnkey_client/models/create_read_only_session_result.rb +286 -0
  26. data/lib/turnkey_client/models/create_read_write_session_intent.rb +246 -0
  27. data/lib/turnkey_client/models/create_read_write_session_request.rb +288 -0
  28. data/lib/turnkey_client/models/create_read_write_session_result.rb +286 -0
  29. data/lib/turnkey_client/models/create_sub_organization_intent_v5.rb +272 -0
  30. data/lib/turnkey_client/models/create_sub_organization_intent_v6.rb +272 -0
  31. data/lib/turnkey_client/models/create_sub_organization_request.rb +2 -2
  32. data/lib/turnkey_client/models/create_sub_organization_result_v5.rb +230 -0
  33. data/lib/turnkey_client/models/create_sub_organization_result_v6.rb +230 -0
  34. data/lib/turnkey_client/models/credential_type.rb +3 -0
  35. data/lib/turnkey_client/models/delete_oauth_providers_intent.rb +228 -0
  36. data/lib/turnkey_client/models/delete_oauth_providers_request.rb +288 -0
  37. data/lib/turnkey_client/models/delete_oauth_providers_result.rb +213 -0
  38. data/lib/turnkey_client/models/delete_private_keys_intent.rb +223 -0
  39. data/lib/turnkey_client/models/delete_private_keys_request.rb +288 -0
  40. data/lib/turnkey_client/models/delete_private_keys_result.rb +213 -0
  41. data/lib/turnkey_client/models/delete_wallets_intent.rb +223 -0
  42. data/lib/turnkey_client/models/delete_wallets_request.rb +288 -0
  43. data/lib/turnkey_client/models/delete_wallets_result.rb +213 -0
  44. data/lib/turnkey_client/models/email_auth_intent.rb +14 -4
  45. data/lib/turnkey_client/models/email_auth_intent_v2.rb +265 -0
  46. data/lib/turnkey_client/models/email_auth_request.rb +2 -2
  47. data/lib/turnkey_client/models/email_customization_params.rb +1 -1
  48. data/lib/turnkey_client/models/external_data_v1_quorum.rb +228 -0
  49. data/lib/turnkey_client/models/get_oauth_providers_request.rb +221 -0
  50. data/lib/turnkey_client/models/get_oauth_providers_response.rb +213 -0
  51. data/lib/turnkey_client/models/get_organization_configs_request.rb +211 -0
  52. data/lib/turnkey_client/models/get_organization_configs_response.rb +210 -0
  53. data/lib/turnkey_client/models/get_sub_org_ids_request.rb +1 -1
  54. data/lib/turnkey_client/models/intent.rb +121 -9
  55. data/lib/turnkey_client/models/oauth_intent.rb +246 -0
  56. data/lib/turnkey_client/models/oauth_provider.rb +299 -0
  57. data/lib/turnkey_client/models/oauth_provider_params.rb +226 -0
  58. data/lib/turnkey_client/models/oauth_request.rb +288 -0
  59. data/lib/turnkey_client/models/oauth_result.rb +241 -0
  60. data/lib/turnkey_client/models/result.rb +103 -4
  61. data/lib/turnkey_client/models/root_user_params_v2.rb +272 -0
  62. data/lib/turnkey_client/models/root_user_params_v3.rb +272 -0
  63. data/lib/turnkey_client/models/sign_raw_payloads_intent.rb +256 -0
  64. data/lib/turnkey_client/models/sign_raw_payloads_request.rb +288 -0
  65. data/lib/turnkey_client/models/sign_raw_payloads_result.rb +207 -0
  66. data/lib/turnkey_client/models/status.rb +225 -0
  67. data/lib/turnkey_client/models/user.rb +18 -1
  68. data/lib/turnkey_client/models/wallet_account.rb +4 -19
  69. data/lib/turnkey_client/version.rb +1 -1
  70. data/lib/turnkey_client.rb +47 -0
  71. data/turnkey_client-0.0.4.gem +0 -0
  72. data/turnkey_client-0.0.7.gem +0 -0
  73. metadata +51 -2
@@ -0,0 +1,272 @@
1
+ =begin
2
+ #API Reference
3
+
4
+ #Review our [API Introduction](../api-introduction) to get started.
5
+
6
+ OpenAPI spec version: 1.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ =end
10
+
11
+ require 'date'
12
+
13
+ module TurnkeyClient
14
+ class CreateSubOrganizationIntentV6
15
+ # Name for this sub-organization
16
+ attr_accessor :sub_organization_name
17
+
18
+ # Root users to create within this sub-organization
19
+ attr_accessor :root_users
20
+
21
+ # The threshold of unique approvals to reach root quorum. This value must be less than or equal to the number of root users
22
+ attr_accessor :root_quorum_threshold
23
+
24
+ attr_accessor :wallet
25
+
26
+ # Disable email recovery for the sub-organization
27
+ attr_accessor :disable_email_recovery
28
+
29
+ # Disable email auth for the sub-organization
30
+ attr_accessor :disable_email_auth
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'sub_organization_name' => :'subOrganizationName',
36
+ :'root_users' => :'rootUsers',
37
+ :'root_quorum_threshold' => :'rootQuorumThreshold',
38
+ :'wallet' => :'wallet',
39
+ :'disable_email_recovery' => :'disableEmailRecovery',
40
+ :'disable_email_auth' => :'disableEmailAuth'
41
+ }
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.openapi_types
46
+ {
47
+ :'sub_organization_name' => :'Object',
48
+ :'root_users' => :'Object',
49
+ :'root_quorum_threshold' => :'Object',
50
+ :'wallet' => :'Object',
51
+ :'disable_email_recovery' => :'Object',
52
+ :'disable_email_auth' => :'Object'
53
+ }
54
+ end
55
+
56
+ # List of attributes with nullable: true
57
+ def self.openapi_nullable
58
+ Set.new([
59
+ ])
60
+ end
61
+
62
+ # Initializes the object
63
+ # @param [Hash] attributes Model attributes in the form of hash
64
+ def initialize(attributes = {})
65
+ if (!attributes.is_a?(Hash))
66
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TurnkeyClient::CreateSubOrganizationIntentV6` initialize method"
67
+ end
68
+
69
+ # check to see if the attribute exists and convert string to symbol for hash key
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!self.class.attribute_map.key?(k.to_sym))
72
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TurnkeyClient::CreateSubOrganizationIntentV6`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
73
+ end
74
+ h[k.to_sym] = v
75
+ }
76
+
77
+ if attributes.key?(:'sub_organization_name')
78
+ self.sub_organization_name = attributes[:'sub_organization_name']
79
+ end
80
+
81
+ if attributes.key?(:'root_users')
82
+ if (value = attributes[:'root_users']).is_a?(Array)
83
+ self.root_users = value
84
+ end
85
+ end
86
+
87
+ if attributes.key?(:'root_quorum_threshold')
88
+ self.root_quorum_threshold = attributes[:'root_quorum_threshold']
89
+ end
90
+
91
+ if attributes.key?(:'wallet')
92
+ self.wallet = attributes[:'wallet']
93
+ end
94
+
95
+ if attributes.key?(:'disable_email_recovery')
96
+ self.disable_email_recovery = attributes[:'disable_email_recovery']
97
+ end
98
+
99
+ if attributes.key?(:'disable_email_auth')
100
+ self.disable_email_auth = attributes[:'disable_email_auth']
101
+ end
102
+ end
103
+
104
+ # Show invalid properties with the reasons. Usually used together with valid?
105
+ # @return Array for valid properties with the reasons
106
+ def list_invalid_properties
107
+ invalid_properties = Array.new
108
+ if @sub_organization_name.nil?
109
+ invalid_properties.push('invalid value for "sub_organization_name", sub_organization_name cannot be nil.')
110
+ end
111
+
112
+ if @root_users.nil?
113
+ invalid_properties.push('invalid value for "root_users", root_users cannot be nil.')
114
+ end
115
+
116
+ if @root_quorum_threshold.nil?
117
+ invalid_properties.push('invalid value for "root_quorum_threshold", root_quorum_threshold cannot be nil.')
118
+ end
119
+
120
+ invalid_properties
121
+ end
122
+
123
+ # Check to see if the all the properties in the model are valid
124
+ # @return true if the model is valid
125
+ def valid?
126
+ return false if @sub_organization_name.nil?
127
+ return false if @root_users.nil?
128
+ return false if @root_quorum_threshold.nil?
129
+ true
130
+ end
131
+
132
+ # Checks equality by comparing each attribute.
133
+ # @param [Object] Object to be compared
134
+ def ==(o)
135
+ return true if self.equal?(o)
136
+ self.class == o.class &&
137
+ sub_organization_name == o.sub_organization_name &&
138
+ root_users == o.root_users &&
139
+ root_quorum_threshold == o.root_quorum_threshold &&
140
+ wallet == o.wallet &&
141
+ disable_email_recovery == o.disable_email_recovery &&
142
+ disable_email_auth == o.disable_email_auth
143
+ end
144
+
145
+ # @see the `==` method
146
+ # @param [Object] Object to be compared
147
+ def eql?(o)
148
+ self == o
149
+ end
150
+
151
+ # Calculates hash code according to all attributes.
152
+ # @return [Integer] Hash code
153
+ def hash
154
+ [sub_organization_name, root_users, root_quorum_threshold, wallet, disable_email_recovery, disable_email_auth].hash
155
+ end
156
+
157
+ # Builds the object from hash
158
+ # @param [Hash] attributes Model attributes in the form of hash
159
+ # @return [Object] Returns the model itself
160
+ def self.build_from_hash(attributes)
161
+ new.build_from_hash(attributes)
162
+ end
163
+
164
+ # Builds the object from hash
165
+ # @param [Hash] attributes Model attributes in the form of hash
166
+ # @return [Object] Returns the model itself
167
+ def build_from_hash(attributes)
168
+ return nil unless attributes.is_a?(Hash)
169
+ self.class.openapi_types.each_pair do |key, type|
170
+ if type =~ /\AArray<(.*)>/i
171
+ # check to ensure the input is an array given that the attribute
172
+ # is documented as an array but the input is not
173
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
174
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
175
+ end
176
+ elsif !attributes[self.class.attribute_map[key]].nil?
177
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
178
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
179
+ self.send("#{key}=", nil)
180
+ end
181
+ end
182
+
183
+ self
184
+ end
185
+
186
+ # Deserializes the data based on type
187
+ # @param string type Data type
188
+ # @param string value Value to be deserialized
189
+ # @return [Object] Deserialized data
190
+ def _deserialize(type, value)
191
+ case type.to_sym
192
+ when :DateTime
193
+ DateTime.parse(value)
194
+ when :Date
195
+ Date.parse(value)
196
+ when :String
197
+ value.to_s
198
+ when :Integer
199
+ value.to_i
200
+ when :Float
201
+ value.to_f
202
+ when :Boolean
203
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
204
+ true
205
+ else
206
+ false
207
+ end
208
+ when :Object
209
+ # generic object (usually a Hash), return directly
210
+ value
211
+ when /\AArray<(?<inner_type>.+)>\z/
212
+ inner_type = Regexp.last_match[:inner_type]
213
+ value.map { |v| _deserialize(inner_type, v) }
214
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
215
+ k_type = Regexp.last_match[:k_type]
216
+ v_type = Regexp.last_match[:v_type]
217
+ {}.tap do |hash|
218
+ value.each do |k, v|
219
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
220
+ end
221
+ end
222
+ else # model
223
+ TurnkeyClient.const_get(type).build_from_hash(value)
224
+ end
225
+ end
226
+
227
+ # Returns the string representation of the object
228
+ # @return [String] String presentation of the object
229
+ def to_s
230
+ to_hash.to_s
231
+ end
232
+
233
+ # to_body is an alias to to_hash (backward compatibility)
234
+ # @return [Hash] Returns the object in the form of hash
235
+ def to_body
236
+ to_hash
237
+ end
238
+
239
+ # Returns the object in the form of hash
240
+ # @return [Hash] Returns the object in the form of hash
241
+ def to_hash
242
+ hash = {}
243
+ self.class.attribute_map.each_pair do |attr, param|
244
+ value = self.send(attr)
245
+ if value.nil?
246
+ is_nullable = self.class.openapi_nullable.include?(attr)
247
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
248
+ end
249
+
250
+ hash[param] = _to_hash(value)
251
+ end
252
+ hash
253
+ end
254
+
255
+ # Outputs non-array value in the form of hash
256
+ # For object, use to_hash. Otherwise, just return the value
257
+ # @param [Object] value Any valid value
258
+ # @return [Hash] Returns the value in the form of hash
259
+ def _to_hash(value)
260
+ if value.is_a?(Array)
261
+ value.compact.map { |v| _to_hash(v) }
262
+ elsif value.is_a?(Hash)
263
+ {}.tap do |hash|
264
+ value.each { |k, v| hash[k] = _to_hash(v) }
265
+ end
266
+ elsif value.respond_to? :to_hash
267
+ value.to_hash
268
+ else
269
+ value
270
+ end
271
+ end end
272
+ end
@@ -129,7 +129,7 @@ module TurnkeyClient
129
129
  # @return true if the model is valid
130
130
  def valid?
131
131
  return false if @type.nil?
132
- type_validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V4'])
132
+ type_validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V6'])
133
133
  return false unless type_validator.valid?(@type)
134
134
  return false if @timestamp_ms.nil?
135
135
  return false if @organization_id.nil?
@@ -140,7 +140,7 @@ module TurnkeyClient
140
140
  # Custom attribute writer method checking allowed values (enum).
141
141
  # @param [Object] type Object to be assigned
142
142
  def type=(type)
143
- validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V4'])
143
+ validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V6'])
144
144
  unless validator.valid?(type)
145
145
  fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
146
146
  end
@@ -0,0 +1,230 @@
1
+ =begin
2
+ #API Reference
3
+
4
+ #Review our [API Introduction](../api-introduction) to get started.
5
+
6
+ OpenAPI spec version: 1.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ =end
10
+
11
+ require 'date'
12
+
13
+ module TurnkeyClient
14
+ class CreateSubOrganizationResultV5
15
+ attr_accessor :sub_organization_id
16
+
17
+ attr_accessor :wallet
18
+
19
+ attr_accessor :root_user_ids
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'sub_organization_id' => :'subOrganizationId',
25
+ :'wallet' => :'wallet',
26
+ :'root_user_ids' => :'rootUserIds'
27
+ }
28
+ end
29
+
30
+ # Attribute type mapping.
31
+ def self.openapi_types
32
+ {
33
+ :'sub_organization_id' => :'Object',
34
+ :'wallet' => :'Object',
35
+ :'root_user_ids' => :'Object'
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TurnkeyClient::CreateSubOrganizationResultV5` initialize method"
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TurnkeyClient::CreateSubOrganizationResultV5`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
59
+
60
+ if attributes.key?(:'sub_organization_id')
61
+ self.sub_organization_id = attributes[:'sub_organization_id']
62
+ end
63
+
64
+ if attributes.key?(:'wallet')
65
+ self.wallet = attributes[:'wallet']
66
+ end
67
+
68
+ if attributes.key?(:'root_user_ids')
69
+ if (value = attributes[:'root_user_ids']).is_a?(Array)
70
+ self.root_user_ids = value
71
+ end
72
+ end
73
+ end
74
+
75
+ # Show invalid properties with the reasons. Usually used together with valid?
76
+ # @return Array for valid properties with the reasons
77
+ def list_invalid_properties
78
+ invalid_properties = Array.new
79
+ if @sub_organization_id.nil?
80
+ invalid_properties.push('invalid value for "sub_organization_id", sub_organization_id cannot be nil.')
81
+ end
82
+
83
+ invalid_properties
84
+ end
85
+
86
+ # Check to see if the all the properties in the model are valid
87
+ # @return true if the model is valid
88
+ def valid?
89
+ return false if @sub_organization_id.nil?
90
+ true
91
+ end
92
+
93
+ # Checks equality by comparing each attribute.
94
+ # @param [Object] Object to be compared
95
+ def ==(o)
96
+ return true if self.equal?(o)
97
+ self.class == o.class &&
98
+ sub_organization_id == o.sub_organization_id &&
99
+ wallet == o.wallet &&
100
+ root_user_ids == o.root_user_ids
101
+ end
102
+
103
+ # @see the `==` method
104
+ # @param [Object] Object to be compared
105
+ def eql?(o)
106
+ self == o
107
+ end
108
+
109
+ # Calculates hash code according to all attributes.
110
+ # @return [Integer] Hash code
111
+ def hash
112
+ [sub_organization_id, wallet, root_user_ids].hash
113
+ end
114
+
115
+ # Builds the object from hash
116
+ # @param [Hash] attributes Model attributes in the form of hash
117
+ # @return [Object] Returns the model itself
118
+ def self.build_from_hash(attributes)
119
+ new.build_from_hash(attributes)
120
+ end
121
+
122
+ # Builds the object from hash
123
+ # @param [Hash] attributes Model attributes in the form of hash
124
+ # @return [Object] Returns the model itself
125
+ def build_from_hash(attributes)
126
+ return nil unless attributes.is_a?(Hash)
127
+ self.class.openapi_types.each_pair do |key, type|
128
+ if type =~ /\AArray<(.*)>/i
129
+ # check to ensure the input is an array given that the attribute
130
+ # is documented as an array but the input is not
131
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
132
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
133
+ end
134
+ elsif !attributes[self.class.attribute_map[key]].nil?
135
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
136
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
137
+ self.send("#{key}=", nil)
138
+ end
139
+ end
140
+
141
+ self
142
+ end
143
+
144
+ # Deserializes the data based on type
145
+ # @param string type Data type
146
+ # @param string value Value to be deserialized
147
+ # @return [Object] Deserialized data
148
+ def _deserialize(type, value)
149
+ case type.to_sym
150
+ when :DateTime
151
+ DateTime.parse(value)
152
+ when :Date
153
+ Date.parse(value)
154
+ when :String
155
+ value.to_s
156
+ when :Integer
157
+ value.to_i
158
+ when :Float
159
+ value.to_f
160
+ when :Boolean
161
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
162
+ true
163
+ else
164
+ false
165
+ end
166
+ when :Object
167
+ # generic object (usually a Hash), return directly
168
+ value
169
+ when /\AArray<(?<inner_type>.+)>\z/
170
+ inner_type = Regexp.last_match[:inner_type]
171
+ value.map { |v| _deserialize(inner_type, v) }
172
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
173
+ k_type = Regexp.last_match[:k_type]
174
+ v_type = Regexp.last_match[:v_type]
175
+ {}.tap do |hash|
176
+ value.each do |k, v|
177
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
178
+ end
179
+ end
180
+ else # model
181
+ TurnkeyClient.const_get(type).build_from_hash(value)
182
+ end
183
+ end
184
+
185
+ # Returns the string representation of the object
186
+ # @return [String] String presentation of the object
187
+ def to_s
188
+ to_hash.to_s
189
+ end
190
+
191
+ # to_body is an alias to to_hash (backward compatibility)
192
+ # @return [Hash] Returns the object in the form of hash
193
+ def to_body
194
+ to_hash
195
+ end
196
+
197
+ # Returns the object in the form of hash
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_hash
200
+ hash = {}
201
+ self.class.attribute_map.each_pair do |attr, param|
202
+ value = self.send(attr)
203
+ if value.nil?
204
+ is_nullable = self.class.openapi_nullable.include?(attr)
205
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
206
+ end
207
+
208
+ hash[param] = _to_hash(value)
209
+ end
210
+ hash
211
+ end
212
+
213
+ # Outputs non-array value in the form of hash
214
+ # For object, use to_hash. Otherwise, just return the value
215
+ # @param [Object] value Any valid value
216
+ # @return [Hash] Returns the value in the form of hash
217
+ def _to_hash(value)
218
+ if value.is_a?(Array)
219
+ value.compact.map { |v| _to_hash(v) }
220
+ elsif value.is_a?(Hash)
221
+ {}.tap do |hash|
222
+ value.each { |k, v| hash[k] = _to_hash(v) }
223
+ end
224
+ elsif value.respond_to? :to_hash
225
+ value.to_hash
226
+ else
227
+ value
228
+ end
229
+ end end
230
+ end