pulp_npm_client 0.9.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,6 +19,83 @@ module PulpNpmClient
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
+ # Add a role
23
+ # Add a role for this object to users/groups.
24
+ # @param npm_npm_repository_href [String]
25
+ # @param nested_role [NestedRole]
26
+ # @param [Hash] opts the optional parameters
27
+ # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
28
+ # @return [NestedRoleResponse]
29
+ def add_role(npm_npm_repository_href, nested_role, opts = {})
30
+ data, _status_code, _headers = add_role_with_http_info(npm_npm_repository_href, nested_role, opts)
31
+ data
32
+ end
33
+
34
+ # Add a role
35
+ # Add a role for this object to users/groups.
36
+ # @param npm_npm_repository_href [String]
37
+ # @param nested_role [NestedRole]
38
+ # @param [Hash] opts the optional parameters
39
+ # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
40
+ # @return [Array<(NestedRoleResponse, Integer, Hash)>] NestedRoleResponse data, response status code and response headers
41
+ def add_role_with_http_info(npm_npm_repository_href, nested_role, opts = {})
42
+ if @api_client.config.debugging
43
+ @api_client.config.logger.debug 'Calling API: RepositoriesNpmApi.add_role ...'
44
+ end
45
+ # verify the required parameter 'npm_npm_repository_href' is set
46
+ if @api_client.config.client_side_validation && npm_npm_repository_href.nil?
47
+ fail ArgumentError, "Missing the required parameter 'npm_npm_repository_href' when calling RepositoriesNpmApi.add_role"
48
+ end
49
+ # verify the required parameter 'nested_role' is set
50
+ if @api_client.config.client_side_validation && nested_role.nil?
51
+ fail ArgumentError, "Missing the required parameter 'nested_role' when calling RepositoriesNpmApi.add_role"
52
+ end
53
+ # resource path
54
+ local_var_path = '{npm_npm_repository_href}add_role/'.sub('{' + 'npm_npm_repository_href' + '}', CGI.escape(npm_npm_repository_href.to_s).gsub('%2F', '/'))
55
+
56
+ # query parameters
57
+ query_params = opts[:query_params] || {}
58
+
59
+ # header parameters
60
+ header_params = opts[:header_params] || {}
61
+ # HTTP header 'Accept' (if needed)
62
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
63
+ # HTTP header 'Content-Type'
64
+ content_type = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'])
65
+ if !content_type.nil?
66
+ header_params['Content-Type'] = content_type
67
+ end
68
+ header_params[:'X-Task-Diagnostics'] = @api_client.build_collection_param(opts[:'x_task_diagnostics'], :csv) if !opts[:'x_task_diagnostics'].nil?
69
+
70
+ # form parameters
71
+ form_params = opts[:form_params] || {}
72
+
73
+ # http body (model)
74
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(nested_role)
75
+
76
+ # return_type
77
+ return_type = opts[:debug_return_type] || 'NestedRoleResponse'
78
+
79
+ # auth_names
80
+ auth_names = opts[:debug_auth_names] || ['basicAuth']
81
+
82
+ new_options = opts.merge(
83
+ :operation => :"RepositoriesNpmApi.add_role",
84
+ :header_params => header_params,
85
+ :query_params => query_params,
86
+ :form_params => form_params,
87
+ :body => post_body,
88
+ :auth_names => auth_names,
89
+ :return_type => return_type
90
+ )
91
+
92
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
93
+ if @api_client.config.debugging
94
+ @api_client.config.logger.debug "API called: RepositoriesNpmApi#add_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
95
+ end
96
+ return data, status_code, headers
97
+ end
98
+
22
99
  # Create a npm repository
23
100
  # A ViewSet for NpmRepository. Similar to the NpmPackageViewSet above, define endpoint_name, queryset and serializer, at a minimum.
24
101
  # @param npm_npm_repository [NpmNpmRepository]
@@ -334,6 +411,78 @@ module PulpNpmClient
334
411
  return data, status_code, headers
335
412
  end
336
413
 
414
+ # List roles
415
+ # List roles assigned to this object.
416
+ # @param npm_npm_repository_href [String]
417
+ # @param [Hash] opts the optional parameters
418
+ # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
419
+ # @option opts [Array<String>] :fields A list of fields to include in the response.
420
+ # @option opts [Array<String>] :exclude_fields A list of fields to exclude from the response.
421
+ # @return [ObjectRolesResponse]
422
+ def list_roles(npm_npm_repository_href, opts = {})
423
+ data, _status_code, _headers = list_roles_with_http_info(npm_npm_repository_href, opts)
424
+ data
425
+ end
426
+
427
+ # List roles
428
+ # List roles assigned to this object.
429
+ # @param npm_npm_repository_href [String]
430
+ # @param [Hash] opts the optional parameters
431
+ # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
432
+ # @option opts [Array<String>] :fields A list of fields to include in the response.
433
+ # @option opts [Array<String>] :exclude_fields A list of fields to exclude from the response.
434
+ # @return [Array<(ObjectRolesResponse, Integer, Hash)>] ObjectRolesResponse data, response status code and response headers
435
+ def list_roles_with_http_info(npm_npm_repository_href, opts = {})
436
+ if @api_client.config.debugging
437
+ @api_client.config.logger.debug 'Calling API: RepositoriesNpmApi.list_roles ...'
438
+ end
439
+ # verify the required parameter 'npm_npm_repository_href' is set
440
+ if @api_client.config.client_side_validation && npm_npm_repository_href.nil?
441
+ fail ArgumentError, "Missing the required parameter 'npm_npm_repository_href' when calling RepositoriesNpmApi.list_roles"
442
+ end
443
+ # resource path
444
+ local_var_path = '{npm_npm_repository_href}list_roles/'.sub('{' + 'npm_npm_repository_href' + '}', CGI.escape(npm_npm_repository_href.to_s).gsub('%2F', '/'))
445
+
446
+ # query parameters
447
+ query_params = opts[:query_params] || {}
448
+ query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :multi) if !opts[:'fields'].nil?
449
+ query_params[:'exclude_fields'] = @api_client.build_collection_param(opts[:'exclude_fields'], :multi) if !opts[:'exclude_fields'].nil?
450
+
451
+ # header parameters
452
+ header_params = opts[:header_params] || {}
453
+ # HTTP header 'Accept' (if needed)
454
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
455
+ header_params[:'X-Task-Diagnostics'] = @api_client.build_collection_param(opts[:'x_task_diagnostics'], :csv) if !opts[:'x_task_diagnostics'].nil?
456
+
457
+ # form parameters
458
+ form_params = opts[:form_params] || {}
459
+
460
+ # http body (model)
461
+ post_body = opts[:debug_body]
462
+
463
+ # return_type
464
+ return_type = opts[:debug_return_type] || 'ObjectRolesResponse'
465
+
466
+ # auth_names
467
+ auth_names = opts[:debug_auth_names] || ['basicAuth']
468
+
469
+ new_options = opts.merge(
470
+ :operation => :"RepositoriesNpmApi.list_roles",
471
+ :header_params => header_params,
472
+ :query_params => query_params,
473
+ :form_params => form_params,
474
+ :body => post_body,
475
+ :auth_names => auth_names,
476
+ :return_type => return_type
477
+ )
478
+
479
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
480
+ if @api_client.config.debugging
481
+ @api_client.config.logger.debug "API called: RepositoriesNpmApi#list_roles\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
482
+ end
483
+ return data, status_code, headers
484
+ end
485
+
337
486
  # Modify Repository Content
338
487
  # Trigger an asynchronous task to create a new repository version.
339
488
  # @param npm_npm_repository_href [String]
@@ -411,6 +560,78 @@ module PulpNpmClient
411
560
  return data, status_code, headers
412
561
  end
413
562
 
563
+ # List user permissions
564
+ # List permissions available to the current user on this object.
565
+ # @param npm_npm_repository_href [String]
566
+ # @param [Hash] opts the optional parameters
567
+ # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
568
+ # @option opts [Array<String>] :fields A list of fields to include in the response.
569
+ # @option opts [Array<String>] :exclude_fields A list of fields to exclude from the response.
570
+ # @return [MyPermissionsResponse]
571
+ def my_permissions(npm_npm_repository_href, opts = {})
572
+ data, _status_code, _headers = my_permissions_with_http_info(npm_npm_repository_href, opts)
573
+ data
574
+ end
575
+
576
+ # List user permissions
577
+ # List permissions available to the current user on this object.
578
+ # @param npm_npm_repository_href [String]
579
+ # @param [Hash] opts the optional parameters
580
+ # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
581
+ # @option opts [Array<String>] :fields A list of fields to include in the response.
582
+ # @option opts [Array<String>] :exclude_fields A list of fields to exclude from the response.
583
+ # @return [Array<(MyPermissionsResponse, Integer, Hash)>] MyPermissionsResponse data, response status code and response headers
584
+ def my_permissions_with_http_info(npm_npm_repository_href, opts = {})
585
+ if @api_client.config.debugging
586
+ @api_client.config.logger.debug 'Calling API: RepositoriesNpmApi.my_permissions ...'
587
+ end
588
+ # verify the required parameter 'npm_npm_repository_href' is set
589
+ if @api_client.config.client_side_validation && npm_npm_repository_href.nil?
590
+ fail ArgumentError, "Missing the required parameter 'npm_npm_repository_href' when calling RepositoriesNpmApi.my_permissions"
591
+ end
592
+ # resource path
593
+ local_var_path = '{npm_npm_repository_href}my_permissions/'.sub('{' + 'npm_npm_repository_href' + '}', CGI.escape(npm_npm_repository_href.to_s).gsub('%2F', '/'))
594
+
595
+ # query parameters
596
+ query_params = opts[:query_params] || {}
597
+ query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :multi) if !opts[:'fields'].nil?
598
+ query_params[:'exclude_fields'] = @api_client.build_collection_param(opts[:'exclude_fields'], :multi) if !opts[:'exclude_fields'].nil?
599
+
600
+ # header parameters
601
+ header_params = opts[:header_params] || {}
602
+ # HTTP header 'Accept' (if needed)
603
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
604
+ header_params[:'X-Task-Diagnostics'] = @api_client.build_collection_param(opts[:'x_task_diagnostics'], :csv) if !opts[:'x_task_diagnostics'].nil?
605
+
606
+ # form parameters
607
+ form_params = opts[:form_params] || {}
608
+
609
+ # http body (model)
610
+ post_body = opts[:debug_body]
611
+
612
+ # return_type
613
+ return_type = opts[:debug_return_type] || 'MyPermissionsResponse'
614
+
615
+ # auth_names
616
+ auth_names = opts[:debug_auth_names] || ['basicAuth']
617
+
618
+ new_options = opts.merge(
619
+ :operation => :"RepositoriesNpmApi.my_permissions",
620
+ :header_params => header_params,
621
+ :query_params => query_params,
622
+ :form_params => form_params,
623
+ :body => post_body,
624
+ :auth_names => auth_names,
625
+ :return_type => return_type
626
+ )
627
+
628
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
629
+ if @api_client.config.debugging
630
+ @api_client.config.logger.debug "API called: RepositoriesNpmApi#my_permissions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
631
+ end
632
+ return data, status_code, headers
633
+ end
634
+
414
635
  # Update a npm repository
415
636
  # Update the entity partially and trigger an asynchronous task if necessary
416
637
  # @param npm_npm_repository_href [String]
@@ -560,6 +781,83 @@ module PulpNpmClient
560
781
  return data, status_code, headers
561
782
  end
562
783
 
784
+ # Remove a role
785
+ # Remove a role for this object from users/groups.
786
+ # @param npm_npm_repository_href [String]
787
+ # @param nested_role [NestedRole]
788
+ # @param [Hash] opts the optional parameters
789
+ # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
790
+ # @return [NestedRoleResponse]
791
+ def remove_role(npm_npm_repository_href, nested_role, opts = {})
792
+ data, _status_code, _headers = remove_role_with_http_info(npm_npm_repository_href, nested_role, opts)
793
+ data
794
+ end
795
+
796
+ # Remove a role
797
+ # Remove a role for this object from users/groups.
798
+ # @param npm_npm_repository_href [String]
799
+ # @param nested_role [NestedRole]
800
+ # @param [Hash] opts the optional parameters
801
+ # @option opts [Array<String>] :x_task_diagnostics List of profilers to use on tasks.
802
+ # @return [Array<(NestedRoleResponse, Integer, Hash)>] NestedRoleResponse data, response status code and response headers
803
+ def remove_role_with_http_info(npm_npm_repository_href, nested_role, opts = {})
804
+ if @api_client.config.debugging
805
+ @api_client.config.logger.debug 'Calling API: RepositoriesNpmApi.remove_role ...'
806
+ end
807
+ # verify the required parameter 'npm_npm_repository_href' is set
808
+ if @api_client.config.client_side_validation && npm_npm_repository_href.nil?
809
+ fail ArgumentError, "Missing the required parameter 'npm_npm_repository_href' when calling RepositoriesNpmApi.remove_role"
810
+ end
811
+ # verify the required parameter 'nested_role' is set
812
+ if @api_client.config.client_side_validation && nested_role.nil?
813
+ fail ArgumentError, "Missing the required parameter 'nested_role' when calling RepositoriesNpmApi.remove_role"
814
+ end
815
+ # resource path
816
+ local_var_path = '{npm_npm_repository_href}remove_role/'.sub('{' + 'npm_npm_repository_href' + '}', CGI.escape(npm_npm_repository_href.to_s).gsub('%2F', '/'))
817
+
818
+ # query parameters
819
+ query_params = opts[:query_params] || {}
820
+
821
+ # header parameters
822
+ header_params = opts[:header_params] || {}
823
+ # HTTP header 'Accept' (if needed)
824
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
825
+ # HTTP header 'Content-Type'
826
+ content_type = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'])
827
+ if !content_type.nil?
828
+ header_params['Content-Type'] = content_type
829
+ end
830
+ header_params[:'X-Task-Diagnostics'] = @api_client.build_collection_param(opts[:'x_task_diagnostics'], :csv) if !opts[:'x_task_diagnostics'].nil?
831
+
832
+ # form parameters
833
+ form_params = opts[:form_params] || {}
834
+
835
+ # http body (model)
836
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(nested_role)
837
+
838
+ # return_type
839
+ return_type = opts[:debug_return_type] || 'NestedRoleResponse'
840
+
841
+ # auth_names
842
+ auth_names = opts[:debug_auth_names] || ['basicAuth']
843
+
844
+ new_options = opts.merge(
845
+ :operation => :"RepositoriesNpmApi.remove_role",
846
+ :header_params => header_params,
847
+ :query_params => query_params,
848
+ :form_params => form_params,
849
+ :body => post_body,
850
+ :auth_names => auth_names,
851
+ :return_type => return_type
852
+ )
853
+
854
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
855
+ if @api_client.config.debugging
856
+ @api_client.config.logger.debug "API called: RepositoriesNpmApi#remove_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
857
+ end
858
+ return data, status_code, headers
859
+ end
860
+
563
861
  # Set a label
564
862
  # Set a single pulp_label on the object to a specific value or null.
565
863
  # @param npm_npm_repository_href [String]
@@ -0,0 +1,223 @@
1
+ =begin
2
+ #Pulp 3 API
3
+
4
+ #Fetch, Upload, Organize, and Distribute Software Packages
5
+
6
+ The version of the OpenAPI document: v3
7
+ Contact: pulp-list@redhat.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.10.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PulpNpmClient
17
+ class MyPermissionsResponse
18
+ attr_accessor :permissions
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'permissions' => :'permissions'
24
+ }
25
+ end
26
+
27
+ # Returns all the JSON keys this model knows about
28
+ def self.acceptable_attributes
29
+ attribute_map.values
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'permissions' => :'Array<String>'
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 `PulpNpmClient::MyPermissionsResponse` 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 `PulpNpmClient::MyPermissionsResponse`. 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?(:'permissions')
61
+ if (value = attributes[:'permissions']).is_a?(Array)
62
+ self.permissions = value
63
+ end
64
+ else
65
+ self.permissions = nil
66
+ end
67
+ end
68
+
69
+ # Show invalid properties with the reasons. Usually used together with valid?
70
+ # @return Array for valid properties with the reasons
71
+ def list_invalid_properties
72
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
73
+ invalid_properties = Array.new
74
+ if @permissions.nil?
75
+ invalid_properties.push('invalid value for "permissions", permissions cannot be nil.')
76
+ end
77
+
78
+ invalid_properties
79
+ end
80
+
81
+ # Check to see if the all the properties in the model are valid
82
+ # @return true if the model is valid
83
+ def valid?
84
+ warn '[DEPRECATED] the `valid?` method is obsolete'
85
+ return false if @permissions.nil?
86
+ true
87
+ end
88
+
89
+ # Checks equality by comparing each attribute.
90
+ # @param [Object] Object to be compared
91
+ def ==(o)
92
+ return true if self.equal?(o)
93
+ self.class == o.class &&
94
+ permissions == o.permissions
95
+ end
96
+
97
+ # @see the `==` method
98
+ # @param [Object] Object to be compared
99
+ def eql?(o)
100
+ self == o
101
+ end
102
+
103
+ # Calculates hash code according to all attributes.
104
+ # @return [Integer] Hash code
105
+ def hash
106
+ [permissions].hash
107
+ end
108
+
109
+ # Builds the object from hash
110
+ # @param [Hash] attributes Model attributes in the form of hash
111
+ # @return [Object] Returns the model itself
112
+ def self.build_from_hash(attributes)
113
+ return nil unless attributes.is_a?(Hash)
114
+ attributes = attributes.transform_keys(&:to_sym)
115
+ transformed_hash = {}
116
+ openapi_types.each_pair do |key, type|
117
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
118
+ transformed_hash["#{key}"] = nil
119
+ elsif type =~ /\AArray<(.*)>/i
120
+ # check to ensure the input is an array given that the attribute
121
+ # is documented as an array but the input is not
122
+ if attributes[attribute_map[key]].is_a?(Array)
123
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
124
+ end
125
+ elsif !attributes[attribute_map[key]].nil?
126
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
127
+ end
128
+ end
129
+ new(transformed_hash)
130
+ end
131
+
132
+ # Deserializes the data based on type
133
+ # @param string type Data type
134
+ # @param string value Value to be deserialized
135
+ # @return [Object] Deserialized data
136
+ def self._deserialize(type, value)
137
+ case type.to_sym
138
+ when :Time
139
+ Time.parse(value)
140
+ when :Date
141
+ Date.parse(value)
142
+ when :String
143
+ value.to_s
144
+ when :Integer
145
+ value.to_i
146
+ when :Float
147
+ value.to_f
148
+ when :Boolean
149
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
150
+ true
151
+ else
152
+ false
153
+ end
154
+ when :Object
155
+ # generic object (usually a Hash), return directly
156
+ value
157
+ when /\AArray<(?<inner_type>.+)>\z/
158
+ inner_type = Regexp.last_match[:inner_type]
159
+ value.map { |v| _deserialize(inner_type, v) }
160
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
161
+ k_type = Regexp.last_match[:k_type]
162
+ v_type = Regexp.last_match[:v_type]
163
+ {}.tap do |hash|
164
+ value.each do |k, v|
165
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
166
+ end
167
+ end
168
+ else # model
169
+ # models (e.g. Pet) or oneOf
170
+ klass = PulpNpmClient.const_get(type)
171
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
172
+ end
173
+ end
174
+
175
+ # Returns the string representation of the object
176
+ # @return [String] String presentation of the object
177
+ def to_s
178
+ to_hash.to_s
179
+ end
180
+
181
+ # to_body is an alias to to_hash (backward compatibility)
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_body
184
+ to_hash
185
+ end
186
+
187
+ # Returns the object in the form of hash
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_hash
190
+ hash = {}
191
+ self.class.attribute_map.each_pair do |attr, param|
192
+ value = self.send(attr)
193
+ if value.nil?
194
+ is_nullable = self.class.openapi_nullable.include?(attr)
195
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
196
+ end
197
+
198
+ hash[param] = _to_hash(value)
199
+ end
200
+ hash
201
+ end
202
+
203
+ # Outputs non-array value in the form of hash
204
+ # For object, use to_hash. Otherwise, just return the value
205
+ # @param [Object] value Any valid value
206
+ # @return [Hash] Returns the value in the form of hash
207
+ def _to_hash(value)
208
+ if value.is_a?(Array)
209
+ value.compact.map { |v| _to_hash(v) }
210
+ elsif value.is_a?(Hash)
211
+ {}.tap do |hash|
212
+ value.each { |k, v| hash[k] = _to_hash(v) }
213
+ end
214
+ elsif value.respond_to? :to_hash
215
+ value.to_hash
216
+ else
217
+ value
218
+ end
219
+ end
220
+
221
+ end
222
+
223
+ end