twilio-ruby 5.73.2 → 5.73.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/pr-lint.yml +8 -2
- data/.github/workflows/test-and-deploy.yml +3 -3
- data/CHANGES.md +32 -0
- data/LICENSE +1 -1
- data/README.md +2 -2
- data/lib/twilio-ruby/rest/client.rb +7 -0
- data/lib/twilio-ruby/rest/content/v1/content/approval_fetch.rb +195 -0
- data/lib/twilio-ruby/rest/content/v1/content.rb +346 -0
- data/lib/twilio-ruby/rest/content/v1.rb +45 -0
- data/lib/twilio-ruby/rest/content.rb +47 -0
- data/lib/twilio-ruby/rest/flex_api/v1/assessments.rb +156 -0
- data/lib/twilio-ruby/rest/flex_api/v1/good_data.rb +7 -0
- data/lib/twilio-ruby/rest/flex_api/v1.rb +7 -0
- data/lib/twilio-ruby/rest/flex_api.rb +6 -0
- data/lib/twilio-ruby/rest/insights/v1/call/summary.rb +7 -0
- data/lib/twilio-ruby/rest/insights/v1/call_summaries.rb +7 -0
- data/lib/twilio-ruby/rest/lookups/v2/phone_number.rb +81 -6
- data/lib/twilio-ruby/rest/messaging/v1/domain_cert.rb +257 -0
- data/lib/twilio-ruby/rest/messaging/v1/domain_config.rb +267 -0
- data/lib/twilio-ruby/rest/messaging/v1.rb +34 -0
- data/lib/twilio-ruby/rest/messaging.rb +18 -0
- data/lib/twilio-ruby/rest/microvisor/v1/device.rb +7 -0
- data/lib/twilio-ruby/rest/preview.rb +0 -33
- data/lib/twilio-ruby/version.rb +1 -1
- metadata +9 -8
- data/lib/twilio-ruby/rest/preview/trusted_comms/branded_channel/channel.rb +0 -165
- data/lib/twilio-ruby/rest/preview/trusted_comms/branded_channel.rb +0 -225
- data/lib/twilio-ruby/rest/preview/trusted_comms/brands_information.rb +0 -195
- data/lib/twilio-ruby/rest/preview/trusted_comms/cps.rb +0 -186
- data/lib/twilio-ruby/rest/preview/trusted_comms/current_call.rb +0 -277
- data/lib/twilio-ruby/rest/preview/trusted_comms.rb +0 -65
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15ff230b629767522e9f5fc479d1f788dba0ad5e
|
4
|
+
data.tar.gz: 9aca0c5930e7f107750a17c671641ac1589409a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5159b77870cc207317bba46ada0891cf4a3829ba11b1395fe93ed1820f67c82e7bf42359e79f6282f87b8a6ce5318ac9df227abc8128107b855879f9705ca26f
|
7
|
+
data.tar.gz: 464f504b671e3e5232d7d20791438f0e9581bf38f541c8b0ad140f9460c19c1ba7c17540084fb16defe9ae3ed4430572740d96014337384d76a38cedf74d48bd
|
@@ -8,8 +8,14 @@ jobs:
|
|
8
8
|
name: Validate title
|
9
9
|
runs-on: ubuntu-latest
|
10
10
|
steps:
|
11
|
-
- uses: amannn/action-semantic-pull-request@
|
11
|
+
- uses: amannn/action-semantic-pull-request@v5
|
12
12
|
with:
|
13
|
-
types:
|
13
|
+
types: |
|
14
|
+
chore
|
15
|
+
docs
|
16
|
+
fix
|
17
|
+
feat
|
18
|
+
misc
|
19
|
+
test
|
14
20
|
env:
|
15
21
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
@@ -20,7 +20,7 @@ jobs:
|
|
20
20
|
ruby: [ '2.4', '2.5', '2.6', '2.7', '3.0', '3.1', 'ruby-head', 'jruby-9.2' ]
|
21
21
|
steps:
|
22
22
|
- name: Checkout twilio-ruby
|
23
|
-
uses: actions/checkout@
|
23
|
+
uses: actions/checkout@v3
|
24
24
|
with:
|
25
25
|
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
26
26
|
|
@@ -65,7 +65,7 @@ jobs:
|
|
65
65
|
runs-on: ubuntu-latest
|
66
66
|
steps:
|
67
67
|
- name: Checkout twilio-ruby
|
68
|
-
uses: actions/checkout@
|
68
|
+
uses: actions/checkout@v3
|
69
69
|
with:
|
70
70
|
fetch-depth: 0
|
71
71
|
|
@@ -78,7 +78,7 @@ jobs:
|
|
78
78
|
- run: bundle install
|
79
79
|
|
80
80
|
- name: Login to Docker Hub
|
81
|
-
uses: docker/login-action@
|
81
|
+
uses: docker/login-action@v2
|
82
82
|
with:
|
83
83
|
username: ${{ secrets.DOCKER_USERNAME }}
|
84
84
|
password: ${{ secrets.DOCKER_AUTH_TOKEN }}
|
data/CHANGES.md
CHANGED
@@ -1,6 +1,38 @@
|
|
1
1
|
twilio-ruby changelog
|
2
2
|
=====================
|
3
3
|
|
4
|
+
[2022-11-30] Version 5.73.4
|
5
|
+
---------------------------
|
6
|
+
**Flex**
|
7
|
+
- Adding new `assessments` api in version `v1`
|
8
|
+
|
9
|
+
**Lookups**
|
10
|
+
- Add `identity_match` package to the lookup response
|
11
|
+
|
12
|
+
**Messaging**
|
13
|
+
- Added `validated` parameter to Link Shortening API
|
14
|
+
|
15
|
+
**Serverless**
|
16
|
+
- Add node16 as a valid Build runtime
|
17
|
+
- Add ie1 and au1 as supported regions for all endpoints.
|
18
|
+
|
19
|
+
|
20
|
+
[2022-11-16] Version 5.73.3
|
21
|
+
---------------------------
|
22
|
+
**Library - Chore**
|
23
|
+
- [PR #621](https://github.com/twilio/twilio-ruby/pull/621): upgrade GitHub Actions dependencies. Thanks to [@childish-sambino](https://github.com/childish-sambino)!
|
24
|
+
|
25
|
+
**Api**
|
26
|
+
- Set the Content resource to have public visibility as Preview
|
27
|
+
|
28
|
+
**Flex**
|
29
|
+
- Adding new parameter `base_url` to 'gooddata' response in version `v1`
|
30
|
+
|
31
|
+
**Insights**
|
32
|
+
- Added `answered_by` field in List Call Summary
|
33
|
+
- Added `answered_by` field in call summary
|
34
|
+
|
35
|
+
|
4
36
|
[2022-11-10] Version 5.73.2
|
5
37
|
---------------------------
|
6
38
|
**Flex**
|
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
MIT License
|
2
2
|
|
3
|
-
Copyright (C)
|
3
|
+
Copyright (C) 2022, Twilio, Inc. <help@twilio.com>
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
6
|
this software and associated documentation files (the "Software"), to deal in
|
data/README.md
CHANGED
@@ -34,13 +34,13 @@ This library supports the following Ruby implementations:
|
|
34
34
|
To install using [Bundler][bundler] grab the latest stable version:
|
35
35
|
|
36
36
|
```ruby
|
37
|
-
gem 'twilio-ruby', '~> 5.73.
|
37
|
+
gem 'twilio-ruby', '~> 5.73.4'
|
38
38
|
```
|
39
39
|
|
40
40
|
To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:
|
41
41
|
|
42
42
|
```bash
|
43
|
-
gem install twilio-ruby -v 5.73.
|
43
|
+
gem install twilio-ruby -v 5.73.4
|
44
44
|
```
|
45
45
|
|
46
46
|
To build and install the development branch yourself from the latest source:
|
@@ -34,6 +34,7 @@ module Twilio
|
|
34
34
|
@api = nil
|
35
35
|
@autopilot = nil
|
36
36
|
@chat = nil
|
37
|
+
@content = nil
|
37
38
|
@conversations = nil
|
38
39
|
@events = nil
|
39
40
|
@flex_api = nil
|
@@ -188,6 +189,12 @@ module Twilio
|
|
188
189
|
@chat ||= Chat.new self
|
189
190
|
end
|
190
191
|
|
192
|
+
##
|
193
|
+
# Access the Content Twilio Domain
|
194
|
+
def content
|
195
|
+
@content ||= Content.new self
|
196
|
+
end
|
197
|
+
|
191
198
|
##
|
192
199
|
# Access the Conversations Twilio Domain
|
193
200
|
def conversations
|
@@ -0,0 +1,195 @@
|
|
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 Content < Domain
|
12
|
+
class V1 < Version
|
13
|
+
class ContentContext < InstanceContext
|
14
|
+
##
|
15
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
16
|
+
class ApprovalFetchList < ListResource
|
17
|
+
##
|
18
|
+
# Initialize the ApprovalFetchList
|
19
|
+
# @param [Version] version Version that contains the resource
|
20
|
+
# @param [String] sid The unique string that that we created to identify the
|
21
|
+
# Content resource.
|
22
|
+
# @return [ApprovalFetchList] ApprovalFetchList
|
23
|
+
def initialize(version, sid: nil)
|
24
|
+
super(version)
|
25
|
+
|
26
|
+
# Path Solution
|
27
|
+
@solution = {sid: sid}
|
28
|
+
end
|
29
|
+
|
30
|
+
##
|
31
|
+
# Provide a user friendly representation
|
32
|
+
def to_s
|
33
|
+
'#<Twilio.Content.V1.ApprovalFetchList>'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
##
|
38
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
39
|
+
class ApprovalFetchPage < Page
|
40
|
+
##
|
41
|
+
# Initialize the ApprovalFetchPage
|
42
|
+
# @param [Version] version Version that contains the resource
|
43
|
+
# @param [Response] response Response from the API
|
44
|
+
# @param [Hash] solution Path solution for the resource
|
45
|
+
# @return [ApprovalFetchPage] ApprovalFetchPage
|
46
|
+
def initialize(version, response, solution)
|
47
|
+
super(version, response)
|
48
|
+
|
49
|
+
# Path Solution
|
50
|
+
@solution = solution
|
51
|
+
end
|
52
|
+
|
53
|
+
##
|
54
|
+
# Build an instance of ApprovalFetchInstance
|
55
|
+
# @param [Hash] payload Payload response from the API
|
56
|
+
# @return [ApprovalFetchInstance] ApprovalFetchInstance
|
57
|
+
def get_instance(payload)
|
58
|
+
ApprovalFetchInstance.new(@version, payload, sid: @solution[:sid], )
|
59
|
+
end
|
60
|
+
|
61
|
+
##
|
62
|
+
# Provide a user friendly representation
|
63
|
+
def to_s
|
64
|
+
'<Twilio.Content.V1.ApprovalFetchPage>'
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
##
|
69
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
70
|
+
class ApprovalFetchContext < InstanceContext
|
71
|
+
##
|
72
|
+
# Initialize the ApprovalFetchContext
|
73
|
+
# @param [Version] version Version that contains the resource
|
74
|
+
# @param [String] sid The Twilio-provided string that uniquely identifies the
|
75
|
+
# Content resource whose approval information to fetch.
|
76
|
+
# @return [ApprovalFetchContext] ApprovalFetchContext
|
77
|
+
def initialize(version, sid)
|
78
|
+
super(version)
|
79
|
+
|
80
|
+
# Path Solution
|
81
|
+
@solution = {sid: sid, }
|
82
|
+
@uri = "/Content/#{@solution[:sid]}/ApprovalRequests"
|
83
|
+
end
|
84
|
+
|
85
|
+
##
|
86
|
+
# Fetch the ApprovalFetchInstance
|
87
|
+
# @return [ApprovalFetchInstance] Fetched ApprovalFetchInstance
|
88
|
+
def fetch
|
89
|
+
payload = @version.fetch('GET', @uri)
|
90
|
+
|
91
|
+
ApprovalFetchInstance.new(@version, payload, sid: @solution[:sid], )
|
92
|
+
end
|
93
|
+
|
94
|
+
##
|
95
|
+
# Provide a user friendly representation
|
96
|
+
def to_s
|
97
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
98
|
+
"#<Twilio.Content.V1.ApprovalFetchContext #{context}>"
|
99
|
+
end
|
100
|
+
|
101
|
+
##
|
102
|
+
# Provide a detailed, user friendly representation
|
103
|
+
def inspect
|
104
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
105
|
+
"#<Twilio.Content.V1.ApprovalFetchContext #{context}>"
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
##
|
110
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
111
|
+
class ApprovalFetchInstance < InstanceResource
|
112
|
+
##
|
113
|
+
# Initialize the ApprovalFetchInstance
|
114
|
+
# @param [Version] version Version that contains the resource
|
115
|
+
# @param [Hash] payload payload that contains response from Twilio
|
116
|
+
# @param [String] sid The unique string that that we created to identify the
|
117
|
+
# Content resource.
|
118
|
+
# @return [ApprovalFetchInstance] ApprovalFetchInstance
|
119
|
+
def initialize(version, payload, sid: nil)
|
120
|
+
super(version)
|
121
|
+
|
122
|
+
# Marshaled Properties
|
123
|
+
@properties = {
|
124
|
+
'sid' => payload['sid'],
|
125
|
+
'account_sid' => payload['account_sid'],
|
126
|
+
'whatsapp' => payload['whatsapp'],
|
127
|
+
'url' => payload['url'],
|
128
|
+
}
|
129
|
+
|
130
|
+
# Context
|
131
|
+
@instance_context = nil
|
132
|
+
@params = {'sid' => sid, }
|
133
|
+
end
|
134
|
+
|
135
|
+
##
|
136
|
+
# Generate an instance context for the instance, the context is capable of
|
137
|
+
# performing various actions. All instance actions are proxied to the context
|
138
|
+
# @return [ApprovalFetchContext] ApprovalFetchContext for this ApprovalFetchInstance
|
139
|
+
def context
|
140
|
+
unless @instance_context
|
141
|
+
@instance_context = ApprovalFetchContext.new(@version, @params['sid'], )
|
142
|
+
end
|
143
|
+
@instance_context
|
144
|
+
end
|
145
|
+
|
146
|
+
##
|
147
|
+
# @return [String] The unique string that identifies the Content resource
|
148
|
+
def sid
|
149
|
+
@properties['sid']
|
150
|
+
end
|
151
|
+
|
152
|
+
##
|
153
|
+
# @return [String] The SID of the Account that created the Content resource
|
154
|
+
def account_sid
|
155
|
+
@properties['account_sid']
|
156
|
+
end
|
157
|
+
|
158
|
+
##
|
159
|
+
# @return [Hash] Contains the whatsapp approval information for the Content resource
|
160
|
+
def whatsapp
|
161
|
+
@properties['whatsapp']
|
162
|
+
end
|
163
|
+
|
164
|
+
##
|
165
|
+
# @return [String] The URL of the resource, relative to `https://content.twilio.com`
|
166
|
+
def url
|
167
|
+
@properties['url']
|
168
|
+
end
|
169
|
+
|
170
|
+
##
|
171
|
+
# Fetch the ApprovalFetchInstance
|
172
|
+
# @return [ApprovalFetchInstance] Fetched ApprovalFetchInstance
|
173
|
+
def fetch
|
174
|
+
context.fetch
|
175
|
+
end
|
176
|
+
|
177
|
+
##
|
178
|
+
# Provide a user friendly representation
|
179
|
+
def to_s
|
180
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
181
|
+
"<Twilio.Content.V1.ApprovalFetchInstance #{values}>"
|
182
|
+
end
|
183
|
+
|
184
|
+
##
|
185
|
+
# Provide a detailed, user friendly representation
|
186
|
+
def inspect
|
187
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
188
|
+
"<Twilio.Content.V1.ApprovalFetchInstance #{values}>"
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
@@ -0,0 +1,346 @@
|
|
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 Content < Domain
|
12
|
+
class V1 < Version
|
13
|
+
##
|
14
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
15
|
+
class ContentList < ListResource
|
16
|
+
##
|
17
|
+
# Initialize the ContentList
|
18
|
+
# @param [Version] version Version that contains the resource
|
19
|
+
# @return [ContentList] ContentList
|
20
|
+
def initialize(version)
|
21
|
+
super(version)
|
22
|
+
|
23
|
+
# Path Solution
|
24
|
+
@solution = {}
|
25
|
+
@uri = "/Content"
|
26
|
+
end
|
27
|
+
|
28
|
+
##
|
29
|
+
# Lists ContentInstance records from the API as a list.
|
30
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
31
|
+
# memory before returning.
|
32
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
33
|
+
# guarantees to never return more than limit. Default is no limit
|
34
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
35
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
36
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
37
|
+
# efficient page size, i.e. min(limit, 1000)
|
38
|
+
# @return [Array] Array of up to limit results
|
39
|
+
def list(limit: nil, page_size: nil)
|
40
|
+
self.stream(limit: limit, page_size: page_size).entries
|
41
|
+
end
|
42
|
+
|
43
|
+
##
|
44
|
+
# Streams ContentInstance records from the API as an Enumerable.
|
45
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
46
|
+
# is reached.
|
47
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
48
|
+
# guarantees to never return more than limit. Default is no limit.
|
49
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
50
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
51
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
52
|
+
# efficient page size, i.e. min(limit, 1000)
|
53
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
54
|
+
def stream(limit: nil, page_size: nil)
|
55
|
+
limits = @version.read_limits(limit, page_size)
|
56
|
+
|
57
|
+
page = self.page(page_size: limits[:page_size], )
|
58
|
+
|
59
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
60
|
+
end
|
61
|
+
|
62
|
+
##
|
63
|
+
# When passed a block, yields ContentInstance records from the API.
|
64
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
65
|
+
# is reached.
|
66
|
+
def each
|
67
|
+
limits = @version.read_limits
|
68
|
+
|
69
|
+
page = self.page(page_size: limits[:page_size], )
|
70
|
+
|
71
|
+
@version.stream(page,
|
72
|
+
limit: limits[:limit],
|
73
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
74
|
+
end
|
75
|
+
|
76
|
+
##
|
77
|
+
# Retrieve a single page of ContentInstance records from the API.
|
78
|
+
# Request is executed immediately.
|
79
|
+
# @param [String] page_token PageToken provided by the API
|
80
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
81
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
82
|
+
# @return [Page] Page of ContentInstance
|
83
|
+
def page(page_token: :unset, page_number: :unset, page_size: :unset)
|
84
|
+
params = Twilio::Values.of({
|
85
|
+
'PageToken' => page_token,
|
86
|
+
'Page' => page_number,
|
87
|
+
'PageSize' => page_size,
|
88
|
+
})
|
89
|
+
|
90
|
+
response = @version.page('GET', @uri, params: params)
|
91
|
+
|
92
|
+
ContentPage.new(@version, response, @solution)
|
93
|
+
end
|
94
|
+
|
95
|
+
##
|
96
|
+
# Retrieve a single page of ContentInstance 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 ContentInstance
|
100
|
+
def get_page(target_url)
|
101
|
+
response = @version.domain.request(
|
102
|
+
'GET',
|
103
|
+
target_url
|
104
|
+
)
|
105
|
+
ContentPage.new(@version, response, @solution)
|
106
|
+
end
|
107
|
+
|
108
|
+
##
|
109
|
+
# Provide a user friendly representation
|
110
|
+
def to_s
|
111
|
+
'#<Twilio.Content.V1.ContentList>'
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
##
|
116
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
117
|
+
class ContentPage < Page
|
118
|
+
##
|
119
|
+
# Initialize the ContentPage
|
120
|
+
# @param [Version] version Version that contains the resource
|
121
|
+
# @param [Response] response Response from the API
|
122
|
+
# @param [Hash] solution Path solution for the resource
|
123
|
+
# @return [ContentPage] ContentPage
|
124
|
+
def initialize(version, response, solution)
|
125
|
+
super(version, response)
|
126
|
+
|
127
|
+
# Path Solution
|
128
|
+
@solution = solution
|
129
|
+
end
|
130
|
+
|
131
|
+
##
|
132
|
+
# Build an instance of ContentInstance
|
133
|
+
# @param [Hash] payload Payload response from the API
|
134
|
+
# @return [ContentInstance] ContentInstance
|
135
|
+
def get_instance(payload)
|
136
|
+
ContentInstance.new(@version, payload, )
|
137
|
+
end
|
138
|
+
|
139
|
+
##
|
140
|
+
# Provide a user friendly representation
|
141
|
+
def to_s
|
142
|
+
'<Twilio.Content.V1.ContentPage>'
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
##
|
147
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
148
|
+
class ContentContext < InstanceContext
|
149
|
+
##
|
150
|
+
# Initialize the ContentContext
|
151
|
+
# @param [Version] version Version that contains the resource
|
152
|
+
# @param [String] sid The Twilio-provided string that uniquely identifies the
|
153
|
+
# Content resource to fetch.
|
154
|
+
# @return [ContentContext] ContentContext
|
155
|
+
def initialize(version, sid)
|
156
|
+
super(version)
|
157
|
+
|
158
|
+
# Path Solution
|
159
|
+
@solution = {sid: sid, }
|
160
|
+
@uri = "/Content/#{@solution[:sid]}"
|
161
|
+
|
162
|
+
# Dependents
|
163
|
+
@approval_fetch = nil
|
164
|
+
end
|
165
|
+
|
166
|
+
##
|
167
|
+
# Fetch the ContentInstance
|
168
|
+
# @return [ContentInstance] Fetched ContentInstance
|
169
|
+
def fetch
|
170
|
+
payload = @version.fetch('GET', @uri)
|
171
|
+
|
172
|
+
ContentInstance.new(@version, payload, sid: @solution[:sid], )
|
173
|
+
end
|
174
|
+
|
175
|
+
##
|
176
|
+
# Delete the ContentInstance
|
177
|
+
# @return [Boolean] true if delete succeeds, false otherwise
|
178
|
+
def delete
|
179
|
+
@version.delete('DELETE', @uri)
|
180
|
+
end
|
181
|
+
|
182
|
+
##
|
183
|
+
# Access the approval_fetch
|
184
|
+
# @return [ApprovalFetchList]
|
185
|
+
# @return [ApprovalFetchContext]
|
186
|
+
def approval_fetch
|
187
|
+
ApprovalFetchContext.new(@version, @solution[:sid], )
|
188
|
+
end
|
189
|
+
|
190
|
+
##
|
191
|
+
# Provide a user friendly representation
|
192
|
+
def to_s
|
193
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
194
|
+
"#<Twilio.Content.V1.ContentContext #{context}>"
|
195
|
+
end
|
196
|
+
|
197
|
+
##
|
198
|
+
# Provide a detailed, user friendly representation
|
199
|
+
def inspect
|
200
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
201
|
+
"#<Twilio.Content.V1.ContentContext #{context}>"
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
##
|
206
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
207
|
+
class ContentInstance < InstanceResource
|
208
|
+
##
|
209
|
+
# Initialize the ContentInstance
|
210
|
+
# @param [Version] version Version that contains the resource
|
211
|
+
# @param [Hash] payload payload that contains response from Twilio
|
212
|
+
# @param [String] sid The Twilio-provided string that uniquely identifies the
|
213
|
+
# Content resource to fetch.
|
214
|
+
# @return [ContentInstance] ContentInstance
|
215
|
+
def initialize(version, payload, sid: nil)
|
216
|
+
super(version)
|
217
|
+
|
218
|
+
# Marshaled Properties
|
219
|
+
@properties = {
|
220
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
221
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
222
|
+
'sid' => payload['sid'],
|
223
|
+
'account_sid' => payload['account_sid'],
|
224
|
+
'friendly_name' => payload['friendly_name'],
|
225
|
+
'language' => payload['language'],
|
226
|
+
'variables' => payload['variables'],
|
227
|
+
'types' => payload['types'],
|
228
|
+
'url' => payload['url'],
|
229
|
+
'links' => payload['links'],
|
230
|
+
}
|
231
|
+
|
232
|
+
# Context
|
233
|
+
@instance_context = nil
|
234
|
+
@params = {'sid' => sid || @properties['sid'], }
|
235
|
+
end
|
236
|
+
|
237
|
+
##
|
238
|
+
# Generate an instance context for the instance, the context is capable of
|
239
|
+
# performing various actions. All instance actions are proxied to the context
|
240
|
+
# @return [ContentContext] ContentContext for this ContentInstance
|
241
|
+
def context
|
242
|
+
unless @instance_context
|
243
|
+
@instance_context = ContentContext.new(@version, @params['sid'], )
|
244
|
+
end
|
245
|
+
@instance_context
|
246
|
+
end
|
247
|
+
|
248
|
+
##
|
249
|
+
# @return [Time] The RFC 2822 date and time in GMT that the resource was created
|
250
|
+
def date_created
|
251
|
+
@properties['date_created']
|
252
|
+
end
|
253
|
+
|
254
|
+
##
|
255
|
+
# @return [Time] The RFC 2822 date and time in GMT that the resource was last updated
|
256
|
+
def date_updated
|
257
|
+
@properties['date_updated']
|
258
|
+
end
|
259
|
+
|
260
|
+
##
|
261
|
+
# @return [String] The unique string that identifies the resource
|
262
|
+
def sid
|
263
|
+
@properties['sid']
|
264
|
+
end
|
265
|
+
|
266
|
+
##
|
267
|
+
# @return [String] The SID of the Account that created the resource
|
268
|
+
def account_sid
|
269
|
+
@properties['account_sid']
|
270
|
+
end
|
271
|
+
|
272
|
+
##
|
273
|
+
# @return [String] A string name used to describe the Content resource
|
274
|
+
def friendly_name
|
275
|
+
@properties['friendly_name']
|
276
|
+
end
|
277
|
+
|
278
|
+
##
|
279
|
+
# @return [String] Two-letter language code identifying the language the Content resource is in.
|
280
|
+
def language
|
281
|
+
@properties['language']
|
282
|
+
end
|
283
|
+
|
284
|
+
##
|
285
|
+
# @return [Hash] Defines the default placeholder values for variables included in the Content resource
|
286
|
+
def variables
|
287
|
+
@properties['variables']
|
288
|
+
end
|
289
|
+
|
290
|
+
##
|
291
|
+
# @return [Hash] The Content types (e.g. twilio/text) for this Content resource
|
292
|
+
def types
|
293
|
+
@properties['types']
|
294
|
+
end
|
295
|
+
|
296
|
+
##
|
297
|
+
# @return [String] The URL of the resource, relative to `https://content.twilio.com`
|
298
|
+
def url
|
299
|
+
@properties['url']
|
300
|
+
end
|
301
|
+
|
302
|
+
##
|
303
|
+
# @return [String] A list of links related to the Content resource
|
304
|
+
def links
|
305
|
+
@properties['links']
|
306
|
+
end
|
307
|
+
|
308
|
+
##
|
309
|
+
# Fetch the ContentInstance
|
310
|
+
# @return [ContentInstance] Fetched ContentInstance
|
311
|
+
def fetch
|
312
|
+
context.fetch
|
313
|
+
end
|
314
|
+
|
315
|
+
##
|
316
|
+
# Delete the ContentInstance
|
317
|
+
# @return [Boolean] true if delete succeeds, false otherwise
|
318
|
+
def delete
|
319
|
+
context.delete
|
320
|
+
end
|
321
|
+
|
322
|
+
##
|
323
|
+
# Access the approval_fetch
|
324
|
+
# @return [approval_fetch] approval_fetch
|
325
|
+
def approval_fetch
|
326
|
+
context.approval_fetch
|
327
|
+
end
|
328
|
+
|
329
|
+
##
|
330
|
+
# Provide a user friendly representation
|
331
|
+
def to_s
|
332
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
333
|
+
"<Twilio.Content.V1.ContentInstance #{values}>"
|
334
|
+
end
|
335
|
+
|
336
|
+
##
|
337
|
+
# Provide a detailed, user friendly representation
|
338
|
+
def inspect
|
339
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
340
|
+
"<Twilio.Content.V1.ContentInstance #{values}>"
|
341
|
+
end
|
342
|
+
end
|
343
|
+
end
|
344
|
+
end
|
345
|
+
end
|
346
|
+
end
|