sunshine-conversations-client 9.1.1 → 9.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5014bcf7814ccf1936867d08f4d10958054587e1
4
- data.tar.gz: f933c4e501c55329d5114f2c860ffc49987a0fbe
3
+ metadata.gz: e367b1fde0f780cf450c290d23dedd8dec6169ca
4
+ data.tar.gz: a48377436779a318afdde5a8bccb0969e4b6a532
5
5
  SHA512:
6
- metadata.gz: 54de593ae1f99a25d9851f480c2f9cd666a8f9733cdb4a3dc42d1b35b9bb9777917cd5d58732111913aa76be33fdabadcada8e037c8d77a14bbbe3dc04917dea
7
- data.tar.gz: dcfe08addfc281105ec45301c1cb3de3c33e3e4c95f8a361d604aebb874b49a6f253a648d023cca599d6c81055d82ada65929bff4d93df19bcb268bded8036d6
6
+ metadata.gz: 5da56361e421ffdb09b24da628d83a10a6bc46247e3a7b96465979aff9a55ef7cf7c7612fe27abe69d6383378890fe00a452e562c3f5e2b6463a81ddd1bc03df
7
+ data.tar.gz: 1be215df26f62414195b27e902313deb415c6f946dc8df94aecdcd85d5766e08ffb376d8c139948c184342e1f98188da8e2570c8a6e0a301ab939251ff5763ad
@@ -1,4 +1,11 @@
1
1
  # Changelog
2
+
3
+ ## [9.2.0] - 2020-11-16
4
+
5
+ ### Added
6
+
7
+ - Added support for Instagram Direct
8
+
2
9
  ## [9.1.1] - 2020-11-11
3
10
 
4
11
  ### Fixed
data/README.md CHANGED
@@ -5,7 +5,7 @@ SunshineConversationsClient - the Ruby gem for the Sunshine Conversations API
5
5
  This SDK is automatically generated by the [OpenAPI Generator Codegen](https://github.com/OpenAPITools/openapi-generator) project using the [Sunshine Conversations API spec](https://github.com/zendesk/sunshine-conversations-api-spec).
6
6
 
7
7
  - API version: 9.1.0
8
- - Package version: 9.1.1
8
+ - Package version: 9.2.0
9
9
  - Build package: org.openapitools.codegen.languages.RubyClientCodegen
10
10
 
11
11
  ## Sunshine Conversations API Version
@@ -32,16 +32,16 @@ gem build sunshine-conversations-client.gemspec
32
32
  Then either install the gem locally:
33
33
 
34
34
  ```shell
35
- gem install ./sunshine-conversations-client-9.1.1.gem
35
+ gem install ./sunshine-conversations-client-9.2.0.gem
36
36
  ```
37
37
 
38
- (for development, run `gem install --dev ./sunshine-conversations-client-9.1.1.gem` to install the development dependencies)
38
+ (for development, run `gem install --dev ./sunshine-conversations-client-9.2.0.gem` to install the development dependencies)
39
39
 
40
40
  or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
41
41
 
42
42
  Finally add this to the Gemfile:
43
43
 
44
- gem 'sunshine-conversations-client', '~> 9.1.1'
44
+ gem 'sunshine-conversations-client', '~> 9.2.0'
45
45
 
46
46
  ### Install from Git
47
47
 
@@ -291,6 +291,10 @@ Class | Method | HTTP request | Description
291
291
  - [SunshineConversationsClient::FormResponseMessage](docs/FormResponseMessage.md)
292
292
  - [SunshineConversationsClient::ImageMessage](docs/ImageMessage.md)
293
293
  - [SunshineConversationsClient::InlineObject](docs/InlineObject.md)
294
+ - [SunshineConversationsClient::Instagram](docs/Instagram.md)
295
+ - [SunshineConversationsClient::InstagramAllOf](docs/InstagramAllOf.md)
296
+ - [SunshineConversationsClient::InstagramUpdate](docs/InstagramUpdate.md)
297
+ - [SunshineConversationsClient::InstagramUpdateAllOf](docs/InstagramUpdateAllOf.md)
294
298
  - [SunshineConversationsClient::Integration](docs/Integration.md)
295
299
  - [SunshineConversationsClient::IntegrationApiKey](docs/IntegrationApiKey.md)
296
300
  - [SunshineConversationsClient::IntegrationApiKeyListResponse](docs/IntegrationApiKeyListResponse.md)
@@ -348,7 +352,6 @@ Class | Method | HTTP request | Description
348
352
  - [SunshineConversationsClient::Messenger](docs/Messenger.md)
349
353
  - [SunshineConversationsClient::MessengerAllOf](docs/MessengerAllOf.md)
350
354
  - [SunshineConversationsClient::MessengerUpdate](docs/MessengerUpdate.md)
351
- - [SunshineConversationsClient::MessengerUpdateAllOf](docs/MessengerUpdateAllOf.md)
352
355
  - [SunshineConversationsClient::Meta](docs/Meta.md)
353
356
  - [SunshineConversationsClient::OfferControlBody](docs/OfferControlBody.md)
354
357
  - [SunshineConversationsClient::Page](docs/Page.md)
@@ -0,0 +1,35 @@
1
+ # SunshineConversationsClient::Instagram
2
+
3
+ ## Properties
4
+
5
+ Name | Type | Description | Notes
6
+ ------------ | ------------- | ------------- | -------------
7
+ **type** | **String** | The type of integration. | [optional] [default to 'instagram']
8
+ **page_access_token** | **String** | The Facebook Page Access Token of the Facebook page that is linked to your Instagram account. |
9
+ **app_id** | **String** | Your Facebook App ID. |
10
+ **app_secret** | **String** | Your Facebook App secret. |
11
+ **business_name** | **String** | Your Instagram Business account name | [optional] [readonly]
12
+ **business_username** | **String** | Your Instagram Business unique username | [optional] [readonly]
13
+ **page_id** | **String** | The ID of the Facebook Page linked to your Instagram Business account | [optional] [readonly]
14
+ **business_id** | **String** | The ID of the Instagram Business account | [optional] [readonly]
15
+ **username** | **String** | The Facebook user's username. This is returned when integrating through the Dashboard | [optional] [readonly]
16
+ **user_id** | **String** | The Facebook user's user ID. This is returned when integrating through the Dashboard | [optional] [readonly]
17
+
18
+ ## Code Sample
19
+
20
+ ```ruby
21
+ require 'SunshineConversationsClient'
22
+
23
+ instance = SunshineConversationsClient::Instagram.new(type: null,
24
+ page_access_token: your_page_access_token,
25
+ app_id: your_facebook_app_id,
26
+ app_secret: your_facebook_app_secret,
27
+ business_name: instagram_name,
28
+ business_username: instagram_username,
29
+ page_id: 106731941223392,
30
+ business_id: 17841444303043201,
31
+ username: facebook_username,
32
+ user_id: 100885965124932)
33
+ ```
34
+
35
+
@@ -0,0 +1,35 @@
1
+ # SunshineConversationsClient::InstagramAllOf
2
+
3
+ ## Properties
4
+
5
+ Name | Type | Description | Notes
6
+ ------------ | ------------- | ------------- | -------------
7
+ **type** | **String** | The type of integration. | [optional] [default to 'instagram']
8
+ **page_access_token** | **String** | The Facebook Page Access Token of the Facebook page that is linked to your Instagram account. |
9
+ **app_id** | **String** | Your Facebook App ID. |
10
+ **app_secret** | **String** | Your Facebook App secret. |
11
+ **business_name** | **String** | Your Instagram Business account name | [optional] [readonly]
12
+ **business_username** | **String** | Your Instagram Business unique username | [optional] [readonly]
13
+ **page_id** | **String** | The ID of the Facebook Page linked to your Instagram Business account | [optional] [readonly]
14
+ **business_id** | **String** | The ID of the Instagram Business account | [optional] [readonly]
15
+ **username** | **String** | The Facebook user's username. This is returned when integrating through the Dashboard | [optional] [readonly]
16
+ **user_id** | **String** | The Facebook user's user ID. This is returned when integrating through the Dashboard | [optional] [readonly]
17
+
18
+ ## Code Sample
19
+
20
+ ```ruby
21
+ require 'SunshineConversationsClient'
22
+
23
+ instance = SunshineConversationsClient::InstagramAllOf.new(type: null,
24
+ page_access_token: your_page_access_token,
25
+ app_id: your_facebook_app_id,
26
+ app_secret: your_facebook_app_secret,
27
+ business_name: instagram_name,
28
+ business_username: instagram_username,
29
+ page_id: 106731941223392,
30
+ business_id: 17841444303043201,
31
+ username: facebook_username,
32
+ user_id: 100885965124932)
33
+ ```
34
+
35
+
@@ -0,0 +1,19 @@
1
+ # SunshineConversationsClient::InstagramUpdate
2
+
3
+ ## Properties
4
+
5
+ Name | Type | Description | Notes
6
+ ------------ | ------------- | ------------- | -------------
7
+ **display_name** | **String** | A human-friendly name used to identify the integration. `displayName` can be unset by changing it to `null`. | [optional]
8
+ **page_access_token** | **String** | A Facebook Page Access Token. | [optional]
9
+
10
+ ## Code Sample
11
+
12
+ ```ruby
13
+ require 'SunshineConversationsClient'
14
+
15
+ instance = SunshineConversationsClient::InstagramUpdate.new(display_name: My awesome integration,
16
+ page_access_token: your_access_token)
17
+ ```
18
+
19
+
@@ -1,4 +1,4 @@
1
- # SunshineConversationsClient::MessengerUpdateAllOf
1
+ # SunshineConversationsClient::InstagramUpdateAllOf
2
2
 
3
3
  ## Properties
4
4
 
@@ -11,7 +11,7 @@ Name | Type | Description | Notes
11
11
  ```ruby
12
12
  require 'SunshineConversationsClient'
13
13
 
14
- instance = SunshineConversationsClient::MessengerUpdateAllOf.new(page_access_token: your_access_token)
14
+ instance = SunshineConversationsClient::InstagramUpdateAllOf.new(page_access_token: your_access_token)
15
15
  ```
16
16
 
17
17
 
@@ -8,13 +8,13 @@ Name | Type | Description | Notes
8
8
  **server_key** | **String** | Your server key from the fcm console. | [optional]
9
9
  **sender_id** | **String** | Your sender id from the fcm console. | [optional]
10
10
  **can_user_create_more_conversations** | **Boolean** | Allows users to create more than one conversation on the web messenger integration. | [optional]
11
+ **page_access_token** | **String** | A Facebook Page Access Token. | [optional]
11
12
  **certificate** | **String** | The binary of your APN certificate base64 encoded. | [optional]
12
13
  **password** | **String** | The password for your APN certificate. | [optional]
13
14
  **production** | **Boolean** | The APN environment to connect to (Production, if true, or Sandbox). Defaults to value inferred from certificate if not specified. | [optional]
14
15
  **auto_update_badge** | **Boolean** | Use the unread count of the conversation as the application badge. | [optional]
15
16
  **hide_unsubscribe_link** | **Boolean** | A boolean value indicating whether the unsubscribe link should be omitted from outgoing emails. When enabled, it is expected that the business is providing the user a way to unsubscribe by some other means. By default, the unsubscribe link will be included in all outgoing emails. | [optional]
16
17
  **from_address** | **String** | Email address to use as the From and Reply-To address if it must be different from incomingAddress. Only use this option if the address that you supply is configured to forward emails to the incomingAddress, otherwise user replies will be lost. You must also make sure that the domain is properly configured as a mail provider so as to not be flagged as spam by the user’s email client. May be unset with null. | [optional]
17
- **page_access_token** | **String** | A Facebook Page Access Token. | [optional]
18
18
  **brand_color** | **String** | This color will be used in the messenger header and the button or tab in idle state. Must be a 3 or 6-character hexadecimal color. | [optional] [default to '65758e']
19
19
  **fixed_intro_pane** | **Boolean** | When true, the introduction pane will be pinned at the top of the conversation instead of scrolling with it. | [optional] [default to false]
20
20
  **conversation_color** | **String** | This color will be used for customer messages, quick replies and actions in the footer. Must be a 3 or 6-character hexadecimal color. | [optional] [default to '0099ff']
@@ -42,13 +42,13 @@ instance = SunshineConversationsClient::IntegrationUpdate.new(display_name: My a
42
42
  server_key: <server-key>,
43
43
  sender_id: <sender-id>,
44
44
  can_user_create_more_conversations: null,
45
+ page_access_token: your_access_token,
45
46
  certificate: your_APN_certificate,
46
47
  password: your_APN_password,
47
48
  production: null,
48
49
  auto_update_badge: null,
49
50
  hide_unsubscribe_link: null,
50
51
  from_address: test@sandbox123.mailgun.org,
51
- page_access_token: your_access_token,
52
52
  brand_color: null,
53
53
  fixed_intro_pane: null,
54
54
  conversation_color: null,
@@ -118,6 +118,10 @@ require 'sunshine-conversations-client/models/form_message'
118
118
  require 'sunshine-conversations-client/models/form_response_message'
119
119
  require 'sunshine-conversations-client/models/image_message'
120
120
  require 'sunshine-conversations-client/models/inline_object'
121
+ require 'sunshine-conversations-client/models/instagram'
122
+ require 'sunshine-conversations-client/models/instagram_all_of'
123
+ require 'sunshine-conversations-client/models/instagram_update'
124
+ require 'sunshine-conversations-client/models/instagram_update_all_of'
121
125
  require 'sunshine-conversations-client/models/integration'
122
126
  require 'sunshine-conversations-client/models/integration_api_key'
123
127
  require 'sunshine-conversations-client/models/integration_api_key_list_response'
@@ -175,7 +179,6 @@ require 'sunshine-conversations-client/models/messagebird_all_of'
175
179
  require 'sunshine-conversations-client/models/messenger'
176
180
  require 'sunshine-conversations-client/models/messenger_all_of'
177
181
  require 'sunshine-conversations-client/models/messenger_update'
178
- require 'sunshine-conversations-client/models/messenger_update_all_of'
179
182
  require 'sunshine-conversations-client/models/meta'
180
183
  require 'sunshine-conversations-client/models/offer_control_body'
181
184
  require 'sunshine-conversations-client/models/page'
@@ -0,0 +1,323 @@
1
+ =begin
2
+ #Sunshine Conversations API
3
+
4
+ The version of the OpenAPI document: 9.1.0
5
+
6
+ Generated by: https://openapi-generator.tech
7
+ OpenAPI Generator version: 4.3.1
8
+ =end
9
+
10
+ require 'date'
11
+
12
+ module SunshineConversationsClient
13
+ class Instagram < Integration
14
+ # The type of integration.
15
+ attr_accessor :type
16
+
17
+ # The Facebook Page Access Token of the Facebook page that is linked to your Instagram account.
18
+ attr_accessor :page_access_token
19
+
20
+ # Your Facebook App ID.
21
+ attr_accessor :app_id
22
+
23
+ # Your Facebook App secret.
24
+ attr_accessor :app_secret
25
+
26
+ # Your Instagram Business account name
27
+ attr_accessor :business_name
28
+
29
+ # Your Instagram Business unique username
30
+ attr_accessor :business_username
31
+
32
+ # The ID of the Facebook Page linked to your Instagram Business account
33
+ attr_accessor :page_id
34
+
35
+ # The ID of the Instagram Business account
36
+ attr_accessor :business_id
37
+
38
+ # The Facebook user's username. This is returned when integrating through the Dashboard
39
+ attr_accessor :username
40
+
41
+ # The Facebook user's user ID. This is returned when integrating through the Dashboard
42
+ attr_accessor :user_id
43
+
44
+ # Attribute mapping from ruby-style variable name to JSON key.
45
+ def self.attribute_map
46
+ {
47
+ :'type' => :'type',
48
+ :'page_access_token' => :'pageAccessToken',
49
+ :'app_id' => :'appId',
50
+ :'app_secret' => :'appSecret',
51
+ :'business_name' => :'businessName',
52
+ :'business_username' => :'businessUsername',
53
+ :'page_id' => :'pageId',
54
+ :'business_id' => :'businessId',
55
+ :'username' => :'username',
56
+ :'user_id' => :'userId'
57
+ }
58
+ end
59
+
60
+ # Attribute type mapping.
61
+ def self.openapi_types
62
+ {
63
+ :'type' => :'String',
64
+ :'page_access_token' => :'String',
65
+ :'app_id' => :'String',
66
+ :'app_secret' => :'String',
67
+ :'business_name' => :'String',
68
+ :'business_username' => :'String',
69
+ :'page_id' => :'String',
70
+ :'business_id' => :'String',
71
+ :'username' => :'String',
72
+ :'user_id' => :'String'
73
+ }
74
+ end
75
+
76
+ # List of attributes with nullable: true
77
+ def self.openapi_nullable
78
+ Set.new([
79
+ ])
80
+ end
81
+
82
+ # List of class defined in allOf (OpenAPI v3)
83
+ def self.openapi_all_of
84
+ [
85
+ :'InstagramAllOf',
86
+ :'Integration'
87
+ ]
88
+ end
89
+
90
+ # Initializes the object
91
+ # @param [Hash] attributes Model attributes in the form of hash
92
+ def initialize(attributes = {})
93
+ if (!attributes.is_a?(Hash))
94
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SunshineConversationsClient::Instagram` initialize method"
95
+ end
96
+
97
+ # check to see if the attribute exists and convert string to symbol for hash key
98
+ attributes = attributes.each_with_object({}) { |(k, v), h|
99
+ if (!self.class.attribute_map.key?(k.to_sym))
100
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SunshineConversationsClient::Instagram`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
101
+ end
102
+ h[k.to_sym] = v
103
+ }
104
+
105
+ # call parent's initialize
106
+ super(attributes)
107
+
108
+ if attributes.key?(:'type')
109
+ self.type = attributes[:'type']
110
+ else
111
+ self.type = 'instagram'
112
+ end
113
+
114
+ if attributes.key?(:'page_access_token')
115
+ self.page_access_token = attributes[:'page_access_token']
116
+ end
117
+
118
+ if attributes.key?(:'app_id')
119
+ self.app_id = attributes[:'app_id']
120
+ end
121
+
122
+ if attributes.key?(:'app_secret')
123
+ self.app_secret = attributes[:'app_secret']
124
+ end
125
+
126
+ if attributes.key?(:'business_name')
127
+ self.business_name = attributes[:'business_name']
128
+ end
129
+
130
+ if attributes.key?(:'business_username')
131
+ self.business_username = attributes[:'business_username']
132
+ end
133
+
134
+ if attributes.key?(:'page_id')
135
+ self.page_id = attributes[:'page_id']
136
+ end
137
+
138
+ if attributes.key?(:'business_id')
139
+ self.business_id = attributes[:'business_id']
140
+ end
141
+
142
+ if attributes.key?(:'username')
143
+ self.username = attributes[:'username']
144
+ end
145
+
146
+ if attributes.key?(:'user_id')
147
+ self.user_id = attributes[:'user_id']
148
+ end
149
+ end
150
+
151
+ # Show invalid properties with the reasons. Usually used together with valid?
152
+ # @return Array for valid properties with the reasons
153
+ def list_invalid_properties
154
+ invalid_properties = super
155
+ if @page_access_token.nil?
156
+ invalid_properties.push('invalid value for "page_access_token", page_access_token cannot be nil.')
157
+ end
158
+
159
+ if @app_id.nil?
160
+ invalid_properties.push('invalid value for "app_id", app_id cannot be nil.')
161
+ end
162
+
163
+ if @app_secret.nil?
164
+ invalid_properties.push('invalid value for "app_secret", app_secret cannot be nil.')
165
+ end
166
+
167
+ invalid_properties
168
+ end
169
+
170
+ # Check to see if the all the properties in the model are valid
171
+ # @return true if the model is valid
172
+ def valid?
173
+ return false if @page_access_token.nil?
174
+ return false if @app_id.nil?
175
+ return false if @app_secret.nil?
176
+ true && super
177
+ end
178
+
179
+ # Checks equality by comparing each attribute.
180
+ # @param [Object] Object to be compared
181
+ def ==(o)
182
+ return true if self.equal?(o)
183
+ self.class == o.class &&
184
+ type == o.type &&
185
+ page_access_token == o.page_access_token &&
186
+ app_id == o.app_id &&
187
+ app_secret == o.app_secret &&
188
+ business_name == o.business_name &&
189
+ business_username == o.business_username &&
190
+ page_id == o.page_id &&
191
+ business_id == o.business_id &&
192
+ username == o.username &&
193
+ user_id == o.user_id && super(o)
194
+ end
195
+
196
+ # @see the `==` method
197
+ # @param [Object] Object to be compared
198
+ def eql?(o)
199
+ self == o
200
+ end
201
+
202
+ # Calculates hash code according to all attributes.
203
+ # @return [Integer] Hash code
204
+ def hash
205
+ [type, page_access_token, app_id, app_secret, business_name, business_username, page_id, business_id, username, user_id].hash
206
+ end
207
+
208
+ # Builds the object from hash
209
+ # @param [Hash] attributes Model attributes in the form of hash
210
+ # @return [Object] Returns the model itself
211
+ def self.build_from_hash(attributes)
212
+ new.build_from_hash(attributes)
213
+ end
214
+
215
+ # Builds the object from hash
216
+ # @param [Hash] attributes Model attributes in the form of hash
217
+ # @return [Object] Returns the model itself
218
+ def build_from_hash(attributes)
219
+ return nil unless attributes.is_a?(Hash)
220
+ super(attributes)
221
+ self.class.openapi_types.each_pair do |key, type|
222
+ if type =~ /\AArray<(.*)>/i
223
+ # check to ensure the input is an array given that the attribute
224
+ # is documented as an array but the input is not
225
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
226
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
227
+ end
228
+ elsif !attributes[self.class.attribute_map[key]].nil?
229
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
230
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
231
+ end
232
+
233
+ self
234
+ end
235
+
236
+ # Deserializes the data based on type
237
+ # @param string type Data type
238
+ # @param string value Value to be deserialized
239
+ # @return [Object] Deserialized data
240
+ def _deserialize(type, value)
241
+ case type.to_sym
242
+ when :DateTime
243
+ DateTime.parse(value)
244
+ when :Date
245
+ Date.parse(value)
246
+ when :String
247
+ value.to_s
248
+ when :Integer
249
+ value.to_i
250
+ when :Float
251
+ value.to_f
252
+ when :Boolean
253
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
254
+ true
255
+ else
256
+ false
257
+ end
258
+ when :Object
259
+ # generic object (usually a Hash), return directly
260
+ value
261
+ when /\AArray<(?<inner_type>.+)>\z/
262
+ inner_type = Regexp.last_match[:inner_type]
263
+ value.map { |v| _deserialize(inner_type, v) }
264
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
265
+ k_type = Regexp.last_match[:k_type]
266
+ v_type = Regexp.last_match[:v_type]
267
+ {}.tap do |hash|
268
+ value.each do |k, v|
269
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
270
+ end
271
+ end
272
+ else # model
273
+ SunshineConversationsClient.const_get(type).build_from_hash(value)
274
+ end
275
+ end
276
+
277
+ # Returns the string representation of the object
278
+ # @return [String] String presentation of the object
279
+ def to_s
280
+ to_hash.to_s
281
+ end
282
+
283
+ # to_body is an alias to to_hash (backward compatibility)
284
+ # @return [Hash] Returns the object in the form of hash
285
+ def to_body
286
+ to_hash
287
+ end
288
+
289
+ # Returns the object in the form of hash
290
+ # @return [Hash] Returns the object in the form of hash
291
+ def to_hash
292
+ hash = super
293
+ self.class.attribute_map.each_pair do |attr, param|
294
+ value = self.send(attr)
295
+ if value.nil?
296
+ is_nullable = self.class.openapi_nullable.include?(attr)
297
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
298
+ end
299
+
300
+ hash[param] = _to_hash(value)
301
+ end
302
+ hash
303
+ end
304
+
305
+ # Outputs non-array value in the form of hash
306
+ # For object, use to_hash. Otherwise, just return the value
307
+ # @param [Object] value Any valid value
308
+ # @return [Hash] Returns the value in the form of hash
309
+ def _to_hash(value)
310
+ if value.is_a?(Array)
311
+ value.compact.map { |v| _to_hash(v) }
312
+ elsif value.is_a?(Hash)
313
+ {}.tap do |hash|
314
+ value.each { |k, v| hash[k] = _to_hash(v) }
315
+ end
316
+ elsif value.respond_to? :to_hash
317
+ value.to_hash
318
+ else
319
+ value
320
+ end
321
+ end
322
+ end
323
+ end