solifyn 1.1.4 → 1.1.6

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 (40) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +21 -4
  3. data/docs/CreateEntitlementDto.md +42 -0
  4. data/docs/CreateFramerTemplateDto.md +22 -0
  5. data/docs/EntitlementDetailResponseDto.md +56 -0
  6. data/docs/EntitlementGrantResponseDto.md +4 -0
  7. data/docs/EntitlementGrantsApi.md +5 -1
  8. data/docs/EntitlementsApi.md +331 -0
  9. data/docs/FramerIntegrationApi.md +355 -0
  10. data/docs/FramerTemplateResponseDto.md +30 -0
  11. data/docs/LinkedProductDto.md +20 -0
  12. data/docs/ProductCreate.md +7 -1
  13. data/docs/ProductUpdate.md +7 -1
  14. data/docs/UpdateEntitlementDto.md +42 -0
  15. data/docs/UpdateFramerTemplateDto.md +22 -0
  16. data/lib/solifyn/api/entitlement_grants_api.rb +6 -0
  17. data/lib/solifyn/api/entitlements_api.rb +347 -0
  18. data/lib/solifyn/api/framer_integration_api.rb +345 -0
  19. data/lib/solifyn/models/create_entitlement_dto.rb +385 -0
  20. data/lib/solifyn/models/create_framer_template_dto.rb +249 -0
  21. data/lib/solifyn/models/entitlement_detail_response_dto.rb +470 -0
  22. data/lib/solifyn/models/entitlement_grant_response_dto.rb +21 -1
  23. data/lib/solifyn/models/framer_template_response_dto.rb +317 -0
  24. data/lib/solifyn/models/linked_product_dto.rb +239 -0
  25. data/lib/solifyn/models/product_create.rb +38 -4
  26. data/lib/solifyn/models/product_update.rb +38 -4
  27. data/lib/solifyn/models/update_entitlement_dto.rb +371 -0
  28. data/lib/solifyn/models/update_framer_template_dto.rb +235 -0
  29. data/lib/solifyn/version.rb +1 -1
  30. data/lib/solifyn.rb +9 -0
  31. data/spec/api/entitlements_api_spec.rb +95 -0
  32. data/spec/api/framer_integration_api_spec.rb +95 -0
  33. data/spec/models/create_entitlement_dto_spec.rb +112 -0
  34. data/spec/models/create_framer_template_dto_spec.rb +48 -0
  35. data/spec/models/entitlement_detail_response_dto_spec.rb +150 -0
  36. data/spec/models/framer_template_response_dto_spec.rb +72 -0
  37. data/spec/models/linked_product_dto_spec.rb +42 -0
  38. data/spec/models/update_entitlement_dto_spec.rb +112 -0
  39. data/spec/models/update_framer_template_dto_spec.rb +48 -0
  40. metadata +172 -136
@@ -0,0 +1,385 @@
1
+ =begin
2
+ #Solifyn API
3
+
4
+ #Welcome to the Solifyn API Reference. Leverage our secure endpoints to manage products and issue, validate, and manage software license keys programmatically.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
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 Solifyn
17
+ class CreateEntitlementDto
18
+ # The user-friendly name of the entitlement
19
+ attr_accessor :name
20
+
21
+ # The type of access to grant
22
+ attr_accessor :type
23
+
24
+ # The GitHub repository (e.g., owner/repo)
25
+ attr_accessor :github_repo
26
+
27
+ # The GitHub repository permission level
28
+ attr_accessor :github_permission
29
+
30
+ # The Discord Guild/Server ID
31
+ attr_accessor :discord_guild_id
32
+
33
+ # The Discord Role ID to assign
34
+ attr_accessor :discord_role_id
35
+
36
+ # The associated Framer Template ID
37
+ attr_accessor :framer_template_id
38
+
39
+ # The static License Key (if not dynamically generated)
40
+ attr_accessor :license_key
41
+
42
+ # The maximum activation limit for licenses
43
+ attr_accessor :activation_limit
44
+
45
+ # A message shown to the user upon license activation
46
+ attr_accessor :activation_message
47
+
48
+ # The number of hours until the entitlement expires
49
+ attr_accessor :expiry_hours
50
+
51
+ # The digital download URL or redirect link
52
+ attr_accessor :digital_link
53
+
54
+ # Custom setup instructions for the user
55
+ attr_accessor :instructions
56
+
57
+ class EnumAttributeValidator
58
+ attr_reader :datatype
59
+ attr_reader :allowable_values
60
+
61
+ def initialize(datatype, allowable_values)
62
+ @allowable_values = allowable_values.map do |value|
63
+ case datatype.to_s
64
+ when /Integer/i
65
+ value.to_i
66
+ when /Float/i
67
+ value.to_f
68
+ else
69
+ value
70
+ end
71
+ end
72
+ end
73
+
74
+ def valid?(value)
75
+ !value || allowable_values.include?(value)
76
+ end
77
+ end
78
+
79
+ # Attribute mapping from ruby-style variable name to JSON key.
80
+ def self.attribute_map
81
+ {
82
+ :'name' => :'name',
83
+ :'type' => :'type',
84
+ :'github_repo' => :'githubRepo',
85
+ :'github_permission' => :'githubPermission',
86
+ :'discord_guild_id' => :'discordGuildId',
87
+ :'discord_role_id' => :'discordRoleId',
88
+ :'framer_template_id' => :'framerTemplateId',
89
+ :'license_key' => :'licenseKey',
90
+ :'activation_limit' => :'activationLimit',
91
+ :'activation_message' => :'activationMessage',
92
+ :'expiry_hours' => :'expiryHours',
93
+ :'digital_link' => :'digitalLink',
94
+ :'instructions' => :'instructions'
95
+ }
96
+ end
97
+
98
+ # Returns all the JSON keys this model knows about
99
+ def self.acceptable_attributes
100
+ attribute_map.values
101
+ end
102
+
103
+ # Attribute type mapping.
104
+ def self.openapi_types
105
+ {
106
+ :'name' => :'String',
107
+ :'type' => :'String',
108
+ :'github_repo' => :'String',
109
+ :'github_permission' => :'String',
110
+ :'discord_guild_id' => :'String',
111
+ :'discord_role_id' => :'String',
112
+ :'framer_template_id' => :'String',
113
+ :'license_key' => :'String',
114
+ :'activation_limit' => :'Float',
115
+ :'activation_message' => :'String',
116
+ :'expiry_hours' => :'Float',
117
+ :'digital_link' => :'String',
118
+ :'instructions' => :'String'
119
+ }
120
+ end
121
+
122
+ # List of attributes with nullable: true
123
+ def self.openapi_nullable
124
+ Set.new([
125
+ ])
126
+ end
127
+
128
+ # Initializes the object
129
+ # @param [Hash] attributes Model attributes in the form of hash
130
+ def initialize(attributes = {})
131
+ if (!attributes.is_a?(Hash))
132
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Solifyn::CreateEntitlementDto` initialize method"
133
+ end
134
+
135
+ # check to see if the attribute exists and convert string to symbol for hash key
136
+ attributes = attributes.each_with_object({}) { |(k, v), h|
137
+ if (!self.class.attribute_map.key?(k.to_sym))
138
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Solifyn::CreateEntitlementDto`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
139
+ end
140
+ h[k.to_sym] = v
141
+ }
142
+
143
+ if attributes.key?(:'name')
144
+ self.name = attributes[:'name']
145
+ else
146
+ self.name = nil
147
+ end
148
+
149
+ if attributes.key?(:'type')
150
+ self.type = attributes[:'type']
151
+ else
152
+ self.type = nil
153
+ end
154
+
155
+ if attributes.key?(:'github_repo')
156
+ self.github_repo = attributes[:'github_repo']
157
+ end
158
+
159
+ if attributes.key?(:'github_permission')
160
+ self.github_permission = attributes[:'github_permission']
161
+ else
162
+ self.github_permission = 'pull'
163
+ end
164
+
165
+ if attributes.key?(:'discord_guild_id')
166
+ self.discord_guild_id = attributes[:'discord_guild_id']
167
+ end
168
+
169
+ if attributes.key?(:'discord_role_id')
170
+ self.discord_role_id = attributes[:'discord_role_id']
171
+ end
172
+
173
+ if attributes.key?(:'framer_template_id')
174
+ self.framer_template_id = attributes[:'framer_template_id']
175
+ end
176
+
177
+ if attributes.key?(:'license_key')
178
+ self.license_key = attributes[:'license_key']
179
+ end
180
+
181
+ if attributes.key?(:'activation_limit')
182
+ self.activation_limit = attributes[:'activation_limit']
183
+ end
184
+
185
+ if attributes.key?(:'activation_message')
186
+ self.activation_message = attributes[:'activation_message']
187
+ end
188
+
189
+ if attributes.key?(:'expiry_hours')
190
+ self.expiry_hours = attributes[:'expiry_hours']
191
+ end
192
+
193
+ if attributes.key?(:'digital_link')
194
+ self.digital_link = attributes[:'digital_link']
195
+ end
196
+
197
+ if attributes.key?(:'instructions')
198
+ self.instructions = attributes[:'instructions']
199
+ end
200
+ end
201
+
202
+ # Show invalid properties with the reasons. Usually used together with valid?
203
+ # @return Array for valid properties with the reasons
204
+ def list_invalid_properties
205
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
206
+ invalid_properties = Array.new
207
+ if @name.nil?
208
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
209
+ end
210
+
211
+ if @type.nil?
212
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
213
+ end
214
+
215
+ invalid_properties
216
+ end
217
+
218
+ # Check to see if the all the properties in the model are valid
219
+ # @return true if the model is valid
220
+ def valid?
221
+ warn '[DEPRECATED] the `valid?` method is obsolete'
222
+ return false if @name.nil?
223
+ return false if @type.nil?
224
+ type_validator = EnumAttributeValidator.new('String', ["GITHUB", "DISCORD", "FRAMER", "LICENSE", "DIGITAL"])
225
+ return false unless type_validator.valid?(@type)
226
+ true
227
+ end
228
+
229
+ # Custom attribute writer method checking allowed values (enum).
230
+ # @param [Object] type Object to be assigned
231
+ def type=(type)
232
+ validator = EnumAttributeValidator.new('String', ["GITHUB", "DISCORD", "FRAMER", "LICENSE", "DIGITAL"])
233
+ unless validator.valid?(type)
234
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
235
+ end
236
+ @type = type
237
+ end
238
+
239
+ # Checks equality by comparing each attribute.
240
+ # @param [Object] Object to be compared
241
+ def ==(o)
242
+ return true if self.equal?(o)
243
+ self.class == o.class &&
244
+ name == o.name &&
245
+ type == o.type &&
246
+ github_repo == o.github_repo &&
247
+ github_permission == o.github_permission &&
248
+ discord_guild_id == o.discord_guild_id &&
249
+ discord_role_id == o.discord_role_id &&
250
+ framer_template_id == o.framer_template_id &&
251
+ license_key == o.license_key &&
252
+ activation_limit == o.activation_limit &&
253
+ activation_message == o.activation_message &&
254
+ expiry_hours == o.expiry_hours &&
255
+ digital_link == o.digital_link &&
256
+ instructions == o.instructions
257
+ end
258
+
259
+ # @see the `==` method
260
+ # @param [Object] Object to be compared
261
+ def eql?(o)
262
+ self == o
263
+ end
264
+
265
+ # Calculates hash code according to all attributes.
266
+ # @return [Integer] Hash code
267
+ def hash
268
+ [name, type, github_repo, github_permission, discord_guild_id, discord_role_id, framer_template_id, license_key, activation_limit, activation_message, expiry_hours, digital_link, instructions].hash
269
+ end
270
+
271
+ # Builds the object from hash
272
+ # @param [Hash] attributes Model attributes in the form of hash
273
+ # @return [Object] Returns the model itself
274
+ def self.build_from_hash(attributes)
275
+ return nil unless attributes.is_a?(Hash)
276
+ attributes = attributes.transform_keys(&:to_sym)
277
+ transformed_hash = {}
278
+ openapi_types.each_pair do |key, type|
279
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
280
+ transformed_hash["#{key}"] = nil
281
+ elsif type =~ /\AArray<(.*)>/i
282
+ # check to ensure the input is an array given that the attribute
283
+ # is documented as an array but the input is not
284
+ if attributes[attribute_map[key]].is_a?(Array)
285
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
286
+ end
287
+ elsif !attributes[attribute_map[key]].nil?
288
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
289
+ end
290
+ end
291
+ new(transformed_hash)
292
+ end
293
+
294
+ # Deserializes the data based on type
295
+ # @param string type Data type
296
+ # @param string value Value to be deserialized
297
+ # @return [Object] Deserialized data
298
+ def self._deserialize(type, value)
299
+ case type.to_sym
300
+ when :Time
301
+ Time.parse(value)
302
+ when :Date
303
+ Date.parse(value)
304
+ when :String
305
+ value.to_s
306
+ when :Integer
307
+ value.to_i
308
+ when :Float
309
+ value.to_f
310
+ when :Boolean
311
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
312
+ true
313
+ else
314
+ false
315
+ end
316
+ when :Object
317
+ # generic object (usually a Hash), return directly
318
+ value
319
+ when /\AArray<(?<inner_type>.+)>\z/
320
+ inner_type = Regexp.last_match[:inner_type]
321
+ value.map { |v| _deserialize(inner_type, v) }
322
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
323
+ k_type = Regexp.last_match[:k_type]
324
+ v_type = Regexp.last_match[:v_type]
325
+ {}.tap do |hash|
326
+ value.each do |k, v|
327
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
328
+ end
329
+ end
330
+ else # model
331
+ # models (e.g. Pet) or oneOf
332
+ klass = Solifyn.const_get(type)
333
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
334
+ end
335
+ end
336
+
337
+ # Returns the string representation of the object
338
+ # @return [String] String presentation of the object
339
+ def to_s
340
+ to_hash.to_s
341
+ end
342
+
343
+ # to_body is an alias to to_hash (backward compatibility)
344
+ # @return [Hash] Returns the object in the form of hash
345
+ def to_body
346
+ to_hash
347
+ end
348
+
349
+ # Returns the object in the form of hash
350
+ # @return [Hash] Returns the object in the form of hash
351
+ def to_hash
352
+ hash = {}
353
+ self.class.attribute_map.each_pair do |attr, param|
354
+ value = self.send(attr)
355
+ if value.nil?
356
+ is_nullable = self.class.openapi_nullable.include?(attr)
357
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
358
+ end
359
+
360
+ hash[param] = _to_hash(value)
361
+ end
362
+ hash
363
+ end
364
+
365
+ # Outputs non-array value in the form of hash
366
+ # For object, use to_hash. Otherwise, just return the value
367
+ # @param [Object] value Any valid value
368
+ # @return [Hash] Returns the value in the form of hash
369
+ def _to_hash(value)
370
+ if value.is_a?(Array)
371
+ value.compact.map { |v| _to_hash(v) }
372
+ elsif value.is_a?(Hash)
373
+ {}.tap do |hash|
374
+ value.each { |k, v| hash[k] = _to_hash(v) }
375
+ end
376
+ elsif value.respond_to? :to_hash
377
+ value.to_hash
378
+ else
379
+ value
380
+ end
381
+ end
382
+
383
+ end
384
+
385
+ end
@@ -0,0 +1,249 @@
1
+ =begin
2
+ #Solifyn API
3
+
4
+ #Welcome to the Solifyn API Reference. Leverage our secure endpoints to manage products and issue, validate, and manage software license keys programmatically.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
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 Solifyn
17
+ class CreateFramerTemplateDto
18
+ # The name of the Framer template.
19
+ attr_accessor :name
20
+
21
+ # The public Framer remix link.
22
+ attr_accessor :remix_link
23
+
24
+ # A brief description of the template.
25
+ attr_accessor :description
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'name' => :'name',
31
+ :'remix_link' => :'remixLink',
32
+ :'description' => :'description'
33
+ }
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'name' => :'String',
45
+ :'remix_link' => :'String',
46
+ :'description' => :'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 `Solifyn::CreateFramerTemplateDto` 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 `Solifyn::CreateFramerTemplateDto`. 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?(:'name')
72
+ self.name = attributes[:'name']
73
+ else
74
+ self.name = nil
75
+ end
76
+
77
+ if attributes.key?(:'remix_link')
78
+ self.remix_link = attributes[:'remix_link']
79
+ else
80
+ self.remix_link = nil
81
+ end
82
+
83
+ if attributes.key?(:'description')
84
+ self.description = attributes[:'description']
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
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
92
+ invalid_properties = Array.new
93
+ if @name.nil?
94
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
95
+ end
96
+
97
+ if @remix_link.nil?
98
+ invalid_properties.push('invalid value for "remix_link", remix_link cannot be nil.')
99
+ end
100
+
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
+ warn '[DEPRECATED] the `valid?` method is obsolete'
108
+ return false if @name.nil?
109
+ return false if @remix_link.nil?
110
+ true
111
+ end
112
+
113
+ # Checks equality by comparing each attribute.
114
+ # @param [Object] Object to be compared
115
+ def ==(o)
116
+ return true if self.equal?(o)
117
+ self.class == o.class &&
118
+ name == o.name &&
119
+ remix_link == o.remix_link &&
120
+ description == o.description
121
+ end
122
+
123
+ # @see the `==` method
124
+ # @param [Object] Object to be compared
125
+ def eql?(o)
126
+ self == o
127
+ end
128
+
129
+ # Calculates hash code according to all attributes.
130
+ # @return [Integer] Hash code
131
+ def hash
132
+ [name, remix_link, description].hash
133
+ end
134
+
135
+ # Builds the object from hash
136
+ # @param [Hash] attributes Model attributes in the form of hash
137
+ # @return [Object] Returns the model itself
138
+ def self.build_from_hash(attributes)
139
+ return nil unless attributes.is_a?(Hash)
140
+ attributes = attributes.transform_keys(&:to_sym)
141
+ transformed_hash = {}
142
+ openapi_types.each_pair do |key, type|
143
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
144
+ transformed_hash["#{key}"] = nil
145
+ elsif type =~ /\AArray<(.*)>/i
146
+ # check to ensure the input is an array given that the attribute
147
+ # is documented as an array but the input is not
148
+ if attributes[attribute_map[key]].is_a?(Array)
149
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
150
+ end
151
+ elsif !attributes[attribute_map[key]].nil?
152
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
153
+ end
154
+ end
155
+ new(transformed_hash)
156
+ end
157
+
158
+ # Deserializes the data based on type
159
+ # @param string type Data type
160
+ # @param string value Value to be deserialized
161
+ # @return [Object] Deserialized data
162
+ def self._deserialize(type, value)
163
+ case type.to_sym
164
+ when :Time
165
+ Time.parse(value)
166
+ when :Date
167
+ Date.parse(value)
168
+ when :String
169
+ value.to_s
170
+ when :Integer
171
+ value.to_i
172
+ when :Float
173
+ value.to_f
174
+ when :Boolean
175
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
176
+ true
177
+ else
178
+ false
179
+ end
180
+ when :Object
181
+ # generic object (usually a Hash), return directly
182
+ value
183
+ when /\AArray<(?<inner_type>.+)>\z/
184
+ inner_type = Regexp.last_match[:inner_type]
185
+ value.map { |v| _deserialize(inner_type, v) }
186
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
187
+ k_type = Regexp.last_match[:k_type]
188
+ v_type = Regexp.last_match[:v_type]
189
+ {}.tap do |hash|
190
+ value.each do |k, v|
191
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
192
+ end
193
+ end
194
+ else # model
195
+ # models (e.g. Pet) or oneOf
196
+ klass = Solifyn.const_get(type)
197
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
198
+ end
199
+ end
200
+
201
+ # Returns the string representation of the object
202
+ # @return [String] String presentation of the object
203
+ def to_s
204
+ to_hash.to_s
205
+ end
206
+
207
+ # to_body is an alias to to_hash (backward compatibility)
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_body
210
+ to_hash
211
+ end
212
+
213
+ # Returns the object in the form of hash
214
+ # @return [Hash] Returns the object in the form of hash
215
+ def to_hash
216
+ hash = {}
217
+ self.class.attribute_map.each_pair do |attr, param|
218
+ value = self.send(attr)
219
+ if value.nil?
220
+ is_nullable = self.class.openapi_nullable.include?(attr)
221
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
222
+ end
223
+
224
+ hash[param] = _to_hash(value)
225
+ end
226
+ hash
227
+ end
228
+
229
+ # Outputs non-array value in the form of hash
230
+ # For object, use to_hash. Otherwise, just return the value
231
+ # @param [Object] value Any valid value
232
+ # @return [Hash] Returns the value in the form of hash
233
+ def _to_hash(value)
234
+ if value.is_a?(Array)
235
+ value.compact.map { |v| _to_hash(v) }
236
+ elsif value.is_a?(Hash)
237
+ {}.tap do |hash|
238
+ value.each { |k, v| hash[k] = _to_hash(v) }
239
+ end
240
+ elsif value.respond_to? :to_hash
241
+ value.to_hash
242
+ else
243
+ value
244
+ end
245
+ end
246
+
247
+ end
248
+
249
+ end