twilio-ruby 5.25.3 → 5.25.4
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.
- checksums.yaml +4 -4
- data/CHANGES.md +26 -0
- data/README.md +2 -2
- data/lib/twilio-ruby/rest/api/v2010/account/message.rb +1 -8
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/field_type/field_value.rb +4 -4
- data/lib/twilio-ruby/rest/flex_api.rb +16 -0
- data/lib/twilio-ruby/rest/flex_api/v1.rb +30 -0
- data/lib/twilio-ruby/rest/flex_api/v1/channel.rb +352 -0
- data/lib/twilio-ruby/rest/flex_api/v1/configuration.rb +7 -0
- data/lib/twilio-ruby/rest/flex_api/v1/web_channel.rb +358 -0
- data/lib/twilio-ruby/rest/insights/v1/summary.rb +0 -14
- data/lib/twilio-ruby/rest/ip_messaging.rb +2 -2
- data/lib/twilio-ruby/rest/sync/v1/service.rb +22 -3
- data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +5 -5
- data/lib/twilio-ruby/rest/verify/v2/service/verification_check.rb +2 -2
- data/lib/twilio-ruby/twiml/voice_response.rb +19 -7
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/conversations/v1/conversation_spec.rb +1 -1
- data/spec/integration/flex_api/v1/channel_spec.rb +191 -0
- data/spec/integration/flex_api/v1/configuration_spec.rb +24 -0
- data/spec/integration/flex_api/v1/web_channel_spec.rb +220 -0
- data/spec/integration/insights/v1/summary_spec.rb +0 -2
- data/spec/integration/ip_messaging/v1/credential_spec.rb +5 -5
- data/spec/integration/ip_messaging/v1/service/channel/invite_spec.rb +4 -4
- data/spec/integration/ip_messaging/v1/service/channel/member_spec.rb +5 -5
- data/spec/integration/ip_messaging/v1/service/channel/message_spec.rb +5 -5
- data/spec/integration/ip_messaging/v1/service/channel_spec.rb +5 -5
- data/spec/integration/ip_messaging/v1/service/role_spec.rb +5 -5
- data/spec/integration/ip_messaging/v1/service/user/user_channel_spec.rb +1 -1
- data/spec/integration/ip_messaging/v1/service/user_spec.rb +5 -5
- data/spec/integration/ip_messaging/v1/service_spec.rb +5 -5
- data/spec/integration/ip_messaging/v2/credential_spec.rb +5 -5
- data/spec/integration/ip_messaging/v2/service/binding_spec.rb +3 -3
- data/spec/integration/ip_messaging/v2/service/channel/invite_spec.rb +4 -4
- data/spec/integration/ip_messaging/v2/service/channel/member_spec.rb +5 -5
- data/spec/integration/ip_messaging/v2/service/channel/message_spec.rb +5 -5
- data/spec/integration/ip_messaging/v2/service/channel/webhook_spec.rb +5 -5
- data/spec/integration/ip_messaging/v2/service/channel_spec.rb +5 -5
- data/spec/integration/ip_messaging/v2/service/role_spec.rb +5 -5
- data/spec/integration/ip_messaging/v2/service/user/user_binding_spec.rb +3 -3
- data/spec/integration/ip_messaging/v2/service/user/user_channel_spec.rb +3 -3
- data/spec/integration/ip_messaging/v2/service/user_spec.rb +5 -5
- data/spec/integration/ip_messaging/v2/service_spec.rb +5 -5
- data/spec/integration/monitor/v1/alert_spec.rb +8 -8
- data/spec/integration/sync/v1/service_spec.rb +4 -0
- data/spec/integration/wireless/v1/rate_plan_spec.rb +8 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85fe4385815510c6e6ef8d4d4697adfbac376a96141a5aa4610a8a6538aed999
|
4
|
+
data.tar.gz: da45f6917c09d04948ea1039b2ac5e0c36642f37a3446b6ec0c43d82d1939dad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5872e52b4c22b8ff5a0c22d39d0d3fce6f3ae19947437d4429a625c6b55669857522e66c50af3ceb5f93edfd34425877c4ee31ef3342e3f6e3dbf29a71d5f166
|
7
|
+
data.tar.gz: 1c7d0564ad462ba2f3406beb500afe0a31433996a57b73253cad9890ba539cfc50d177d75e9a999121d0b1bbad8587da8c1271899784b69ae086dc0b9d09338d
|
data/CHANGES.md
CHANGED
@@ -1,6 +1,32 @@
|
|
1
1
|
twilio-ruby changelog
|
2
2
|
=====================
|
3
3
|
|
4
|
+
[2019-08-21] Version 5.25.4
|
5
|
+
----------------------------
|
6
|
+
**Library**
|
7
|
+
- [PR #460](https://github.com/twilio/twilio-ruby/pull/460): Update the IP messaging domain name to be 'chat'. Thanks to [@childish-sambino](https://github.com/childish-sambino)!
|
8
|
+
- [PR #458](https://github.com/twilio/twilio-ruby/pull/458): Update TwiML docs for naming overrides. Thanks to [@childish-sambino](https://github.com/childish-sambino)!
|
9
|
+
|
10
|
+
**Conversations**
|
11
|
+
- Add Chat Conversation SID to conversation default output properties
|
12
|
+
|
13
|
+
**Flex**
|
14
|
+
- Adding `outbound_call_flows` object to Flex Configuration
|
15
|
+
- Adding read and fetch to channels API
|
16
|
+
|
17
|
+
**Supersim**
|
18
|
+
- Add Sims and Commands resources for the Super Sim Pilot
|
19
|
+
|
20
|
+
**Sync**
|
21
|
+
- Added configuration option for enabling webhooks from REST.
|
22
|
+
|
23
|
+
**Wireless**
|
24
|
+
- Added `usage_notification_method` and `usage_notification_url` properties to `rate_plan`.
|
25
|
+
|
26
|
+
**Twiml**
|
27
|
+
- Add support for `ach-debit` transactions in `Pay` verb
|
28
|
+
|
29
|
+
|
4
30
|
[2019-08-05] Version 5.25.3
|
5
31
|
----------------------------
|
6
32
|
**Preview**
|
data/README.md
CHANGED
@@ -26,13 +26,13 @@ in-line code documentation here in the library.
|
|
26
26
|
To install using [Bundler][bundler] grab the latest stable version:
|
27
27
|
|
28
28
|
```ruby
|
29
|
-
gem 'twilio-ruby', '~> 5.25.
|
29
|
+
gem 'twilio-ruby', '~> 5.25.4'
|
30
30
|
```
|
31
31
|
|
32
32
|
To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:
|
33
33
|
|
34
34
|
```bash
|
35
|
-
gem install twilio-ruby -v 5.25.
|
35
|
+
gem install twilio-ruby -v 5.25.4
|
36
36
|
```
|
37
37
|
|
38
38
|
To build and install the development branch yourself from the latest source:
|
@@ -72,11 +72,6 @@ module Twilio
|
|
72
72
|
# @param [Boolean] force_delivery Reserved
|
73
73
|
# @param [Boolean] smart_encoded Whether to detect Unicode characters that have a
|
74
74
|
# similar GSM-7 character and replace them. Can be: `true` or `false`.
|
75
|
-
# @param [String] interactive_data A JSON string that represents an interactive
|
76
|
-
# message. An interactive message is a category of messages that includes a list
|
77
|
-
# picker, a time picker, and an Apple Pay request.
|
78
|
-
# @param [Boolean] force_opt_in Whether to forcefully whitelist a from:to pair.
|
79
|
-
# Can be: `true` or `false`.
|
80
75
|
# @param [String] from A Twilio phone number in
|
81
76
|
# [E.164](https://www.twilio.com/docs/glossary/what-e164) format, an [alphanumeric
|
82
77
|
# sender
|
@@ -100,7 +95,7 @@ module Twilio
|
|
100
95
|
# can include up to 10 `media_url` parameters per message. You can send images in
|
101
96
|
# an SMS message in only the US and Canada.
|
102
97
|
# @return [MessageInstance] Newly created MessageInstance
|
103
|
-
def create(to: nil, status_callback: :unset, application_sid: :unset, max_price: :unset, provide_feedback: :unset, validity_period: :unset, force_delivery: :unset, smart_encoded: :unset,
|
98
|
+
def create(to: nil, status_callback: :unset, application_sid: :unset, max_price: :unset, provide_feedback: :unset, validity_period: :unset, force_delivery: :unset, smart_encoded: :unset, from: :unset, messaging_service_sid: :unset, body: :unset, media_url: :unset)
|
104
99
|
data = Twilio::Values.of({
|
105
100
|
'To' => to,
|
106
101
|
'From' => from,
|
@@ -114,8 +109,6 @@ module Twilio
|
|
114
109
|
'ValidityPeriod' => validity_period,
|
115
110
|
'ForceDelivery' => force_delivery,
|
116
111
|
'SmartEncoded' => smart_encoded,
|
117
|
-
'InteractiveData' => interactive_data,
|
118
|
-
'ForceOptIn' => force_opt_in,
|
119
112
|
})
|
120
113
|
|
121
114
|
payload = @version.create(
|
@@ -37,7 +37,7 @@ module Twilio
|
|
37
37
|
# Unlike stream(), this operation is eager and will load `limit` records into
|
38
38
|
# memory before returning.
|
39
39
|
# @param [String] language The [ISO
|
40
|
-
# language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US
|
40
|
+
# language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US`
|
41
41
|
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
42
42
|
# guarantees to never return more than limit. Default is no limit
|
43
43
|
# @param [Integer] page_size Number of records to fetch per request, when
|
@@ -54,7 +54,7 @@ module Twilio
|
|
54
54
|
# This operation lazily loads records as efficiently as possible until the limit
|
55
55
|
# is reached.
|
56
56
|
# @param [String] language The [ISO
|
57
|
-
# language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US
|
57
|
+
# language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US`
|
58
58
|
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
59
59
|
# guarantees to never return more than limit. Default is no limit.
|
60
60
|
# @param [Integer] page_size Number of records to fetch per request, when
|
@@ -88,7 +88,7 @@ module Twilio
|
|
88
88
|
# Retrieve a single page of FieldValueInstance records from the API.
|
89
89
|
# Request is executed immediately.
|
90
90
|
# @param [String] language The [ISO
|
91
|
-
# language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US
|
91
|
+
# language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US`
|
92
92
|
# @param [String] page_token PageToken provided by the API
|
93
93
|
# @param [Integer] page_number Page Number, this value is simply for client state
|
94
94
|
# @param [Integer] page_size Number of records to return, defaults to 50
|
@@ -125,7 +125,7 @@ module Twilio
|
|
125
125
|
# Retrieve a single page of FieldValueInstance records from the API.
|
126
126
|
# Request is executed immediately.
|
127
127
|
# @param [String] language The [ISO
|
128
|
-
# language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US
|
128
|
+
# language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US`
|
129
129
|
# @param [String] value The Field Value data.
|
130
130
|
# @param [String] synonym_of The string value that indicates which word the field
|
131
131
|
# value is a synonym of.
|
@@ -36,6 +36,22 @@ module Twilio
|
|
36
36
|
self.v1.flex_flow(sid)
|
37
37
|
end
|
38
38
|
|
39
|
+
##
|
40
|
+
# @param [String] sid The unique SID identifier of the Flex Chat Channel
|
41
|
+
# @return [Twilio::REST::Flex_api::V1::ChannelInstance] if sid was passed.
|
42
|
+
# @return [Twilio::REST::Flex_api::V1::ChannelList]
|
43
|
+
def channel(sid=:unset)
|
44
|
+
self.v1.channel(sid)
|
45
|
+
end
|
46
|
+
|
47
|
+
##
|
48
|
+
# @param [String] sid The unique SID identifier of the Flex Chat Channel
|
49
|
+
# @return [Twilio::REST::Flex_api::V1::WebChannelInstance] if sid was passed.
|
50
|
+
# @return [Twilio::REST::Flex_api::V1::WebChannelList]
|
51
|
+
def web_channel(sid=:unset)
|
52
|
+
self.v1.web_channel(sid)
|
53
|
+
end
|
54
|
+
|
39
55
|
##
|
40
56
|
# @return [Twilio::REST::Flex_api::V1::ConfigurationInstance]
|
41
57
|
def configuration
|
@@ -16,6 +16,8 @@ module Twilio
|
|
16
16
|
super
|
17
17
|
@version = 'v1'
|
18
18
|
@flex_flow = nil
|
19
|
+
@channel = nil
|
20
|
+
@web_channel = nil
|
19
21
|
@configuration = nil
|
20
22
|
end
|
21
23
|
|
@@ -33,6 +35,34 @@ module Twilio
|
|
33
35
|
end
|
34
36
|
end
|
35
37
|
|
38
|
+
##
|
39
|
+
# @param [String] sid The unique SID identifier of the Flex Chat Channel
|
40
|
+
# @return [Twilio::REST::Flex_api::V1::ChannelContext] if sid was passed.
|
41
|
+
# @return [Twilio::REST::Flex_api::V1::ChannelList]
|
42
|
+
def channel(sid=:unset)
|
43
|
+
if sid.nil?
|
44
|
+
raise ArgumentError, 'sid cannot be nil'
|
45
|
+
elsif sid == :unset
|
46
|
+
@channel ||= ChannelList.new self
|
47
|
+
else
|
48
|
+
ChannelContext.new(self, sid)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
##
|
53
|
+
# @param [String] sid The unique SID identifier of the Flex Chat Channel
|
54
|
+
# @return [Twilio::REST::Flex_api::V1::WebChannelContext] if sid was passed.
|
55
|
+
# @return [Twilio::REST::Flex_api::V1::WebChannelList]
|
56
|
+
def web_channel(sid=:unset)
|
57
|
+
if sid.nil?
|
58
|
+
raise ArgumentError, 'sid cannot be nil'
|
59
|
+
elsif sid == :unset
|
60
|
+
@web_channel ||= WebChannelList.new self
|
61
|
+
else
|
62
|
+
WebChannelContext.new(self, sid)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
36
66
|
##
|
37
67
|
# @return [Twilio::REST::Flex_api::V1::ConfigurationContext]
|
38
68
|
def configuration
|
@@ -0,0 +1,352 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
#
|
7
|
+
# frozen_string_literal: true
|
8
|
+
|
9
|
+
module Twilio
|
10
|
+
module REST
|
11
|
+
class FlexApi < Domain
|
12
|
+
class V1 < Version
|
13
|
+
class ChannelList < ListResource
|
14
|
+
##
|
15
|
+
# Initialize the ChannelList
|
16
|
+
# @param [Version] version Version that contains the resource
|
17
|
+
# @return [ChannelList] ChannelList
|
18
|
+
def initialize(version)
|
19
|
+
super(version)
|
20
|
+
|
21
|
+
# Path Solution
|
22
|
+
@solution = {}
|
23
|
+
@uri = "/Channels"
|
24
|
+
end
|
25
|
+
|
26
|
+
##
|
27
|
+
# Lists ChannelInstance records from the API as a list.
|
28
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
29
|
+
# memory before returning.
|
30
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
31
|
+
# guarantees to never return more than limit. Default is no limit
|
32
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
33
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
34
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
35
|
+
# efficient page size, i.e. min(limit, 1000)
|
36
|
+
# @return [Array] Array of up to limit results
|
37
|
+
def list(limit: nil, page_size: nil)
|
38
|
+
self.stream(limit: limit, page_size: page_size).entries
|
39
|
+
end
|
40
|
+
|
41
|
+
##
|
42
|
+
# Streams ChannelInstance records from the API as an Enumerable.
|
43
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
44
|
+
# is reached.
|
45
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
46
|
+
# guarantees to never return more than limit. Default is no limit.
|
47
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
48
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
49
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
50
|
+
# efficient page size, i.e. min(limit, 1000)
|
51
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
52
|
+
def stream(limit: nil, page_size: nil)
|
53
|
+
limits = @version.read_limits(limit, page_size)
|
54
|
+
|
55
|
+
page = self.page(page_size: limits[:page_size], )
|
56
|
+
|
57
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
58
|
+
end
|
59
|
+
|
60
|
+
##
|
61
|
+
# When passed a block, yields ChannelInstance records from the API.
|
62
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
63
|
+
# is reached.
|
64
|
+
def each
|
65
|
+
limits = @version.read_limits
|
66
|
+
|
67
|
+
page = self.page(page_size: limits[:page_size], )
|
68
|
+
|
69
|
+
@version.stream(page,
|
70
|
+
limit: limits[:limit],
|
71
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
72
|
+
end
|
73
|
+
|
74
|
+
##
|
75
|
+
# Retrieve a single page of ChannelInstance records from the API.
|
76
|
+
# Request is executed immediately.
|
77
|
+
# @param [String] page_token PageToken provided by the API
|
78
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
79
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
80
|
+
# @return [Page] Page of ChannelInstance
|
81
|
+
def page(page_token: :unset, page_number: :unset, page_size: :unset)
|
82
|
+
params = Twilio::Values.of({
|
83
|
+
'PageToken' => page_token,
|
84
|
+
'Page' => page_number,
|
85
|
+
'PageSize' => page_size,
|
86
|
+
})
|
87
|
+
response = @version.page(
|
88
|
+
'GET',
|
89
|
+
@uri,
|
90
|
+
params
|
91
|
+
)
|
92
|
+
ChannelPage.new(@version, response, @solution)
|
93
|
+
end
|
94
|
+
|
95
|
+
##
|
96
|
+
# Retrieve a single page of ChannelInstance records from the API.
|
97
|
+
# Request is executed immediately.
|
98
|
+
# @param [String] target_url API-generated URL for the requested results page
|
99
|
+
# @return [Page] Page of ChannelInstance
|
100
|
+
def get_page(target_url)
|
101
|
+
response = @version.domain.request(
|
102
|
+
'GET',
|
103
|
+
target_url
|
104
|
+
)
|
105
|
+
ChannelPage.new(@version, response, @solution)
|
106
|
+
end
|
107
|
+
|
108
|
+
##
|
109
|
+
# Retrieve a single page of ChannelInstance records from the API.
|
110
|
+
# Request is executed immediately.
|
111
|
+
# @param [String] flex_flow_sid The unique ID of the FlexFlow
|
112
|
+
# @param [String] identity Chat User identity
|
113
|
+
# @param [String] chat_user_friendly_name Customer friendly name (chat
|
114
|
+
# participant)
|
115
|
+
# @param [String] chat_friendly_name Chat channel friendly name
|
116
|
+
# @param [String] target Target Contact Identity, for example phone number for SMS
|
117
|
+
# @param [String] chat_unique_name Chat channel unique name
|
118
|
+
# @param [String] pre_engagement_data Pre-engagement data
|
119
|
+
# @param [String] task_sid The unique SID identifier of the Taskrouter task
|
120
|
+
# @param [String] task_attributes Task attributes to be added for the TaskRouter
|
121
|
+
# Task
|
122
|
+
# @param [Boolean] long_lived Boolean flag determining whether channel is created
|
123
|
+
# as long lived or not
|
124
|
+
# @return [ChannelInstance] Newly created ChannelInstance
|
125
|
+
def create(flex_flow_sid: nil, identity: nil, chat_user_friendly_name: nil, chat_friendly_name: nil, target: :unset, chat_unique_name: :unset, pre_engagement_data: :unset, task_sid: :unset, task_attributes: :unset, long_lived: :unset)
|
126
|
+
data = Twilio::Values.of({
|
127
|
+
'FlexFlowSid' => flex_flow_sid,
|
128
|
+
'Identity' => identity,
|
129
|
+
'ChatUserFriendlyName' => chat_user_friendly_name,
|
130
|
+
'ChatFriendlyName' => chat_friendly_name,
|
131
|
+
'Target' => target,
|
132
|
+
'ChatUniqueName' => chat_unique_name,
|
133
|
+
'PreEngagementData' => pre_engagement_data,
|
134
|
+
'TaskSid' => task_sid,
|
135
|
+
'TaskAttributes' => task_attributes,
|
136
|
+
'LongLived' => long_lived,
|
137
|
+
})
|
138
|
+
|
139
|
+
payload = @version.create(
|
140
|
+
'POST',
|
141
|
+
@uri,
|
142
|
+
data: data
|
143
|
+
)
|
144
|
+
|
145
|
+
ChannelInstance.new(@version, payload, )
|
146
|
+
end
|
147
|
+
|
148
|
+
##
|
149
|
+
# Provide a user friendly representation
|
150
|
+
def to_s
|
151
|
+
'#<Twilio.FlexApi.V1.ChannelList>'
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
class ChannelPage < Page
|
156
|
+
##
|
157
|
+
# Initialize the ChannelPage
|
158
|
+
# @param [Version] version Version that contains the resource
|
159
|
+
# @param [Response] response Response from the API
|
160
|
+
# @param [Hash] solution Path solution for the resource
|
161
|
+
# @return [ChannelPage] ChannelPage
|
162
|
+
def initialize(version, response, solution)
|
163
|
+
super(version, response)
|
164
|
+
|
165
|
+
# Path Solution
|
166
|
+
@solution = solution
|
167
|
+
end
|
168
|
+
|
169
|
+
##
|
170
|
+
# Build an instance of ChannelInstance
|
171
|
+
# @param [Hash] payload Payload response from the API
|
172
|
+
# @return [ChannelInstance] ChannelInstance
|
173
|
+
def get_instance(payload)
|
174
|
+
ChannelInstance.new(@version, payload, )
|
175
|
+
end
|
176
|
+
|
177
|
+
##
|
178
|
+
# Provide a user friendly representation
|
179
|
+
def to_s
|
180
|
+
'<Twilio.FlexApi.V1.ChannelPage>'
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
class ChannelContext < InstanceContext
|
185
|
+
##
|
186
|
+
# Initialize the ChannelContext
|
187
|
+
# @param [Version] version Version that contains the resource
|
188
|
+
# @param [String] sid The unique SID identifier of the Flex Chat Channel
|
189
|
+
# @return [ChannelContext] ChannelContext
|
190
|
+
def initialize(version, sid)
|
191
|
+
super(version)
|
192
|
+
|
193
|
+
# Path Solution
|
194
|
+
@solution = {sid: sid, }
|
195
|
+
@uri = "/Channels/#{@solution[:sid]}"
|
196
|
+
end
|
197
|
+
|
198
|
+
##
|
199
|
+
# Fetch a ChannelInstance
|
200
|
+
# @return [ChannelInstance] Fetched ChannelInstance
|
201
|
+
def fetch
|
202
|
+
params = Twilio::Values.of({})
|
203
|
+
|
204
|
+
payload = @version.fetch(
|
205
|
+
'GET',
|
206
|
+
@uri,
|
207
|
+
params,
|
208
|
+
)
|
209
|
+
|
210
|
+
ChannelInstance.new(@version, payload, sid: @solution[:sid], )
|
211
|
+
end
|
212
|
+
|
213
|
+
##
|
214
|
+
# Deletes the ChannelInstance
|
215
|
+
# @return [Boolean] true if delete succeeds, true otherwise
|
216
|
+
def delete
|
217
|
+
@version.delete('delete', @uri)
|
218
|
+
end
|
219
|
+
|
220
|
+
##
|
221
|
+
# Provide a user friendly representation
|
222
|
+
def to_s
|
223
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
224
|
+
"#<Twilio.FlexApi.V1.ChannelContext #{context}>"
|
225
|
+
end
|
226
|
+
|
227
|
+
##
|
228
|
+
# Provide a detailed, user friendly representation
|
229
|
+
def inspect
|
230
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
231
|
+
"#<Twilio.FlexApi.V1.ChannelContext #{context}>"
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
class ChannelInstance < InstanceResource
|
236
|
+
##
|
237
|
+
# Initialize the ChannelInstance
|
238
|
+
# @param [Version] version Version that contains the resource
|
239
|
+
# @param [Hash] payload payload that contains response from Twilio
|
240
|
+
# @param [String] sid The unique SID identifier of the Flex Chat Channel
|
241
|
+
# @return [ChannelInstance] ChannelInstance
|
242
|
+
def initialize(version, payload, sid: nil)
|
243
|
+
super(version)
|
244
|
+
|
245
|
+
# Marshaled Properties
|
246
|
+
@properties = {
|
247
|
+
'account_sid' => payload['account_sid'],
|
248
|
+
'flex_flow_sid' => payload['flex_flow_sid'],
|
249
|
+
'sid' => payload['sid'],
|
250
|
+
'user_sid' => payload['user_sid'],
|
251
|
+
'task_sid' => payload['task_sid'],
|
252
|
+
'url' => payload['url'],
|
253
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
254
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
255
|
+
}
|
256
|
+
|
257
|
+
# Context
|
258
|
+
@instance_context = nil
|
259
|
+
@params = {'sid' => sid || @properties['sid'], }
|
260
|
+
end
|
261
|
+
|
262
|
+
##
|
263
|
+
# Generate an instance context for the instance, the context is capable of
|
264
|
+
# performing various actions. All instance actions are proxied to the context
|
265
|
+
# @return [ChannelContext] ChannelContext for this ChannelInstance
|
266
|
+
def context
|
267
|
+
unless @instance_context
|
268
|
+
@instance_context = ChannelContext.new(@version, @params['sid'], )
|
269
|
+
end
|
270
|
+
@instance_context
|
271
|
+
end
|
272
|
+
|
273
|
+
##
|
274
|
+
# @return [String] The ID of the account that owns this Workflow
|
275
|
+
def account_sid
|
276
|
+
@properties['account_sid']
|
277
|
+
end
|
278
|
+
|
279
|
+
##
|
280
|
+
# @return [String] The unique ID of the FlexFlow
|
281
|
+
def flex_flow_sid
|
282
|
+
@properties['flex_flow_sid']
|
283
|
+
end
|
284
|
+
|
285
|
+
##
|
286
|
+
# @return [String] Flex Chat Channel Sid
|
287
|
+
def sid
|
288
|
+
@properties['sid']
|
289
|
+
end
|
290
|
+
|
291
|
+
##
|
292
|
+
# @return [String] Chat User Sid.
|
293
|
+
def user_sid
|
294
|
+
@properties['user_sid']
|
295
|
+
end
|
296
|
+
|
297
|
+
##
|
298
|
+
# @return [String] TaskRouter Task Sid.
|
299
|
+
def task_sid
|
300
|
+
@properties['task_sid']
|
301
|
+
end
|
302
|
+
|
303
|
+
##
|
304
|
+
# @return [String] The url
|
305
|
+
def url
|
306
|
+
@properties['url']
|
307
|
+
end
|
308
|
+
|
309
|
+
##
|
310
|
+
# @return [Time] The time the Flex Chat Channel was created, given as GMT in ISO 8601 format.
|
311
|
+
def date_created
|
312
|
+
@properties['date_created']
|
313
|
+
end
|
314
|
+
|
315
|
+
##
|
316
|
+
# @return [Time] The time the Flex Chat Channel was last updated, given as GMT in ISO 8601 format.
|
317
|
+
def date_updated
|
318
|
+
@properties['date_updated']
|
319
|
+
end
|
320
|
+
|
321
|
+
##
|
322
|
+
# Fetch a ChannelInstance
|
323
|
+
# @return [ChannelInstance] Fetched ChannelInstance
|
324
|
+
def fetch
|
325
|
+
context.fetch
|
326
|
+
end
|
327
|
+
|
328
|
+
##
|
329
|
+
# Deletes the ChannelInstance
|
330
|
+
# @return [Boolean] true if delete succeeds, true otherwise
|
331
|
+
def delete
|
332
|
+
context.delete
|
333
|
+
end
|
334
|
+
|
335
|
+
##
|
336
|
+
# Provide a user friendly representation
|
337
|
+
def to_s
|
338
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
339
|
+
"<Twilio.FlexApi.V1.ChannelInstance #{values}>"
|
340
|
+
end
|
341
|
+
|
342
|
+
##
|
343
|
+
# Provide a detailed, user friendly representation
|
344
|
+
def inspect
|
345
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
346
|
+
"<Twilio.FlexApi.V1.ChannelInstance #{values}>"
|
347
|
+
end
|
348
|
+
end
|
349
|
+
end
|
350
|
+
end
|
351
|
+
end
|
352
|
+
end
|