smooch-api 4.2.0 → 5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -3
- data/docs/Action.md +2 -2
- data/docs/AppUserLink.md +1 -1
- data/docs/BusinessSystemItem.md +1 -1
- data/docs/ChannelEntityItem.md +1 -1
- data/docs/Client.md +1 -1
- data/docs/ClientInfo.md +1 -1
- data/docs/Confirmation.md +1 -1
- data/docs/{TypingActivityTrigger.md → ConversationActivity.md} +3 -3
- data/docs/ConversationApi.md +49 -49
- data/docs/Destination.md +1 -1
- data/docs/DisplaySettings.md +1 -1
- data/docs/Enums.md +20 -0
- data/docs/Integration.md +2 -2
- data/docs/IntegrationCreate.md +1 -1
- data/docs/LinkRequestResponseLinkRequests.md +1 -1
- data/docs/MenuItem.md +1 -1
- data/docs/Message.md +2 -2
- data/docs/MessageItem.md +1 -1
- data/docs/MessagePost.md +2 -2
- data/docs/Source.md +1 -1
- data/docs/SubMenuItem.md +1 -1
- data/docs/Webhook.md +1 -1
- data/docs/WebhookCreate.md +1 -1
- data/docs/WebhookUpdate.md +1 -1
- data/lib/smooch-api.rb +2 -1
- data/lib/smooch-api/api/conversation_api.rb +66 -66
- data/lib/smooch-api/models/action.rb +2 -2
- data/lib/smooch-api/models/app_user_link.rb +1 -1
- data/lib/smooch-api/models/business_system_item.rb +1 -1
- data/lib/smooch-api/models/channel_entity_item.rb +1 -1
- data/lib/smooch-api/models/client.rb +1 -1
- data/lib/smooch-api/models/client_info.rb +1 -1
- data/lib/smooch-api/models/confirmation.rb +1 -1
- data/lib/smooch-api/models/{typing_activity_trigger.rb → conversation_activity.rb} +3 -3
- data/lib/smooch-api/models/destination.rb +1 -1
- data/lib/smooch-api/models/display_settings.rb +1 -1
- data/lib/smooch-api/models/enums.rb +473 -0
- data/lib/smooch-api/models/integration.rb +2 -2
- data/lib/smooch-api/models/integration_create.rb +1 -1
- data/lib/smooch-api/models/link_request_response_link_requests.rb +1 -1
- data/lib/smooch-api/models/menu_item.rb +1 -1
- data/lib/smooch-api/models/message.rb +2 -2
- data/lib/smooch-api/models/message_item.rb +1 -1
- data/lib/smooch-api/models/message_post.rb +2 -2
- data/lib/smooch-api/models/source.rb +1 -1
- data/lib/smooch-api/models/sub_menu_item.rb +1 -1
- data/lib/smooch-api/models/webhook.rb +1 -1
- data/lib/smooch-api/models/webhook_create.rb +1 -1
- data/lib/smooch-api/models/webhook_update.rb +1 -1
- data/lib/smooch-api/version.rb +1 -1
- metadata +6 -4
data/docs/Integration.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
Name | Type | Description | Notes
|
5
5
|
------------ | ------------- | ------------- | -------------
|
6
6
|
**id** | **String** | The integration ID, generated automatically. |
|
7
|
-
**type** | **String** | The integration type. |
|
7
|
+
**type** | **String** | The integration type. See Enums.md for available values. |
|
8
8
|
**pageAccessToken** | **String** | Facebook Page Access Token. Required for *messenger* integrations. | [optional]
|
9
9
|
**appId** | **String** | Facebook App ID OR WeChat App ID. Required for *messenger* and *wechat* integrations. | [optional]
|
10
10
|
**appSecret** | **String** | Facebook Page App Secret OR WeChat App Secret. Required for *messenger* and *wechat* integrations. | [optional]
|
@@ -58,7 +58,7 @@ Name | Type | Description | Notes
|
|
58
58
|
**businessIconUrl** | **String** | A custom business icon url for the Web Messenger. (Optional) Used for *Web Messenger* integrations. | [optional]
|
59
59
|
**backgroundImageUrl** | **String** | A custom background url for the Web Messenger. (Optional) Used for *Web Messenger* integrations. | [optional]
|
60
60
|
**originWhitelist** | **Array<String>** | A list of origins to whitelist. When set, only the origins from this list will be able to initialize the Web Messenger. If unset, all origins are whitelisted. The elements in the list should follow the serialized-origin format from RFC 6454 `scheme \"://\" host [ \":\" port ]`, where scheme is `http` or `https`. (Optional) Used for *Web Messenger* integrations. | [optional]
|
61
|
-
**status** | **String** | The integration status.
|
61
|
+
**status** | **String** | The integration status. See Enums.md for available values. [More info](https://docs.smooch.io/#integration-status). | [optional]
|
62
62
|
**error** | **String** | The error causing the integration to fail. Will be present when `status` is 'error'. | [optional]
|
63
63
|
|
64
64
|
|
data/docs/IntegrationCreate.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
## Properties
|
4
4
|
Name | Type | Description | Notes
|
5
5
|
------------ | ------------- | ------------- | -------------
|
6
|
-
**type** | **String** | The integration type. |
|
6
|
+
**type** | **String** | The integration type. See Enums.md for available values. |
|
7
7
|
**pageAccessToken** | **String** | Facebook Page Access Token. Required for *messenger* integrations. | [optional]
|
8
8
|
**appId** | **String** | Facebook App ID OR WeChat App ID. Required for *messenger* and *wechat* integrations. | [optional]
|
9
9
|
**appSecret** | **String** | Facebook Page App Secret OR WeChat App Secret. Required for *messenger* and *wechat* integrations. | [optional]
|
@@ -4,7 +4,7 @@
|
|
4
4
|
Name | Type | Description | Notes
|
5
5
|
------------ | ------------- | ------------- | -------------
|
6
6
|
**integrationId** | **String** | The integration ID. |
|
7
|
-
**type** | **String** | The integration type. |
|
7
|
+
**type** | **String** | The integration type. See Enums.md for available values. |
|
8
8
|
**code** | **String** | The link request code. |
|
9
9
|
**url** | **String** | The link request url. |
|
10
10
|
|
data/docs/MenuItem.md
CHANGED
@@ -5,7 +5,7 @@ Name | Type | Description | Notes
|
|
5
5
|
------------ | ------------- | ------------- | -------------
|
6
6
|
**text** | **String** | The button text of the menu item. |
|
7
7
|
**uri** | **String** | A valid address, like http://smooch.io. Required for a link type item. | [optional]
|
8
|
-
**type** | **String** | Can either be link, postback, which correspond to Smooch’s link and postback actions, or submenu for nested menus. |
|
8
|
+
**type** | **String** | Can either be link, postback, which correspond to Smooch’s link and postback actions, or submenu for nested menus. See Enums.md for available values. |
|
9
9
|
**payload** | **String** | A payload for a postback. Required for a postback type item. | [optional]
|
10
10
|
**items** | [**Array<SubMenuItem>**](SubMenuItem.md) | A list of menu items for a submenu. | [optional]
|
11
11
|
|
data/docs/Message.md
CHANGED
@@ -5,8 +5,8 @@ Name | Type | Description | Notes
|
|
5
5
|
------------ | ------------- | ------------- | -------------
|
6
6
|
**id** | **String** | The message ID, generated automatically. |
|
7
7
|
**authorId** | **String** | The ID of the message's author. |
|
8
|
-
**role** | **String** | The role of the individual posting the message.
|
9
|
-
**type** | **String** | The message type. |
|
8
|
+
**role** | **String** | The role of the individual posting the message. See Enums.md for available values. |
|
9
|
+
**type** | **String** | The message type. See Enums.md for available values. |
|
10
10
|
**source** | [**Source**](Source.md) | The source of the message. | [optional]
|
11
11
|
**name** | **String** | The display name of the message author. |
|
12
12
|
**text** | **String** | The message text. Required for text messages. |
|
data/docs/MessageItem.md
CHANGED
@@ -6,7 +6,7 @@ Name | Type | Description | Notes
|
|
6
6
|
**title** | **String** | The title of the message item. |
|
7
7
|
**description** | **String** | The text description, or subtitle. | [optional]
|
8
8
|
**mediaUrl** | **String** | The image URL to be shown in the carousel/list item. | [optional]
|
9
|
-
**size** | **String** | The size of the image to be shown in the carousel/list item. Only top item of Facebook Messenger carousel supported.
|
9
|
+
**size** | **String** | The size of the image to be shown in the carousel/list item. Only top item of Facebook Messenger carousel supported. See Enums.md for available values. | [optional]
|
10
10
|
**mediaType** | **String** | If a *mediaUrl* was specified, the media type is defined here, for example *image/jpeg*. | [optional]
|
11
11
|
**actions** | [**Array<Action>**](Action.md) | Array of [action buttons](https://docs.smooch.io/rest/#action-buttons). At least 1 is required, a maximum of 3 are allowed. |
|
12
12
|
|
data/docs/MessagePost.md
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
## Properties
|
4
4
|
Name | Type | Description | Notes
|
5
5
|
------------ | ------------- | ------------- | -------------
|
6
|
-
**role** | **String** | The role of the individual posting the message.
|
7
|
-
**type** | **String** | The message type. |
|
6
|
+
**role** | **String** | The role of the individual posting the message. See Enums.md for available values. |
|
7
|
+
**type** | **String** | The message type. See Enums.md for available values. |
|
8
8
|
**name** | **String** | The display name of the message author. | [optional]
|
9
9
|
**email** | **String** | The email address of the message author. | [optional]
|
10
10
|
**avatarUrl** | **String** | The URL of the desired message avatar image. | [optional]
|
data/docs/Source.md
CHANGED
@@ -4,6 +4,6 @@
|
|
4
4
|
Name | Type | Description | Notes
|
5
5
|
------------ | ------------- | ------------- | -------------
|
6
6
|
**id** | **String** | An identifier used by Smooch for internal purposes. | [optional]
|
7
|
-
**type** | **String** | An identifier for the channel from which a message originated. | [optional]
|
7
|
+
**type** | **String** | An identifier for the channel from which a message originated. See Enums.md for available values. | [optional]
|
8
8
|
|
9
9
|
|
data/docs/SubMenuItem.md
CHANGED
@@ -5,7 +5,7 @@ Name | Type | Description | Notes
|
|
5
5
|
------------ | ------------- | ------------- | -------------
|
6
6
|
**text** | **String** | The button text of the menu item. |
|
7
7
|
**uri** | **String** | A valid address, like http://smooch.io. Required for a link type item. | [optional]
|
8
|
-
**type** | **String** | Can either be link, postback, which correspond to Smooch’s link and postback actions, or submenu for nested menus. |
|
8
|
+
**type** | **String** | Can either be link, postback, which correspond to Smooch’s link and postback actions, or submenu for nested menus. See Enums.md for available values. |
|
9
9
|
**payload** | **String** | A payload for a postback. Required for a postback type item. | [optional]
|
10
10
|
|
11
11
|
|
data/docs/Webhook.md
CHANGED
@@ -5,7 +5,7 @@ Name | Type | Description | Notes
|
|
5
5
|
------------ | ------------- | ------------- | -------------
|
6
6
|
**id** | **String** | The webhook ID, generated automatically. |
|
7
7
|
**target** | **String** | URL to be called when the webhook is triggered. |
|
8
|
-
**triggers** | **Array<String>** | An array of triggers you wish to have the webhook listen to.
|
8
|
+
**triggers** | **Array<String>** | An array of triggers you wish to have the webhook listen to. See Enums.md for available values. |
|
9
9
|
**secret** | **String** | Secret which will be transmitted with each webhook invocation and can be used to verify the authenticity of the caller. |
|
10
10
|
**version** | **String** | The payload version of the webhook. | [optional]
|
11
11
|
|
data/docs/WebhookCreate.md
CHANGED
@@ -4,6 +4,6 @@
|
|
4
4
|
Name | Type | Description | Notes
|
5
5
|
------------ | ------------- | ------------- | -------------
|
6
6
|
**target** | **String** | URL to be called when the webhook is triggered. |
|
7
|
-
**triggers** | **Array<String>** | An array of triggers you wish to have the webhook listen to.
|
7
|
+
**triggers** | **Array<String>** | An array of triggers you wish to have the webhook listen to. See Enums.md for available values. | [optional]
|
8
8
|
|
9
9
|
|
data/docs/WebhookUpdate.md
CHANGED
@@ -4,6 +4,6 @@
|
|
4
4
|
Name | Type | Description | Notes
|
5
5
|
------------ | ------------- | ------------- | -------------
|
6
6
|
**target** | **String** | URL to be called when the webhook is triggered. | [optional]
|
7
|
-
**triggers** | **Array<String>** | An array of triggers you wish to have the webhook listen to.
|
7
|
+
**triggers** | **Array<String>** | An array of triggers you wish to have the webhook listen to. See Enums.md for available values. | [optional]
|
8
8
|
|
9
9
|
|
data/lib/smooch-api.rb
CHANGED
@@ -39,8 +39,10 @@ require 'smooch-api/models/client'
|
|
39
39
|
require 'smooch-api/models/client_info'
|
40
40
|
require 'smooch-api/models/confirmation'
|
41
41
|
require 'smooch-api/models/conversation'
|
42
|
+
require 'smooch-api/models/conversation_activity'
|
42
43
|
require 'smooch-api/models/destination'
|
43
44
|
require 'smooch-api/models/display_settings'
|
45
|
+
require 'smooch-api/models/enums'
|
44
46
|
require 'smooch-api/models/get_messages_response'
|
45
47
|
require 'smooch-api/models/integration'
|
46
48
|
require 'smooch-api/models/integration_create'
|
@@ -78,7 +80,6 @@ require 'smooch-api/models/template'
|
|
78
80
|
require 'smooch-api/models/template_create'
|
79
81
|
require 'smooch-api/models/template_response'
|
80
82
|
require 'smooch-api/models/template_update'
|
81
|
-
require 'smooch-api/models/typing_activity_trigger'
|
82
83
|
require 'smooch-api/models/webhook'
|
83
84
|
require 'smooch-api/models/webhook_create'
|
84
85
|
require 'smooch-api/models/webhook_response'
|
@@ -20,6 +20,72 @@ module SmoochApi
|
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
22
|
|
23
|
+
#
|
24
|
+
# Notify Smooch when an app maker starts or stops typing a response.
|
25
|
+
# @param appId Identifies the app.
|
26
|
+
# @param userId Identifies the user. Can be either the smoochId or the userId.
|
27
|
+
# @param conversationActivityBody Body for a triggerConversationActivity request.
|
28
|
+
# @param [Hash] opts the optional parameters
|
29
|
+
# @return [nil]
|
30
|
+
def conversation_activity(appId, userId, conversationActivityBody, opts = {})
|
31
|
+
conversation_activity_with_http_info(appId, userId, conversationActivityBody, opts)
|
32
|
+
return nil
|
33
|
+
end
|
34
|
+
|
35
|
+
#
|
36
|
+
# Notify Smooch when an app maker starts or stops typing a response.
|
37
|
+
# @param appId Identifies the app.
|
38
|
+
# @param userId Identifies the user. Can be either the smoochId or the userId.
|
39
|
+
# @param conversationActivityBody Body for a triggerConversationActivity request.
|
40
|
+
# @param [Hash] opts the optional parameters
|
41
|
+
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
42
|
+
def conversation_activity_with_http_info(appId, userId, conversationActivityBody, opts = {})
|
43
|
+
if @api_client.config.debugging
|
44
|
+
@api_client.config.logger.debug "Calling API: ConversationApi.conversation_activity ..."
|
45
|
+
end
|
46
|
+
# verify the required parameter 'appId' is set
|
47
|
+
if @api_client.config.client_side_validation && appId.nil?
|
48
|
+
fail ArgumentError, "Missing the required parameter 'appId' when calling ConversationApi.conversation_activity"
|
49
|
+
end
|
50
|
+
# verify the required parameter 'userId' is set
|
51
|
+
if @api_client.config.client_side_validation && userId.nil?
|
52
|
+
fail ArgumentError, "Missing the required parameter 'userId' when calling ConversationApi.conversation_activity"
|
53
|
+
end
|
54
|
+
# verify the required parameter 'conversationActivityBody' is set
|
55
|
+
if @api_client.config.client_side_validation && conversationActivityBody.nil?
|
56
|
+
fail ArgumentError, "Missing the required parameter 'conversationActivityBody' when calling ConversationApi.conversation_activity"
|
57
|
+
end
|
58
|
+
# resource path
|
59
|
+
local_var_path = "/v1.1/apps/{appId}/appusers/{userId}/conversation/activity".sub('{' + 'appId' + '}', appId.to_s).sub('{' + 'userId' + '}', userId.to_s)
|
60
|
+
|
61
|
+
# query parameters
|
62
|
+
query_params = {}
|
63
|
+
|
64
|
+
# header parameters
|
65
|
+
header_params = {}
|
66
|
+
# HTTP header 'Accept' (if needed)
|
67
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
68
|
+
# HTTP header 'Content-Type'
|
69
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
70
|
+
|
71
|
+
# form parameters
|
72
|
+
form_params = {}
|
73
|
+
|
74
|
+
# http body (model)
|
75
|
+
post_body = @api_client.object_to_http_body(conversationActivityBody)
|
76
|
+
auth_names = ['jwt']
|
77
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
78
|
+
:header_params => header_params,
|
79
|
+
:query_params => query_params,
|
80
|
+
:form_params => form_params,
|
81
|
+
:body => post_body,
|
82
|
+
:auth_names => auth_names)
|
83
|
+
if @api_client.config.debugging
|
84
|
+
@api_client.config.logger.debug "API called: ConversationApi#conversation_activity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
85
|
+
end
|
86
|
+
return data, status_code, headers
|
87
|
+
end
|
88
|
+
|
23
89
|
#
|
24
90
|
# Deletes a single message.
|
25
91
|
# @param appId Identifies the app.
|
@@ -339,71 +405,5 @@ module SmoochApi
|
|
339
405
|
end
|
340
406
|
return data, status_code, headers
|
341
407
|
end
|
342
|
-
|
343
|
-
#
|
344
|
-
# Notify Smooch when an app maker starts or stops typing a response.
|
345
|
-
# @param appId Identifies the app.
|
346
|
-
# @param userId Identifies the user. Can be either the smoochId or the userId.
|
347
|
-
# @param typingActivityTriggerBody Body for a triggerTypingActivity request.
|
348
|
-
# @param [Hash] opts the optional parameters
|
349
|
-
# @return [nil]
|
350
|
-
def trigger_typing_activity(appId, userId, typingActivityTriggerBody, opts = {})
|
351
|
-
trigger_typing_activity_with_http_info(appId, userId, typingActivityTriggerBody, opts)
|
352
|
-
return nil
|
353
|
-
end
|
354
|
-
|
355
|
-
#
|
356
|
-
# Notify Smooch when an app maker starts or stops typing a response.
|
357
|
-
# @param appId Identifies the app.
|
358
|
-
# @param userId Identifies the user. Can be either the smoochId or the userId.
|
359
|
-
# @param typingActivityTriggerBody Body for a triggerTypingActivity request.
|
360
|
-
# @param [Hash] opts the optional parameters
|
361
|
-
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
362
|
-
def trigger_typing_activity_with_http_info(appId, userId, typingActivityTriggerBody, opts = {})
|
363
|
-
if @api_client.config.debugging
|
364
|
-
@api_client.config.logger.debug "Calling API: ConversationApi.trigger_typing_activity ..."
|
365
|
-
end
|
366
|
-
# verify the required parameter 'appId' is set
|
367
|
-
if @api_client.config.client_side_validation && appId.nil?
|
368
|
-
fail ArgumentError, "Missing the required parameter 'appId' when calling ConversationApi.trigger_typing_activity"
|
369
|
-
end
|
370
|
-
# verify the required parameter 'userId' is set
|
371
|
-
if @api_client.config.client_side_validation && userId.nil?
|
372
|
-
fail ArgumentError, "Missing the required parameter 'userId' when calling ConversationApi.trigger_typing_activity"
|
373
|
-
end
|
374
|
-
# verify the required parameter 'typingActivityTriggerBody' is set
|
375
|
-
if @api_client.config.client_side_validation && typingActivityTriggerBody.nil?
|
376
|
-
fail ArgumentError, "Missing the required parameter 'typingActivityTriggerBody' when calling ConversationApi.trigger_typing_activity"
|
377
|
-
end
|
378
|
-
# resource path
|
379
|
-
local_var_path = "/v1.1/apps/{appId}/appusers/{userId}/conversation/activity".sub('{' + 'appId' + '}', appId.to_s).sub('{' + 'userId' + '}', userId.to_s)
|
380
|
-
|
381
|
-
# query parameters
|
382
|
-
query_params = {}
|
383
|
-
|
384
|
-
# header parameters
|
385
|
-
header_params = {}
|
386
|
-
# HTTP header 'Accept' (if needed)
|
387
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
388
|
-
# HTTP header 'Content-Type'
|
389
|
-
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
390
|
-
|
391
|
-
# form parameters
|
392
|
-
form_params = {}
|
393
|
-
|
394
|
-
# http body (model)
|
395
|
-
post_body = @api_client.object_to_http_body(typingActivityTriggerBody)
|
396
|
-
auth_names = ['jwt']
|
397
|
-
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
398
|
-
:header_params => header_params,
|
399
|
-
:query_params => query_params,
|
400
|
-
:form_params => form_params,
|
401
|
-
:body => post_body,
|
402
|
-
:auth_names => auth_names)
|
403
|
-
if @api_client.config.debugging
|
404
|
-
@api_client.config.logger.debug "API called: ConversationApi#trigger_typing_activity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
405
|
-
end
|
406
|
-
return data, status_code, headers
|
407
|
-
end
|
408
408
|
end
|
409
409
|
end
|
@@ -15,7 +15,7 @@ require 'date'
|
|
15
15
|
module SmoochApi
|
16
16
|
|
17
17
|
class Action
|
18
|
-
# The action type.
|
18
|
+
# The action type. See Enums.md for available values.
|
19
19
|
attr_accessor :type
|
20
20
|
|
21
21
|
# The button text.
|
@@ -45,7 +45,7 @@ module SmoochApi
|
|
45
45
|
# The webview action fallback uri. This is the link that will be used in clients that do not support webviews. Required for *webview* actions.
|
46
46
|
attr_accessor :fallback
|
47
47
|
|
48
|
-
# The size used to display the webview. Allowed values are [\"compact\", \"tall\", \"full\"]. (Optional) Used for *webview* actions.
|
48
|
+
# The size used to display the webview. Allowed values are [\"compact\", \"tall\", \"full\"]. (Optional) Used for *webview* actions. See Enums.md for available values.
|
49
49
|
attr_accessor :size
|
50
50
|
|
51
51
|
# Extra options to pass directly to the channel API. See [Extra Channel Options](https://docs.smooch.io/rest#extra-channel-options-schema)
|
@@ -15,7 +15,7 @@ require 'date'
|
|
15
15
|
module SmoochApi
|
16
16
|
|
17
17
|
class AppUserLink
|
18
|
-
# The type of the channel to link.
|
18
|
+
# The type of the channel to link. See Enums.md for available values.
|
19
19
|
attr_accessor :type
|
20
20
|
|
21
21
|
# A String of the appUser’s phone number. It must contain the + prefix and the country code. Required for *messenger*, *twilio* and *messagebird* linking.
|
@@ -15,7 +15,7 @@ require 'date'
|
|
15
15
|
module SmoochApi
|
16
16
|
|
17
17
|
class BusinessSystemItem
|
18
|
-
# The type of business system
|
18
|
+
# The type of business system. See Enums.md for available values.
|
19
19
|
attr_accessor :type
|
20
20
|
|
21
21
|
# The channel id for a *slack* integration
|
@@ -15,7 +15,7 @@ require 'date'
|
|
15
15
|
module SmoochApi
|
16
16
|
|
17
17
|
class ChannelEntityItem
|
18
|
-
# The type of channel
|
18
|
+
# The type of channel. See Enums.md for available values.
|
19
19
|
attr_accessor :type
|
20
20
|
|
21
21
|
# The phone number for a *twilio*, *messageBird* integration
|
@@ -24,7 +24,7 @@ module SmoochApi
|
|
24
24
|
# The date time the client was last seen.
|
25
25
|
attr_accessor :lastSeen
|
26
26
|
|
27
|
-
# The client's platform.
|
27
|
+
# The client's platform. See Enums.md for available values.
|
28
28
|
attr_accessor :platform
|
29
29
|
|
30
30
|
# The GCM or APN token to be used for sending push notifications to the device. Applies to only *android* and *ios* clients.
|
@@ -15,7 +15,7 @@ require 'date'
|
|
15
15
|
module SmoochApi
|
16
16
|
|
17
17
|
class Confirmation
|
18
|
-
# The confirmation type.
|
18
|
+
# The confirmation type. See Enums.md for available values.
|
19
19
|
attr_accessor :type
|
20
20
|
|
21
21
|
# The message used to reach out to the user. Must be a valid message object as per the post message API.
|
@@ -14,11 +14,11 @@ require 'date'
|
|
14
14
|
|
15
15
|
module SmoochApi
|
16
16
|
|
17
|
-
class
|
18
|
-
# The role of the actor. Must be *appMaker*.
|
17
|
+
class ConversationActivity
|
18
|
+
# The role of the actor. Must be *appMaker*. See Enums.md for available values.
|
19
19
|
attr_accessor :role
|
20
20
|
|
21
|
-
# The type of activity to trigger. Must be either *typing:start* or *typing:stop*.
|
21
|
+
# The type of activity to trigger. Must be either *typing:start* or *typing:stop*. See Enums.md for available values.
|
22
22
|
attr_accessor :type
|
23
23
|
|
24
24
|
# The name of the app maker that starts or stops typing a response.
|
@@ -15,7 +15,7 @@ require 'date'
|
|
15
15
|
module SmoochApi
|
16
16
|
|
17
17
|
class DisplaySettings
|
18
|
-
# Specifies how to display all carousel images.
|
18
|
+
# Specifies how to display all carousel images. See Enums.md for available values.
|
19
19
|
attr_accessor :imageAspectRatio
|
20
20
|
|
21
21
|
|
@@ -0,0 +1,473 @@
|
|
1
|
+
=begin
|
2
|
+
#Smooch
|
3
|
+
|
4
|
+
#The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io).
|
5
|
+
|
6
|
+
OpenAPI spec version: 4.2
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.2.3-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module SmoochApi
|
16
|
+
|
17
|
+
class Enums
|
18
|
+
attr_accessor :actionSize
|
19
|
+
|
20
|
+
attr_accessor :actionType
|
21
|
+
|
22
|
+
attr_accessor :businessSystemType
|
23
|
+
|
24
|
+
attr_accessor :confirmationType
|
25
|
+
|
26
|
+
attr_accessor :conversationActivityType
|
27
|
+
|
28
|
+
attr_accessor :imageAspectRatio
|
29
|
+
|
30
|
+
attr_accessor :integrationStatus
|
31
|
+
|
32
|
+
attr_accessor :integrationType
|
33
|
+
|
34
|
+
attr_accessor :menuItemType
|
35
|
+
|
36
|
+
attr_accessor :messageItemSize
|
37
|
+
|
38
|
+
attr_accessor :messageType
|
39
|
+
|
40
|
+
attr_accessor :role
|
41
|
+
|
42
|
+
attr_accessor :webhookTriggers
|
43
|
+
|
44
|
+
class EnumAttributeValidator
|
45
|
+
attr_reader :datatype
|
46
|
+
attr_reader :allowable_values
|
47
|
+
|
48
|
+
def initialize(datatype, allowable_values)
|
49
|
+
@allowable_values = allowable_values.map do |value|
|
50
|
+
case datatype.to_s
|
51
|
+
when /Integer/i
|
52
|
+
value.to_i
|
53
|
+
when /Float/i
|
54
|
+
value.to_f
|
55
|
+
else
|
56
|
+
value
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def valid?(value)
|
62
|
+
!value || allowable_values.include?(value)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
67
|
+
def self.attribute_map
|
68
|
+
{
|
69
|
+
:'actionSize' => :'ActionSize',
|
70
|
+
:'actionType' => :'ActionType',
|
71
|
+
:'businessSystemType' => :'BusinessSystemType',
|
72
|
+
:'confirmationType' => :'ConfirmationType',
|
73
|
+
:'conversationActivityType' => :'ConversationActivityType',
|
74
|
+
:'imageAspectRatio' => :'ImageAspectRatio',
|
75
|
+
:'integrationStatus' => :'IntegrationStatus',
|
76
|
+
:'integrationType' => :'IntegrationType',
|
77
|
+
:'menuItemType' => :'MenuItemType',
|
78
|
+
:'messageItemSize' => :'MessageItemSize',
|
79
|
+
:'messageType' => :'MessageType',
|
80
|
+
:'role' => :'Role',
|
81
|
+
:'webhookTriggers' => :'WebhookTriggers'
|
82
|
+
}
|
83
|
+
end
|
84
|
+
|
85
|
+
# Attribute type mapping.
|
86
|
+
def self.swagger_types
|
87
|
+
{
|
88
|
+
:'actionSize' => :'String',
|
89
|
+
:'actionType' => :'String',
|
90
|
+
:'businessSystemType' => :'String',
|
91
|
+
:'confirmationType' => :'String',
|
92
|
+
:'conversationActivityType' => :'String',
|
93
|
+
:'imageAspectRatio' => :'String',
|
94
|
+
:'integrationStatus' => :'String',
|
95
|
+
:'integrationType' => :'String',
|
96
|
+
:'menuItemType' => :'String',
|
97
|
+
:'messageItemSize' => :'String',
|
98
|
+
:'messageType' => :'String',
|
99
|
+
:'role' => :'String',
|
100
|
+
:'webhookTriggers' => :'String'
|
101
|
+
}
|
102
|
+
end
|
103
|
+
|
104
|
+
# Initializes the object
|
105
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
106
|
+
def initialize(attributes = {})
|
107
|
+
return unless attributes.is_a?(Hash)
|
108
|
+
|
109
|
+
# convert string to symbol for hash key
|
110
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
111
|
+
|
112
|
+
if attributes.has_key?(:'ActionSize')
|
113
|
+
self.actionSize = attributes[:'ActionSize']
|
114
|
+
end
|
115
|
+
|
116
|
+
if attributes.has_key?(:'ActionType')
|
117
|
+
self.actionType = attributes[:'ActionType']
|
118
|
+
end
|
119
|
+
|
120
|
+
if attributes.has_key?(:'BusinessSystemType')
|
121
|
+
self.businessSystemType = attributes[:'BusinessSystemType']
|
122
|
+
end
|
123
|
+
|
124
|
+
if attributes.has_key?(:'ConfirmationType')
|
125
|
+
self.confirmationType = attributes[:'ConfirmationType']
|
126
|
+
end
|
127
|
+
|
128
|
+
if attributes.has_key?(:'ConversationActivityType')
|
129
|
+
self.conversationActivityType = attributes[:'ConversationActivityType']
|
130
|
+
end
|
131
|
+
|
132
|
+
if attributes.has_key?(:'ImageAspectRatio')
|
133
|
+
self.imageAspectRatio = attributes[:'ImageAspectRatio']
|
134
|
+
end
|
135
|
+
|
136
|
+
if attributes.has_key?(:'IntegrationStatus')
|
137
|
+
self.integrationStatus = attributes[:'IntegrationStatus']
|
138
|
+
end
|
139
|
+
|
140
|
+
if attributes.has_key?(:'IntegrationType')
|
141
|
+
self.integrationType = attributes[:'IntegrationType']
|
142
|
+
end
|
143
|
+
|
144
|
+
if attributes.has_key?(:'MenuItemType')
|
145
|
+
self.menuItemType = attributes[:'MenuItemType']
|
146
|
+
end
|
147
|
+
|
148
|
+
if attributes.has_key?(:'MessageItemSize')
|
149
|
+
self.messageItemSize = attributes[:'MessageItemSize']
|
150
|
+
end
|
151
|
+
|
152
|
+
if attributes.has_key?(:'MessageType')
|
153
|
+
self.messageType = attributes[:'MessageType']
|
154
|
+
end
|
155
|
+
|
156
|
+
if attributes.has_key?(:'Role')
|
157
|
+
self.role = attributes[:'Role']
|
158
|
+
end
|
159
|
+
|
160
|
+
if attributes.has_key?(:'WebhookTriggers')
|
161
|
+
self.webhookTriggers = attributes[:'WebhookTriggers']
|
162
|
+
end
|
163
|
+
|
164
|
+
end
|
165
|
+
|
166
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
167
|
+
# @return Array for valid properies with the reasons
|
168
|
+
def list_invalid_properties
|
169
|
+
invalid_properties = Array.new
|
170
|
+
return invalid_properties
|
171
|
+
end
|
172
|
+
|
173
|
+
# Check to see if the all the properties in the model are valid
|
174
|
+
# @return true if the model is valid
|
175
|
+
def valid?
|
176
|
+
actionSize_validator = EnumAttributeValidator.new('String', ["compact", "full", "tall"])
|
177
|
+
return false unless actionSize_validator.valid?(@actionSize)
|
178
|
+
actionType_validator = EnumAttributeValidator.new('String', ["buy", "link", "locationRequest", "postback", "reply", "share", "webview"])
|
179
|
+
return false unless actionType_validator.valid?(@actionType)
|
180
|
+
businessSystemType_validator = EnumAttributeValidator.new('String', ["helpscout", "slack", "zendesk"])
|
181
|
+
return false unless businessSystemType_validator.valid?(@businessSystemType)
|
182
|
+
confirmationType_validator = EnumAttributeValidator.new('String', ["immediate", "userActivity", "prompt"])
|
183
|
+
return false unless confirmationType_validator.valid?(@confirmationType)
|
184
|
+
conversationActivityType_validator = EnumAttributeValidator.new('String', ["conversation:read", "typing:start", "typing:stop"])
|
185
|
+
return false unless conversationActivityType_validator.valid?(@conversationActivityType)
|
186
|
+
imageAspectRatio_validator = EnumAttributeValidator.new('String', ["horizontal", "square"])
|
187
|
+
return false unless imageAspectRatio_validator.valid?(@imageAspectRatio)
|
188
|
+
integrationStatus_validator = EnumAttributeValidator.new('String', ["active", "inactive", "error"])
|
189
|
+
return false unless integrationStatus_validator.valid?(@integrationStatus)
|
190
|
+
integrationType_validator = EnumAttributeValidator.new('String', ["android", "api", "apn", "fcm", "ios", "line", "mailgun", "messagebird", "messenger", "telegram", "twilio", "twitter", "viber", "web", "wechat", "whatsapp"])
|
191
|
+
return false unless integrationType_validator.valid?(@integrationType)
|
192
|
+
menuItemType_validator = EnumAttributeValidator.new('String', ["link", "postback", "submenu"])
|
193
|
+
return false unless menuItemType_validator.valid?(@menuItemType)
|
194
|
+
messageItemSize_validator = EnumAttributeValidator.new('String', ["compact", "large"])
|
195
|
+
return false unless messageItemSize_validator.valid?(@messageItemSize)
|
196
|
+
messageType_validator = EnumAttributeValidator.new('String', ["carousel", "file", "image", "list", "location", "text"])
|
197
|
+
return false unless messageType_validator.valid?(@messageType)
|
198
|
+
role_validator = EnumAttributeValidator.new('String', ["appMaker", "appUser"])
|
199
|
+
return false unless role_validator.valid?(@role)
|
200
|
+
webhookTriggers_validator = EnumAttributeValidator.new('String', ["appUser:delete", "client:add", "client:remove", "conversation:read", "conversation:referral", "link:failure", "link:match", "link:success", "merge:appUser", "message:appMaker", "message:appUser", "message:delivery:channel", "message:delivery:failure", "message:delivery:user", "payment:success", "postback", "typing:appUser"])
|
201
|
+
return false unless webhookTriggers_validator.valid?(@webhookTriggers)
|
202
|
+
return true
|
203
|
+
end
|
204
|
+
|
205
|
+
# Custom attribute writer method checking allowed values (enum).
|
206
|
+
# @param [Object] actionSize Object to be assigned
|
207
|
+
def actionSize=(actionSize)
|
208
|
+
validator = EnumAttributeValidator.new('String', ["compact", "full", "tall"])
|
209
|
+
unless validator.valid?(actionSize)
|
210
|
+
fail ArgumentError, "invalid value for 'actionSize', must be one of #{validator.allowable_values}."
|
211
|
+
end
|
212
|
+
@actionSize = actionSize
|
213
|
+
end
|
214
|
+
|
215
|
+
# Custom attribute writer method checking allowed values (enum).
|
216
|
+
# @param [Object] actionType Object to be assigned
|
217
|
+
def actionType=(actionType)
|
218
|
+
validator = EnumAttributeValidator.new('String', ["buy", "link", "locationRequest", "postback", "reply", "share", "webview"])
|
219
|
+
unless validator.valid?(actionType)
|
220
|
+
fail ArgumentError, "invalid value for 'actionType', must be one of #{validator.allowable_values}."
|
221
|
+
end
|
222
|
+
@actionType = actionType
|
223
|
+
end
|
224
|
+
|
225
|
+
# Custom attribute writer method checking allowed values (enum).
|
226
|
+
# @param [Object] businessSystemType Object to be assigned
|
227
|
+
def businessSystemType=(businessSystemType)
|
228
|
+
validator = EnumAttributeValidator.new('String', ["helpscout", "slack", "zendesk"])
|
229
|
+
unless validator.valid?(businessSystemType)
|
230
|
+
fail ArgumentError, "invalid value for 'businessSystemType', must be one of #{validator.allowable_values}."
|
231
|
+
end
|
232
|
+
@businessSystemType = businessSystemType
|
233
|
+
end
|
234
|
+
|
235
|
+
# Custom attribute writer method checking allowed values (enum).
|
236
|
+
# @param [Object] confirmationType Object to be assigned
|
237
|
+
def confirmationType=(confirmationType)
|
238
|
+
validator = EnumAttributeValidator.new('String', ["immediate", "userActivity", "prompt"])
|
239
|
+
unless validator.valid?(confirmationType)
|
240
|
+
fail ArgumentError, "invalid value for 'confirmationType', must be one of #{validator.allowable_values}."
|
241
|
+
end
|
242
|
+
@confirmationType = confirmationType
|
243
|
+
end
|
244
|
+
|
245
|
+
# Custom attribute writer method checking allowed values (enum).
|
246
|
+
# @param [Object] conversationActivityType Object to be assigned
|
247
|
+
def conversationActivityType=(conversationActivityType)
|
248
|
+
validator = EnumAttributeValidator.new('String', ["conversation:read", "typing:start", "typing:stop"])
|
249
|
+
unless validator.valid?(conversationActivityType)
|
250
|
+
fail ArgumentError, "invalid value for 'conversationActivityType', must be one of #{validator.allowable_values}."
|
251
|
+
end
|
252
|
+
@conversationActivityType = conversationActivityType
|
253
|
+
end
|
254
|
+
|
255
|
+
# Custom attribute writer method checking allowed values (enum).
|
256
|
+
# @param [Object] imageAspectRatio Object to be assigned
|
257
|
+
def imageAspectRatio=(imageAspectRatio)
|
258
|
+
validator = EnumAttributeValidator.new('String', ["horizontal", "square"])
|
259
|
+
unless validator.valid?(imageAspectRatio)
|
260
|
+
fail ArgumentError, "invalid value for 'imageAspectRatio', must be one of #{validator.allowable_values}."
|
261
|
+
end
|
262
|
+
@imageAspectRatio = imageAspectRatio
|
263
|
+
end
|
264
|
+
|
265
|
+
# Custom attribute writer method checking allowed values (enum).
|
266
|
+
# @param [Object] integrationStatus Object to be assigned
|
267
|
+
def integrationStatus=(integrationStatus)
|
268
|
+
validator = EnumAttributeValidator.new('String', ["active", "inactive", "error"])
|
269
|
+
unless validator.valid?(integrationStatus)
|
270
|
+
fail ArgumentError, "invalid value for 'integrationStatus', must be one of #{validator.allowable_values}."
|
271
|
+
end
|
272
|
+
@integrationStatus = integrationStatus
|
273
|
+
end
|
274
|
+
|
275
|
+
# Custom attribute writer method checking allowed values (enum).
|
276
|
+
# @param [Object] integrationType Object to be assigned
|
277
|
+
def integrationType=(integrationType)
|
278
|
+
validator = EnumAttributeValidator.new('String', ["android", "api", "apn", "fcm", "ios", "line", "mailgun", "messagebird", "messenger", "telegram", "twilio", "twitter", "viber", "web", "wechat", "whatsapp"])
|
279
|
+
unless validator.valid?(integrationType)
|
280
|
+
fail ArgumentError, "invalid value for 'integrationType', must be one of #{validator.allowable_values}."
|
281
|
+
end
|
282
|
+
@integrationType = integrationType
|
283
|
+
end
|
284
|
+
|
285
|
+
# Custom attribute writer method checking allowed values (enum).
|
286
|
+
# @param [Object] menuItemType Object to be assigned
|
287
|
+
def menuItemType=(menuItemType)
|
288
|
+
validator = EnumAttributeValidator.new('String', ["link", "postback", "submenu"])
|
289
|
+
unless validator.valid?(menuItemType)
|
290
|
+
fail ArgumentError, "invalid value for 'menuItemType', must be one of #{validator.allowable_values}."
|
291
|
+
end
|
292
|
+
@menuItemType = menuItemType
|
293
|
+
end
|
294
|
+
|
295
|
+
# Custom attribute writer method checking allowed values (enum).
|
296
|
+
# @param [Object] messageItemSize Object to be assigned
|
297
|
+
def messageItemSize=(messageItemSize)
|
298
|
+
validator = EnumAttributeValidator.new('String', ["compact", "large"])
|
299
|
+
unless validator.valid?(messageItemSize)
|
300
|
+
fail ArgumentError, "invalid value for 'messageItemSize', must be one of #{validator.allowable_values}."
|
301
|
+
end
|
302
|
+
@messageItemSize = messageItemSize
|
303
|
+
end
|
304
|
+
|
305
|
+
# Custom attribute writer method checking allowed values (enum).
|
306
|
+
# @param [Object] messageType Object to be assigned
|
307
|
+
def messageType=(messageType)
|
308
|
+
validator = EnumAttributeValidator.new('String', ["carousel", "file", "image", "list", "location", "text"])
|
309
|
+
unless validator.valid?(messageType)
|
310
|
+
fail ArgumentError, "invalid value for 'messageType', must be one of #{validator.allowable_values}."
|
311
|
+
end
|
312
|
+
@messageType = messageType
|
313
|
+
end
|
314
|
+
|
315
|
+
# Custom attribute writer method checking allowed values (enum).
|
316
|
+
# @param [Object] role Object to be assigned
|
317
|
+
def role=(role)
|
318
|
+
validator = EnumAttributeValidator.new('String', ["appMaker", "appUser"])
|
319
|
+
unless validator.valid?(role)
|
320
|
+
fail ArgumentError, "invalid value for 'role', must be one of #{validator.allowable_values}."
|
321
|
+
end
|
322
|
+
@role = role
|
323
|
+
end
|
324
|
+
|
325
|
+
# Custom attribute writer method checking allowed values (enum).
|
326
|
+
# @param [Object] webhookTriggers Object to be assigned
|
327
|
+
def webhookTriggers=(webhookTriggers)
|
328
|
+
validator = EnumAttributeValidator.new('String', ["appUser:delete", "client:add", "client:remove", "conversation:read", "conversation:referral", "link:failure", "link:match", "link:success", "merge:appUser", "message:appMaker", "message:appUser", "message:delivery:channel", "message:delivery:failure", "message:delivery:user", "payment:success", "postback", "typing:appUser"])
|
329
|
+
unless validator.valid?(webhookTriggers)
|
330
|
+
fail ArgumentError, "invalid value for 'webhookTriggers', must be one of #{validator.allowable_values}."
|
331
|
+
end
|
332
|
+
@webhookTriggers = webhookTriggers
|
333
|
+
end
|
334
|
+
|
335
|
+
# Checks equality by comparing each attribute.
|
336
|
+
# @param [Object] Object to be compared
|
337
|
+
def ==(o)
|
338
|
+
return true if self.equal?(o)
|
339
|
+
self.class == o.class &&
|
340
|
+
actionSize == o.actionSize &&
|
341
|
+
actionType == o.actionType &&
|
342
|
+
businessSystemType == o.businessSystemType &&
|
343
|
+
confirmationType == o.confirmationType &&
|
344
|
+
conversationActivityType == o.conversationActivityType &&
|
345
|
+
imageAspectRatio == o.imageAspectRatio &&
|
346
|
+
integrationStatus == o.integrationStatus &&
|
347
|
+
integrationType == o.integrationType &&
|
348
|
+
menuItemType == o.menuItemType &&
|
349
|
+
messageItemSize == o.messageItemSize &&
|
350
|
+
messageType == o.messageType &&
|
351
|
+
role == o.role &&
|
352
|
+
webhookTriggers == o.webhookTriggers
|
353
|
+
end
|
354
|
+
|
355
|
+
# @see the `==` method
|
356
|
+
# @param [Object] Object to be compared
|
357
|
+
def eql?(o)
|
358
|
+
self == o
|
359
|
+
end
|
360
|
+
|
361
|
+
# Calculates hash code according to all attributes.
|
362
|
+
# @return [Fixnum] Hash code
|
363
|
+
def hash
|
364
|
+
[actionSize, actionType, businessSystemType, confirmationType, conversationActivityType, imageAspectRatio, integrationStatus, integrationType, menuItemType, messageItemSize, messageType, role, webhookTriggers].hash
|
365
|
+
end
|
366
|
+
|
367
|
+
# Builds the object from hash
|
368
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
369
|
+
# @return [Object] Returns the model itself
|
370
|
+
def build_from_hash(attributes)
|
371
|
+
return nil unless attributes.is_a?(Hash)
|
372
|
+
self.class.swagger_types.each_pair do |key, type|
|
373
|
+
if type =~ /\AArray<(.*)>/i
|
374
|
+
# check to ensure the input is an array given that the the attribute
|
375
|
+
# is documented as an array but the input is not
|
376
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
377
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
378
|
+
end
|
379
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
380
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
381
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
382
|
+
end
|
383
|
+
|
384
|
+
self
|
385
|
+
end
|
386
|
+
|
387
|
+
# Deserializes the data based on type
|
388
|
+
# @param string type Data type
|
389
|
+
# @param string value Value to be deserialized
|
390
|
+
# @return [Object] Deserialized data
|
391
|
+
def _deserialize(type, value)
|
392
|
+
case type.to_sym
|
393
|
+
when :DateTime
|
394
|
+
DateTime.parse(value)
|
395
|
+
when :Date
|
396
|
+
Date.parse(value)
|
397
|
+
when :String
|
398
|
+
value.to_s
|
399
|
+
when :Integer
|
400
|
+
value.to_i
|
401
|
+
when :Float
|
402
|
+
value.to_f
|
403
|
+
when :BOOLEAN
|
404
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
405
|
+
true
|
406
|
+
else
|
407
|
+
false
|
408
|
+
end
|
409
|
+
when :Object
|
410
|
+
# generic object (usually a Hash), return directly
|
411
|
+
value
|
412
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
413
|
+
inner_type = Regexp.last_match[:inner_type]
|
414
|
+
value.map { |v| _deserialize(inner_type, v) }
|
415
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
416
|
+
k_type = Regexp.last_match[:k_type]
|
417
|
+
v_type = Regexp.last_match[:v_type]
|
418
|
+
{}.tap do |hash|
|
419
|
+
value.each do |k, v|
|
420
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
421
|
+
end
|
422
|
+
end
|
423
|
+
else # model
|
424
|
+
temp_model = SmoochApi.const_get(type).new
|
425
|
+
temp_model.build_from_hash(value)
|
426
|
+
end
|
427
|
+
end
|
428
|
+
|
429
|
+
# Returns the string representation of the object
|
430
|
+
# @return [String] String presentation of the object
|
431
|
+
def to_s
|
432
|
+
to_hash.to_s
|
433
|
+
end
|
434
|
+
|
435
|
+
# to_body is an alias to to_hash (backward compatibility)
|
436
|
+
# @return [Hash] Returns the object in the form of hash
|
437
|
+
def to_body
|
438
|
+
to_hash
|
439
|
+
end
|
440
|
+
|
441
|
+
# Returns the object in the form of hash
|
442
|
+
# @return [Hash] Returns the object in the form of hash
|
443
|
+
def to_hash
|
444
|
+
hash = {}
|
445
|
+
self.class.attribute_map.each_pair do |attr, param|
|
446
|
+
value = self.send(attr)
|
447
|
+
next if value.nil?
|
448
|
+
hash[param] = _to_hash(value)
|
449
|
+
end
|
450
|
+
hash
|
451
|
+
end
|
452
|
+
|
453
|
+
# Outputs non-array value in the form of hash
|
454
|
+
# For object, use to_hash. Otherwise, just return the value
|
455
|
+
# @param [Object] value Any valid value
|
456
|
+
# @return [Hash] Returns the value in the form of hash
|
457
|
+
def _to_hash(value)
|
458
|
+
if value.is_a?(Array)
|
459
|
+
value.compact.map{ |v| _to_hash(v) }
|
460
|
+
elsif value.is_a?(Hash)
|
461
|
+
{}.tap do |hash|
|
462
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
463
|
+
end
|
464
|
+
elsif value.respond_to? :to_hash
|
465
|
+
value.to_hash
|
466
|
+
else
|
467
|
+
value
|
468
|
+
end
|
469
|
+
end
|
470
|
+
|
471
|
+
end
|
472
|
+
|
473
|
+
end
|