ibm_cloud_resource_controller 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +148 -0
  4. data/Rakefile +10 -0
  5. data/docs/Credentials.md +25 -0
  6. data/docs/ErrorReport.md +23 -0
  7. data/docs/PlanHistoryItem.md +19 -0
  8. data/docs/Reclamation.md +45 -0
  9. data/docs/ReclamationActionsPost.md +19 -0
  10. data/docs/ReclamationsList.md +17 -0
  11. data/docs/ResourceAlias.md +57 -0
  12. data/docs/ResourceAliasPatch.md +17 -0
  13. data/docs/ResourceAliasPost.md +21 -0
  14. data/docs/ResourceAliasesApi.md +302 -0
  15. data/docs/ResourceAliasesList.md +21 -0
  16. data/docs/ResourceBinding.md +57 -0
  17. data/docs/ResourceBindingPatch.md +17 -0
  18. data/docs/ResourceBindingPost.md +25 -0
  19. data/docs/ResourceBindingPostParameters.md +17 -0
  20. data/docs/ResourceBindingsApi.md +300 -0
  21. data/docs/ResourceBindingsList.md +21 -0
  22. data/docs/ResourceInstance.md +81 -0
  23. data/docs/ResourceInstancePatch.md +23 -0
  24. data/docs/ResourceInstancePost.md +29 -0
  25. data/docs/ResourceInstancesApi.md +418 -0
  26. data/docs/ResourceInstancesList.md +21 -0
  27. data/docs/ResourceKey.md +53 -0
  28. data/docs/ResourceKeyPatch.md +17 -0
  29. data/docs/ResourceKeyPost.md +23 -0
  30. data/docs/ResourceKeysApi.md +298 -0
  31. data/docs/ResourceKeysList.md +21 -0
  32. data/docs/ResourceReclamationsApi.md +128 -0
  33. data/git_push.sh +58 -0
  34. data/ibm_cloud_resource_controller.gemspec +38 -0
  35. data/lib/ibm_cloud_resource_controller.rb +67 -0
  36. data/lib/ibm_cloud_resource_controller/api/resource_aliases_api.rb +363 -0
  37. data/lib/ibm_cloud_resource_controller/api/resource_bindings_api.rb +360 -0
  38. data/lib/ibm_cloud_resource_controller/api/resource_instances_api.rb +493 -0
  39. data/lib/ibm_cloud_resource_controller/api/resource_keys_api.rb +357 -0
  40. data/lib/ibm_cloud_resource_controller/api/resource_reclamations_api.rb +156 -0
  41. data/lib/ibm_cloud_resource_controller/api_client.rb +388 -0
  42. data/lib/ibm_cloud_resource_controller/api_error.rb +57 -0
  43. data/lib/ibm_cloud_resource_controller/configuration.rb +248 -0
  44. data/lib/ibm_cloud_resource_controller/models/credentials.rb +250 -0
  45. data/lib/ibm_cloud_resource_controller/models/error_report.rb +240 -0
  46. data/lib/ibm_cloud_resource_controller/models/plan_history_item.rb +230 -0
  47. data/lib/ibm_cloud_resource_controller/models/reclamation.rb +352 -0
  48. data/lib/ibm_cloud_resource_controller/models/reclamation_actions_post.rb +220 -0
  49. data/lib/ibm_cloud_resource_controller/models/reclamations_list.rb +212 -0
  50. data/lib/ibm_cloud_resource_controller/models/resource_alias.rb +410 -0
  51. data/lib/ibm_cloud_resource_controller/models/resource_alias_patch.rb +236 -0
  52. data/lib/ibm_cloud_resource_controller/models/resource_alias_post.rb +266 -0
  53. data/lib/ibm_cloud_resource_controller/models/resource_aliases_list.rb +247 -0
  54. data/lib/ibm_cloud_resource_controller/models/resource_binding.rb +410 -0
  55. data/lib/ibm_cloud_resource_controller/models/resource_binding_patch.rb +236 -0
  56. data/lib/ibm_cloud_resource_controller/models/resource_binding_post.rb +278 -0
  57. data/lib/ibm_cloud_resource_controller/models/resource_binding_post_parameters.rb +210 -0
  58. data/lib/ibm_cloud_resource_controller/models/resource_bindings_list.rb +247 -0
  59. data/lib/ibm_cloud_resource_controller/models/resource_instance.rb +536 -0
  60. data/lib/ibm_cloud_resource_controller/models/resource_instance_patch.rb +259 -0
  61. data/lib/ibm_cloud_resource_controller/models/resource_instance_post.rb +317 -0
  62. data/lib/ibm_cloud_resource_controller/models/resource_instances_list.rb +247 -0
  63. data/lib/ibm_cloud_resource_controller/models/resource_key.rb +390 -0
  64. data/lib/ibm_cloud_resource_controller/models/resource_key_patch.rb +236 -0
  65. data/lib/ibm_cloud_resource_controller/models/resource_key_post.rb +251 -0
  66. data/lib/ibm_cloud_resource_controller/models/resource_keys_list.rb +247 -0
  67. data/lib/ibm_cloud_resource_controller/version.rb +15 -0
  68. data/spec/api/resource_aliases_api_spec.rb +104 -0
  69. data/spec/api/resource_bindings_api_spec.rb +103 -0
  70. data/spec/api/resource_instances_api_spec.rb +130 -0
  71. data/spec/api/resource_keys_api_spec.rb +102 -0
  72. data/spec/api/resource_reclamations_api_spec.rb +62 -0
  73. data/spec/api_client_spec.rb +226 -0
  74. data/spec/configuration_spec.rb +42 -0
  75. data/spec/models/credentials_spec.rb +65 -0
  76. data/spec/models/error_report_spec.rb +59 -0
  77. data/spec/models/plan_history_item_spec.rb +47 -0
  78. data/spec/models/reclamation_actions_post_spec.rb +47 -0
  79. data/spec/models/reclamation_spec.rb +125 -0
  80. data/spec/models/reclamations_list_spec.rb +41 -0
  81. data/spec/models/resource_alias_patch_spec.rb +41 -0
  82. data/spec/models/resource_alias_post_spec.rb +53 -0
  83. data/spec/models/resource_alias_spec.rb +143 -0
  84. data/spec/models/resource_aliases_list_spec.rb +53 -0
  85. data/spec/models/resource_binding_patch_spec.rb +41 -0
  86. data/spec/models/resource_binding_post_parameters_spec.rb +41 -0
  87. data/spec/models/resource_binding_post_spec.rb +65 -0
  88. data/spec/models/resource_binding_spec.rb +137 -0
  89. data/spec/models/resource_bindings_list_spec.rb +53 -0
  90. data/spec/models/resource_instance_patch_spec.rb +59 -0
  91. data/spec/models/resource_instance_post_spec.rb +77 -0
  92. data/spec/models/resource_instance_spec.rb +191 -0
  93. data/spec/models/resource_instances_list_spec.rb +53 -0
  94. data/spec/models/resource_key_patch_spec.rb +41 -0
  95. data/spec/models/resource_key_post_spec.rb +59 -0
  96. data/spec/models/resource_key_spec.rb +125 -0
  97. data/spec/models/resource_keys_list_spec.rb +53 -0
  98. data/spec/spec_helper.rb +111 -0
  99. metadata +211 -0
@@ -0,0 +1,250 @@
1
+ =begin
2
+ #IBM Cloud Resource Controller API
3
+
4
+ #Manage lifecycle of your Cloud resources using Resource Controller APIs. Resources are provisioned globally in an account scope. Supports asynchronous provisioning of resources. Enables consumption of a global resource through a Cloud Foundry space in any region.
5
+
6
+ The version of the OpenAPI document: 2.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.0.0-beta2
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module IbmCloudResourceController
16
+ # The credentials for a resource.
17
+ class Credentials
18
+ # The API key for the credentials.
19
+ attr_accessor :apikey
20
+
21
+ # The optional description of the API key.
22
+ attr_accessor :iam_apikey_description
23
+
24
+ # The name of the API key.
25
+ attr_accessor :iam_apikey_name
26
+
27
+ # The Cloud Resource Name for the role of the credentials.
28
+ attr_accessor :iam_role_crn
29
+
30
+ # The Cloud Resource Name for the service ID of the credentials.
31
+ attr_accessor :iam_serviceid_crn
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'apikey' => :'apikey',
37
+ :'iam_apikey_description' => :'iam_apikey_description',
38
+ :'iam_apikey_name' => :'iam_apikey_name',
39
+ :'iam_role_crn' => :'iam_role_crn',
40
+ :'iam_serviceid_crn' => :'iam_serviceid_crn'
41
+ }
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.openapi_types
46
+ {
47
+ :'apikey' => :'String',
48
+ :'iam_apikey_description' => :'String',
49
+ :'iam_apikey_name' => :'String',
50
+ :'iam_role_crn' => :'String',
51
+ :'iam_serviceid_crn' => :'String'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ ])
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `IbmCloudResourceController::Credentials` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ attributes = attributes.each_with_object({}) { |(k, v), h|
70
+ if (!self.class.attribute_map.key?(k.to_sym))
71
+ fail ArgumentError, "`#{k}` is not a valid attribute in `IbmCloudResourceController::Credentials`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
+ end
73
+ h[k.to_sym] = v
74
+ }
75
+
76
+ if attributes.key?(:'apikey')
77
+ self.apikey = attributes[:'apikey']
78
+ end
79
+
80
+ if attributes.key?(:'iam_apikey_description')
81
+ self.iam_apikey_description = attributes[:'iam_apikey_description']
82
+ end
83
+
84
+ if attributes.key?(:'iam_apikey_name')
85
+ self.iam_apikey_name = attributes[:'iam_apikey_name']
86
+ end
87
+
88
+ if attributes.key?(:'iam_role_crn')
89
+ self.iam_role_crn = attributes[:'iam_role_crn']
90
+ end
91
+
92
+ if attributes.key?(:'iam_serviceid_crn')
93
+ self.iam_serviceid_crn = attributes[:'iam_serviceid_crn']
94
+ end
95
+ end
96
+
97
+ # Show invalid properties with the reasons. Usually used together with valid?
98
+ # @return Array for valid properties with the reasons
99
+ def list_invalid_properties
100
+ invalid_properties = Array.new
101
+ invalid_properties
102
+ end
103
+
104
+ # Check to see if the all the properties in the model are valid
105
+ # @return true if the model is valid
106
+ def valid?
107
+ true
108
+ end
109
+
110
+ # Checks equality by comparing each attribute.
111
+ # @param [Object] Object to be compared
112
+ def ==(o)
113
+ return true if self.equal?(o)
114
+ self.class == o.class &&
115
+ apikey == o.apikey &&
116
+ iam_apikey_description == o.iam_apikey_description &&
117
+ iam_apikey_name == o.iam_apikey_name &&
118
+ iam_role_crn == o.iam_role_crn &&
119
+ iam_serviceid_crn == o.iam_serviceid_crn
120
+ end
121
+
122
+ # @see the `==` method
123
+ # @param [Object] Object to be compared
124
+ def eql?(o)
125
+ self == o
126
+ end
127
+
128
+ # Calculates hash code according to all attributes.
129
+ # @return [Integer] Hash code
130
+ def hash
131
+ [apikey, iam_apikey_description, iam_apikey_name, iam_role_crn, iam_serviceid_crn].hash
132
+ end
133
+
134
+ # Builds the object from hash
135
+ # @param [Hash] attributes Model attributes in the form of hash
136
+ # @return [Object] Returns the model itself
137
+ def self.build_from_hash(attributes)
138
+ new.build_from_hash(attributes)
139
+ end
140
+
141
+ # Builds the object from hash
142
+ # @param [Hash] attributes Model attributes in the form of hash
143
+ # @return [Object] Returns the model itself
144
+ def build_from_hash(attributes)
145
+ return nil unless attributes.is_a?(Hash)
146
+ self.class.openapi_types.each_pair do |key, type|
147
+ if type =~ /\AArray<(.*)>/i
148
+ # check to ensure the input is an array given that the attribute
149
+ # is documented as an array but the input is not
150
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
151
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
152
+ end
153
+ elsif !attributes[self.class.attribute_map[key]].nil?
154
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
155
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
156
+ self.send("#{key}=", nil)
157
+ end
158
+ end
159
+
160
+ self
161
+ end
162
+
163
+ # Deserializes the data based on type
164
+ # @param string type Data type
165
+ # @param string value Value to be deserialized
166
+ # @return [Object] Deserialized data
167
+ def _deserialize(type, value)
168
+ case type.to_sym
169
+ when :DateTime
170
+ DateTime.parse(value)
171
+ when :Date
172
+ Date.parse(value)
173
+ when :String
174
+ value.to_s
175
+ when :Integer
176
+ value.to_i
177
+ when :Float
178
+ value.to_f
179
+ when :Boolean
180
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
181
+ true
182
+ else
183
+ false
184
+ end
185
+ when :Object
186
+ # generic object (usually a Hash), return directly
187
+ value
188
+ when /\AArray<(?<inner_type>.+)>\z/
189
+ inner_type = Regexp.last_match[:inner_type]
190
+ value.map { |v| _deserialize(inner_type, v) }
191
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
192
+ k_type = Regexp.last_match[:k_type]
193
+ v_type = Regexp.last_match[:v_type]
194
+ {}.tap do |hash|
195
+ value.each do |k, v|
196
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
197
+ end
198
+ end
199
+ else # model
200
+ IbmCloudResourceController.const_get(type).build_from_hash(value)
201
+ end
202
+ end
203
+
204
+ # Returns the string representation of the object
205
+ # @return [String] String presentation of the object
206
+ def to_s
207
+ to_hash.to_s
208
+ end
209
+
210
+ # to_body is an alias to to_hash (backward compatibility)
211
+ # @return [Hash] Returns the object in the form of hash
212
+ def to_body
213
+ to_hash
214
+ end
215
+
216
+ # Returns the object in the form of hash
217
+ # @return [Hash] Returns the object in the form of hash
218
+ def to_hash
219
+ hash = {}
220
+ self.class.attribute_map.each_pair do |attr, param|
221
+ value = self.send(attr)
222
+ if value.nil?
223
+ is_nullable = self.class.openapi_nullable.include?(attr)
224
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
225
+ end
226
+
227
+ hash[param] = _to_hash(value)
228
+ end
229
+ hash
230
+ end
231
+
232
+ # Outputs non-array value in the form of hash
233
+ # For object, use to_hash. Otherwise, just return the value
234
+ # @param [Object] value Any valid value
235
+ # @return [Hash] Returns the value in the form of hash
236
+ def _to_hash(value)
237
+ if value.is_a?(Array)
238
+ value.compact.map { |v| _to_hash(v) }
239
+ elsif value.is_a?(Hash)
240
+ {}.tap do |hash|
241
+ value.each { |k, v| hash[k] = _to_hash(v) }
242
+ end
243
+ elsif value.respond_to? :to_hash
244
+ value.to_hash
245
+ else
246
+ value
247
+ end
248
+ end
249
+ end
250
+ end
@@ -0,0 +1,240 @@
1
+ =begin
2
+ #IBM Cloud Resource Controller API
3
+
4
+ #Manage lifecycle of your Cloud resources using Resource Controller APIs. Resources are provisioned globally in an account scope. Supports asynchronous provisioning of resources. Enables consumption of a global resource through a Cloud Foundry space in any region.
5
+
6
+ The version of the OpenAPI document: 2.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.0.0-beta2
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module IbmCloudResourceController
16
+ # Description of an error that occurred in a service request.
17
+ class ErrorReport
18
+ # The error code encountered.
19
+ attr_accessor :error_code
20
+
21
+ # The error message.
22
+ attr_accessor :message
23
+
24
+ # The status code.
25
+ attr_accessor :status_code
26
+
27
+ # The transaction-id of the request.
28
+ attr_accessor :transaction_id
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'error_code' => :'error_code',
34
+ :'message' => :'message',
35
+ :'status_code' => :'status_code',
36
+ :'transaction_id' => :'transaction_id'
37
+ }
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.openapi_types
42
+ {
43
+ :'error_code' => :'String',
44
+ :'message' => :'String',
45
+ :'status_code' => :'String',
46
+ :'transaction_id' => :'String'
47
+ }
48
+ end
49
+
50
+ # List of attributes with nullable: true
51
+ def self.openapi_nullable
52
+ Set.new([
53
+ ])
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ if (!attributes.is_a?(Hash))
60
+ fail ArgumentError, "The input argument (attributes) must be a hash in `IbmCloudResourceController::ErrorReport` initialize method"
61
+ end
62
+
63
+ # check to see if the attribute exists and convert string to symbol for hash key
64
+ attributes = attributes.each_with_object({}) { |(k, v), h|
65
+ if (!self.class.attribute_map.key?(k.to_sym))
66
+ fail ArgumentError, "`#{k}` is not a valid attribute in `IbmCloudResourceController::ErrorReport`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
67
+ end
68
+ h[k.to_sym] = v
69
+ }
70
+
71
+ if attributes.key?(:'error_code')
72
+ self.error_code = attributes[:'error_code']
73
+ end
74
+
75
+ if attributes.key?(:'message')
76
+ self.message = attributes[:'message']
77
+ end
78
+
79
+ if attributes.key?(:'status_code')
80
+ self.status_code = attributes[:'status_code']
81
+ end
82
+
83
+ if attributes.key?(:'transaction_id')
84
+ self.transaction_id = attributes[:'transaction_id']
85
+ end
86
+ end
87
+
88
+ # Show invalid properties with the reasons. Usually used together with valid?
89
+ # @return Array for valid properties with the reasons
90
+ def list_invalid_properties
91
+ invalid_properties = Array.new
92
+ invalid_properties
93
+ end
94
+
95
+ # Check to see if the all the properties in the model are valid
96
+ # @return true if the model is valid
97
+ def valid?
98
+ true
99
+ end
100
+
101
+ # Checks equality by comparing each attribute.
102
+ # @param [Object] Object to be compared
103
+ def ==(o)
104
+ return true if self.equal?(o)
105
+ self.class == o.class &&
106
+ error_code == o.error_code &&
107
+ message == o.message &&
108
+ status_code == o.status_code &&
109
+ transaction_id == o.transaction_id
110
+ end
111
+
112
+ # @see the `==` method
113
+ # @param [Object] Object to be compared
114
+ def eql?(o)
115
+ self == o
116
+ end
117
+
118
+ # Calculates hash code according to all attributes.
119
+ # @return [Integer] Hash code
120
+ def hash
121
+ [error_code, message, status_code, transaction_id].hash
122
+ end
123
+
124
+ # Builds the object from hash
125
+ # @param [Hash] attributes Model attributes in the form of hash
126
+ # @return [Object] Returns the model itself
127
+ def self.build_from_hash(attributes)
128
+ new.build_from_hash(attributes)
129
+ end
130
+
131
+ # Builds the object from hash
132
+ # @param [Hash] attributes Model attributes in the form of hash
133
+ # @return [Object] Returns the model itself
134
+ def build_from_hash(attributes)
135
+ return nil unless attributes.is_a?(Hash)
136
+ self.class.openapi_types.each_pair do |key, type|
137
+ if type =~ /\AArray<(.*)>/i
138
+ # check to ensure the input is an array given that the attribute
139
+ # is documented as an array but the input is not
140
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
141
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
142
+ end
143
+ elsif !attributes[self.class.attribute_map[key]].nil?
144
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
145
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
146
+ self.send("#{key}=", nil)
147
+ end
148
+ end
149
+
150
+ self
151
+ end
152
+
153
+ # Deserializes the data based on type
154
+ # @param string type Data type
155
+ # @param string value Value to be deserialized
156
+ # @return [Object] Deserialized data
157
+ def _deserialize(type, value)
158
+ case type.to_sym
159
+ when :DateTime
160
+ DateTime.parse(value)
161
+ when :Date
162
+ Date.parse(value)
163
+ when :String
164
+ value.to_s
165
+ when :Integer
166
+ value.to_i
167
+ when :Float
168
+ value.to_f
169
+ when :Boolean
170
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
171
+ true
172
+ else
173
+ false
174
+ end
175
+ when :Object
176
+ # generic object (usually a Hash), return directly
177
+ value
178
+ when /\AArray<(?<inner_type>.+)>\z/
179
+ inner_type = Regexp.last_match[:inner_type]
180
+ value.map { |v| _deserialize(inner_type, v) }
181
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
182
+ k_type = Regexp.last_match[:k_type]
183
+ v_type = Regexp.last_match[:v_type]
184
+ {}.tap do |hash|
185
+ value.each do |k, v|
186
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
187
+ end
188
+ end
189
+ else # model
190
+ IbmCloudResourceController.const_get(type).build_from_hash(value)
191
+ end
192
+ end
193
+
194
+ # Returns the string representation of the object
195
+ # @return [String] String presentation of the object
196
+ def to_s
197
+ to_hash.to_s
198
+ end
199
+
200
+ # to_body is an alias to to_hash (backward compatibility)
201
+ # @return [Hash] Returns the object in the form of hash
202
+ def to_body
203
+ to_hash
204
+ end
205
+
206
+ # Returns the object in the form of hash
207
+ # @return [Hash] Returns the object in the form of hash
208
+ def to_hash
209
+ hash = {}
210
+ self.class.attribute_map.each_pair do |attr, param|
211
+ value = self.send(attr)
212
+ if value.nil?
213
+ is_nullable = self.class.openapi_nullable.include?(attr)
214
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
215
+ end
216
+
217
+ hash[param] = _to_hash(value)
218
+ end
219
+ hash
220
+ end
221
+
222
+ # Outputs non-array value in the form of hash
223
+ # For object, use to_hash. Otherwise, just return the value
224
+ # @param [Object] value Any valid value
225
+ # @return [Hash] Returns the value in the form of hash
226
+ def _to_hash(value)
227
+ if value.is_a?(Array)
228
+ value.compact.map { |v| _to_hash(v) }
229
+ elsif value.is_a?(Hash)
230
+ {}.tap do |hash|
231
+ value.each { |k, v| hash[k] = _to_hash(v) }
232
+ end
233
+ elsif value.respond_to? :to_hash
234
+ value.to_hash
235
+ else
236
+ value
237
+ end
238
+ end
239
+ end
240
+ end