ddx_interactions_api 0.1.0.pre.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.
Files changed (65) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +160 -0
  3. data/lib/ddx_interactions_api/api/authentication_details_api.rb +85 -0
  4. data/lib/ddx_interactions_api/api/interactions_api.rb +386 -0
  5. data/lib/ddx_interactions_api/api_client.rb +437 -0
  6. data/lib/ddx_interactions_api/api_error.rb +58 -0
  7. data/lib/ddx_interactions_api/configuration.rb +396 -0
  8. data/lib/ddx_interactions_api/models/accepted_interaction_dto.rb +226 -0
  9. data/lib/ddx_interactions_api/models/accepted_interactions_dto.rb +228 -0
  10. data/lib/ddx_interactions_api/models/activist_code.rb +252 -0
  11. data/lib/ddx_interactions_api/models/activist_code_outcome_details.rb +276 -0
  12. data/lib/ddx_interactions_api/models/address.rb +284 -0
  13. data/lib/ddx_interactions_api/models/address_channel_details.rb +269 -0
  14. data/lib/ddx_interactions_api/models/canvasser_details.rb +278 -0
  15. data/lib/ddx_interactions_api/models/committee_details.rb +278 -0
  16. data/lib/ddx_interactions_api/models/communication_consent.rb +243 -0
  17. data/lib/ddx_interactions_api/models/communication_consent_outcome_details.rb +276 -0
  18. data/lib/ddx_interactions_api/models/communication_consent_status.rb +40 -0
  19. data/lib/ddx_interactions_api/models/contact_info.rb +291 -0
  20. data/lib/ddx_interactions_api/models/contact_method.rb +53 -0
  21. data/lib/ddx_interactions_api/models/dynamic_channel_details.rb +238 -0
  22. data/lib/ddx_interactions_api/models/dynamic_outcome_details.rb +258 -0
  23. data/lib/ddx_interactions_api/models/event_details.rb +278 -0
  24. data/lib/ddx_interactions_api/models/event_role.rb +217 -0
  25. data/lib/ddx_interactions_api/models/event_signup.rb +253 -0
  26. data/lib/ddx_interactions_api/models/event_signup_outcome_details.rb +276 -0
  27. data/lib/ddx_interactions_api/models/event_signup_status.rb +255 -0
  28. data/lib/ddx_interactions_api/models/event_signup_status_value.rb +47 -0
  29. data/lib/ddx_interactions_api/models/exchange_interaction_status.rb +43 -0
  30. data/lib/ddx_interactions_api/models/exchange_interaction_status_dto.rb +278 -0
  31. data/lib/ddx_interactions_api/models/exchange_interaction_status_dto_cursor_paginated_response_dto.rb +237 -0
  32. data/lib/ddx_interactions_api/models/external_api_key_status.rb +40 -0
  33. data/lib/ddx_interactions_api/models/external_api_key_type.rb +39 -0
  34. data/lib/ddx_interactions_api/models/external_transaction_status.rb +45 -0
  35. data/lib/ddx_interactions_api/models/initiative_dto.rb +239 -0
  36. data/lib/ddx_interactions_api/models/interaction_dto.rb +513 -0
  37. data/lib/ddx_interactions_api/models/interaction_dto_channel.rb +56 -0
  38. data/lib/ddx_interactions_api/models/interaction_dto_outcomes_detailed_inner.rb +61 -0
  39. data/lib/ddx_interactions_api/models/interaction_error_dto.rb +223 -0
  40. data/lib/ddx_interactions_api/models/interaction_van_fields_dto.rb +227 -0
  41. data/lib/ddx_interactions_api/models/interactions_batch_result_dto.rb +244 -0
  42. data/lib/ddx_interactions_api/models/interactions_dto.rb +216 -0
  43. data/lib/ddx_interactions_api/models/interactions_external_api_transaction_dto.rb +279 -0
  44. data/lib/ddx_interactions_api/models/interactions_external_api_transaction_dto_get_response_dto.rb +225 -0
  45. data/lib/ddx_interactions_api/models/interactions_external_api_transaction_log_dto.rb +238 -0
  46. data/lib/ddx_interactions_api/models/mercury_destination_van_api_key_dto.rb +246 -0
  47. data/lib/ddx_interactions_api/models/minerva_metadata_dto.rb +215 -0
  48. data/lib/ddx_interactions_api/models/outcome.rb +58 -0
  49. data/lib/ddx_interactions_api/models/outcome_detail_operation.rb +41 -0
  50. data/lib/ddx_interactions_api/models/person_identifier.rb +278 -0
  51. data/lib/ddx_interactions_api/models/problem_details.rb +255 -0
  52. data/lib/ddx_interactions_api/models/rejected_interaction_dto.rb +238 -0
  53. data/lib/ddx_interactions_api/models/rejected_interactions_dto.rb +228 -0
  54. data/lib/ddx_interactions_api/models/simple_destination_dto.rb +243 -0
  55. data/lib/ddx_interactions_api/models/simple_movement_app_dto.rb +237 -0
  56. data/lib/ddx_interactions_api/models/simple_workspace_dto.rb +277 -0
  57. data/lib/ddx_interactions_api/models/survey_response.rb +299 -0
  58. data/lib/ddx_interactions_api/models/survey_response_outcome_details.rb +276 -0
  59. data/lib/ddx_interactions_api/models/van_api_key_dto.rb +319 -0
  60. data/lib/ddx_interactions_api/models/van_database_mode.rb +40 -0
  61. data/lib/ddx_interactions_api/models/who_am_i_api_key_dto.rb +286 -0
  62. data/lib/ddx_interactions_api/models/workspace_type_dto.rb +40 -0
  63. data/lib/ddx_interactions_api/version.rb +15 -0
  64. data/lib/ddx_interactions_api.rb +96 -0
  65. metadata +175 -0
@@ -0,0 +1,276 @@
1
+ =begin
2
+ #Interactions API
3
+
4
+ #Interactions API documentation
5
+
6
+ The version of the OpenAPI document: v1
7
+ Contact: api@demexchange.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 DdxInteractionsApi
17
+ # Represents an activist code (e.g. affiliation, activity, or interest) acquired during an interaction.
18
+ class ActivistCodeOutcomeDetails
19
+ # Describes whether this outcome detail is being created, deleted, or updated. Which operations are accepted varies by outcome type. Defaults to create.
20
+ attr_accessor :operation
21
+
22
+ # This field categorizes the type of detailed outcome information being provided.
23
+ attr_accessor :type
24
+
25
+ attr_accessor :value
26
+
27
+ class EnumAttributeValidator
28
+ attr_reader :datatype
29
+ attr_reader :allowable_values
30
+
31
+ def initialize(datatype, allowable_values)
32
+ @allowable_values = allowable_values.map do |value|
33
+ case datatype.to_s
34
+ when /Integer/i
35
+ value.to_i
36
+ when /Float/i
37
+ value.to_f
38
+ else
39
+ value
40
+ end
41
+ end
42
+ end
43
+
44
+ def valid?(value)
45
+ !value || allowable_values.include?(value)
46
+ end
47
+ end
48
+
49
+ # Attribute mapping from ruby-style variable name to JSON key.
50
+ def self.attribute_map
51
+ {
52
+ :'operation' => :'operation',
53
+ :'type' => :'type',
54
+ :'value' => :'value'
55
+ }
56
+ end
57
+
58
+ # Returns all the JSON keys this model knows about
59
+ def self.acceptable_attributes
60
+ attribute_map.values
61
+ end
62
+
63
+ # Attribute type mapping.
64
+ def self.openapi_types
65
+ {
66
+ :'operation' => :'String',
67
+ :'type' => :'String',
68
+ :'value' => :'ActivistCode'
69
+ }
70
+ end
71
+
72
+ # List of attributes with nullable: true
73
+ def self.openapi_nullable
74
+ Set.new([
75
+ ])
76
+ end
77
+
78
+ # Initializes the object
79
+ # @param [Hash] attributes Model attributes in the form of hash
80
+ def initialize(attributes = {})
81
+ if (!attributes.is_a?(Hash))
82
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DdxInteractionsApi::ActivistCodeOutcomeDetails` initialize method"
83
+ end
84
+
85
+ # check to see if the attribute exists and convert string to symbol for hash key
86
+ attributes = attributes.each_with_object({}) { |(k, v), h|
87
+ if (!self.class.attribute_map.key?(k.to_sym))
88
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DdxInteractionsApi::ActivistCodeOutcomeDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
89
+ end
90
+ h[k.to_sym] = v
91
+ }
92
+
93
+ if attributes.key?(:'operation')
94
+ self.operation = attributes[:'operation']
95
+ end
96
+
97
+ if attributes.key?(:'type')
98
+ self.type = attributes[:'type']
99
+ end
100
+
101
+ if attributes.key?(:'value')
102
+ self.value = attributes[:'value']
103
+ else
104
+ self.value = nil
105
+ end
106
+ end
107
+
108
+ # Show invalid properties with the reasons. Usually used together with valid?
109
+ # @return Array for valid properties with the reasons
110
+ def list_invalid_properties
111
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
112
+ invalid_properties = Array.new
113
+ if @value.nil?
114
+ invalid_properties.push('invalid value for "value", value cannot be nil.')
115
+ end
116
+
117
+ invalid_properties
118
+ end
119
+
120
+ # Check to see if the all the properties in the model are valid
121
+ # @return true if the model is valid
122
+ def valid?
123
+ warn '[DEPRECATED] the `valid?` method is obsolete'
124
+ operation_validator = EnumAttributeValidator.new('String', ["create", "delete"])
125
+ return false unless operation_validator.valid?(@operation)
126
+ return false if @value.nil?
127
+ true
128
+ end
129
+
130
+ # Custom attribute writer method checking allowed values (enum).
131
+ # @param [Object] operation Object to be assigned
132
+ def operation=(operation)
133
+ validator = EnumAttributeValidator.new('String', ["create", "delete"])
134
+ unless validator.valid?(operation)
135
+ fail ArgumentError, "invalid value for \"operation\", must be one of #{validator.allowable_values}."
136
+ end
137
+ @operation = operation
138
+ end
139
+
140
+ # Checks equality by comparing each attribute.
141
+ # @param [Object] Object to be compared
142
+ def ==(o)
143
+ return true if self.equal?(o)
144
+ self.class == o.class &&
145
+ operation == o.operation &&
146
+ type == o.type &&
147
+ value == o.value
148
+ end
149
+
150
+ # @see the `==` method
151
+ # @param [Object] Object to be compared
152
+ def eql?(o)
153
+ self == o
154
+ end
155
+
156
+ # Calculates hash code according to all attributes.
157
+ # @return [Integer] Hash code
158
+ def hash
159
+ [operation, type, value].hash
160
+ end
161
+
162
+ # Builds the object from hash
163
+ # @param [Hash] attributes Model attributes in the form of hash
164
+ # @return [Object] Returns the model itself
165
+ def self.build_from_hash(attributes)
166
+ return nil unless attributes.is_a?(Hash)
167
+ attributes = attributes.transform_keys(&:to_sym)
168
+ transformed_hash = {}
169
+ openapi_types.each_pair do |key, type|
170
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
171
+ transformed_hash["#{key}"] = nil
172
+ elsif type =~ /\AArray<(.*)>/i
173
+ # check to ensure the input is an array given that the attribute
174
+ # is documented as an array but the input is not
175
+ if attributes[attribute_map[key]].is_a?(Array)
176
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
177
+ end
178
+ elsif !attributes[attribute_map[key]].nil?
179
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
180
+ end
181
+ end
182
+ new(transformed_hash)
183
+ end
184
+
185
+ # Deserializes the data based on type
186
+ # @param string type Data type
187
+ # @param string value Value to be deserialized
188
+ # @return [Object] Deserialized data
189
+ def self._deserialize(type, value)
190
+ case type.to_sym
191
+ when :Time
192
+ Time.parse(value)
193
+ when :Date
194
+ Date.parse(value)
195
+ when :String
196
+ value.to_s
197
+ when :Integer
198
+ value.to_i
199
+ when :Float
200
+ value.to_f
201
+ when :Boolean
202
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
203
+ true
204
+ else
205
+ false
206
+ end
207
+ when :Object
208
+ # generic object (usually a Hash), return directly
209
+ value
210
+ when /\AArray<(?<inner_type>.+)>\z/
211
+ inner_type = Regexp.last_match[:inner_type]
212
+ value.map { |v| _deserialize(inner_type, v) }
213
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
214
+ k_type = Regexp.last_match[:k_type]
215
+ v_type = Regexp.last_match[:v_type]
216
+ {}.tap do |hash|
217
+ value.each do |k, v|
218
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
219
+ end
220
+ end
221
+ else # model
222
+ # models (e.g. Pet) or oneOf
223
+ klass = DdxInteractionsApi.const_get(type)
224
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
225
+ end
226
+ end
227
+
228
+ # Returns the string representation of the object
229
+ # @return [String] String presentation of the object
230
+ def to_s
231
+ to_hash.to_s
232
+ end
233
+
234
+ # to_body is an alias to to_hash (backward compatibility)
235
+ # @return [Hash] Returns the object in the form of hash
236
+ def to_body
237
+ to_hash
238
+ end
239
+
240
+ # Returns the object in the form of hash
241
+ # @return [Hash] Returns the object in the form of hash
242
+ def to_hash
243
+ hash = {}
244
+ self.class.attribute_map.each_pair do |attr, param|
245
+ value = self.send(attr)
246
+ if value.nil?
247
+ is_nullable = self.class.openapi_nullable.include?(attr)
248
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
249
+ end
250
+
251
+ hash[param] = _to_hash(value)
252
+ end
253
+ hash
254
+ end
255
+
256
+ # Outputs non-array value in the form of hash
257
+ # For object, use to_hash. Otherwise, just return the value
258
+ # @param [Object] value Any valid value
259
+ # @return [Hash] Returns the value in the form of hash
260
+ def _to_hash(value)
261
+ if value.is_a?(Array)
262
+ value.compact.map { |v| _to_hash(v) }
263
+ elsif value.is_a?(Hash)
264
+ {}.tap do |hash|
265
+ value.each { |k, v| hash[k] = _to_hash(v) }
266
+ end
267
+ elsif value.respond_to? :to_hash
268
+ value.to_hash
269
+ else
270
+ value
271
+ end
272
+ end
273
+
274
+ end
275
+
276
+ end
@@ -0,0 +1,284 @@
1
+ =begin
2
+ #Interactions API
3
+
4
+ #Interactions API documentation
5
+
6
+ The version of the OpenAPI document: v1
7
+ Contact: api@demexchange.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 DdxInteractionsApi
17
+ class Address
18
+ # The primary street address (e.g., house number and street name).
19
+ attr_accessor :address_line1
20
+
21
+ # The secondary address information (e.g., apartment, suite, unit number).
22
+ attr_accessor :address_line2
23
+
24
+ # The city of the address.
25
+ attr_accessor :city
26
+
27
+ # The state or region of the address.
28
+ attr_accessor :state
29
+
30
+ # The postal (ZIP) code for the address. Can accept ZIP5, ZIP+4, or ZIP9 format.
31
+ attr_accessor :postal_code
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'address_line1' => :'addressLine1',
37
+ :'address_line2' => :'addressLine2',
38
+ :'city' => :'city',
39
+ :'state' => :'state',
40
+ :'postal_code' => :'postalCode'
41
+ }
42
+ end
43
+
44
+ # Returns all the JSON keys this model knows about
45
+ def self.acceptable_attributes
46
+ attribute_map.values
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.openapi_types
51
+ {
52
+ :'address_line1' => :'String',
53
+ :'address_line2' => :'String',
54
+ :'city' => :'String',
55
+ :'state' => :'String',
56
+ :'postal_code' => :'String'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ :'address_line2',
64
+ ])
65
+ end
66
+
67
+ # Initializes the object
68
+ # @param [Hash] attributes Model attributes in the form of hash
69
+ def initialize(attributes = {})
70
+ if (!attributes.is_a?(Hash))
71
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DdxInteractionsApi::Address` initialize method"
72
+ end
73
+
74
+ # check to see if the attribute exists and convert string to symbol for hash key
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!self.class.attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DdxInteractionsApi::Address`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'address_line1')
83
+ self.address_line1 = attributes[:'address_line1']
84
+ else
85
+ self.address_line1 = nil
86
+ end
87
+
88
+ if attributes.key?(:'address_line2')
89
+ self.address_line2 = attributes[:'address_line2']
90
+ end
91
+
92
+ if attributes.key?(:'city')
93
+ self.city = attributes[:'city']
94
+ else
95
+ self.city = nil
96
+ end
97
+
98
+ if attributes.key?(:'state')
99
+ self.state = attributes[:'state']
100
+ else
101
+ self.state = nil
102
+ end
103
+
104
+ if attributes.key?(:'postal_code')
105
+ self.postal_code = attributes[:'postal_code']
106
+ else
107
+ self.postal_code = nil
108
+ end
109
+ end
110
+
111
+ # Show invalid properties with the reasons. Usually used together with valid?
112
+ # @return Array for valid properties with the reasons
113
+ def list_invalid_properties
114
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
115
+ invalid_properties = Array.new
116
+ if @address_line1.nil?
117
+ invalid_properties.push('invalid value for "address_line1", address_line1 cannot be nil.')
118
+ end
119
+
120
+ if @city.nil?
121
+ invalid_properties.push('invalid value for "city", city cannot be nil.')
122
+ end
123
+
124
+ if @state.nil?
125
+ invalid_properties.push('invalid value for "state", state cannot be nil.')
126
+ end
127
+
128
+ if @postal_code.nil?
129
+ invalid_properties.push('invalid value for "postal_code", postal_code cannot be nil.')
130
+ end
131
+
132
+ invalid_properties
133
+ end
134
+
135
+ # Check to see if the all the properties in the model are valid
136
+ # @return true if the model is valid
137
+ def valid?
138
+ warn '[DEPRECATED] the `valid?` method is obsolete'
139
+ return false if @address_line1.nil?
140
+ return false if @city.nil?
141
+ return false if @state.nil?
142
+ return false if @postal_code.nil?
143
+ true
144
+ end
145
+
146
+ # Checks equality by comparing each attribute.
147
+ # @param [Object] Object to be compared
148
+ def ==(o)
149
+ return true if self.equal?(o)
150
+ self.class == o.class &&
151
+ address_line1 == o.address_line1 &&
152
+ address_line2 == o.address_line2 &&
153
+ city == o.city &&
154
+ state == o.state &&
155
+ postal_code == o.postal_code
156
+ end
157
+
158
+ # @see the `==` method
159
+ # @param [Object] Object to be compared
160
+ def eql?(o)
161
+ self == o
162
+ end
163
+
164
+ # Calculates hash code according to all attributes.
165
+ # @return [Integer] Hash code
166
+ def hash
167
+ [address_line1, address_line2, city, state, postal_code].hash
168
+ end
169
+
170
+ # Builds the object from hash
171
+ # @param [Hash] attributes Model attributes in the form of hash
172
+ # @return [Object] Returns the model itself
173
+ def self.build_from_hash(attributes)
174
+ return nil unless attributes.is_a?(Hash)
175
+ attributes = attributes.transform_keys(&:to_sym)
176
+ transformed_hash = {}
177
+ openapi_types.each_pair do |key, type|
178
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
179
+ transformed_hash["#{key}"] = nil
180
+ elsif type =~ /\AArray<(.*)>/i
181
+ # check to ensure the input is an array given that the attribute
182
+ # is documented as an array but the input is not
183
+ if attributes[attribute_map[key]].is_a?(Array)
184
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
185
+ end
186
+ elsif !attributes[attribute_map[key]].nil?
187
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
188
+ end
189
+ end
190
+ new(transformed_hash)
191
+ end
192
+
193
+ # Deserializes the data based on type
194
+ # @param string type Data type
195
+ # @param string value Value to be deserialized
196
+ # @return [Object] Deserialized data
197
+ def self._deserialize(type, value)
198
+ case type.to_sym
199
+ when :Time
200
+ Time.parse(value)
201
+ when :Date
202
+ Date.parse(value)
203
+ when :String
204
+ value.to_s
205
+ when :Integer
206
+ value.to_i
207
+ when :Float
208
+ value.to_f
209
+ when :Boolean
210
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
211
+ true
212
+ else
213
+ false
214
+ end
215
+ when :Object
216
+ # generic object (usually a Hash), return directly
217
+ value
218
+ when /\AArray<(?<inner_type>.+)>\z/
219
+ inner_type = Regexp.last_match[:inner_type]
220
+ value.map { |v| _deserialize(inner_type, v) }
221
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
222
+ k_type = Regexp.last_match[:k_type]
223
+ v_type = Regexp.last_match[:v_type]
224
+ {}.tap do |hash|
225
+ value.each do |k, v|
226
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
227
+ end
228
+ end
229
+ else # model
230
+ # models (e.g. Pet) or oneOf
231
+ klass = DdxInteractionsApi.const_get(type)
232
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
233
+ end
234
+ end
235
+
236
+ # Returns the string representation of the object
237
+ # @return [String] String presentation of the object
238
+ def to_s
239
+ to_hash.to_s
240
+ end
241
+
242
+ # to_body is an alias to to_hash (backward compatibility)
243
+ # @return [Hash] Returns the object in the form of hash
244
+ def to_body
245
+ to_hash
246
+ end
247
+
248
+ # Returns the object in the form of hash
249
+ # @return [Hash] Returns the object in the form of hash
250
+ def to_hash
251
+ hash = {}
252
+ self.class.attribute_map.each_pair do |attr, param|
253
+ value = self.send(attr)
254
+ if value.nil?
255
+ is_nullable = self.class.openapi_nullable.include?(attr)
256
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
257
+ end
258
+
259
+ hash[param] = _to_hash(value)
260
+ end
261
+ hash
262
+ end
263
+
264
+ # Outputs non-array value in the form of hash
265
+ # For object, use to_hash. Otherwise, just return the value
266
+ # @param [Object] value Any valid value
267
+ # @return [Hash] Returns the value in the form of hash
268
+ def _to_hash(value)
269
+ if value.is_a?(Array)
270
+ value.compact.map { |v| _to_hash(v) }
271
+ elsif value.is_a?(Hash)
272
+ {}.tap do |hash|
273
+ value.each { |k, v| hash[k] = _to_hash(v) }
274
+ end
275
+ elsif value.respond_to? :to_hash
276
+ value.to_hash
277
+ else
278
+ value
279
+ end
280
+ end
281
+
282
+ end
283
+
284
+ end