twilio-ruby 5.59.0 → 5.60.0
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 +18 -0
- data/README.md +2 -2
- data/lib/twilio-ruby/jwt/access_token.rb +13 -0
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/local.rb +7 -0
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/mobile.rb +7 -0
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/toll_free.rb +7 -0
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb +7 -0
- data/lib/twilio-ruby/rest/client.rb +7 -0
- data/lib/twilio-ruby/rest/media/v1/media_processor.rb +384 -0
- data/lib/twilio-ruby/rest/media/v1/player_streamer/playback_grant.rb +221 -0
- data/lib/twilio-ruby/rest/media/v1/player_streamer.rb +390 -0
- data/lib/twilio-ruby/rest/media/v1.rb +60 -0
- data/lib/twilio-ruby/rest/media.rb +56 -0
- data/lib/twilio-ruby/rest/messaging/v1/brand_registration/brand_vetting.rb +272 -0
- data/lib/twilio-ruby/rest/messaging/v1/brand_registration.rb +36 -0
- data/lib/twilio-ruby/rest/messaging/v1/service.rb +29 -3
- data/lib/twilio-ruby/rest/video/v1/room.rb +12 -1
- data/lib/twilio-ruby/version.rb +1 -1
- metadata +8 -2
@@ -0,0 +1,221 @@
|
|
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 Media < Domain
|
12
|
+
class V1 < Version
|
13
|
+
class PlayerStreamerContext < InstanceContext
|
14
|
+
class PlaybackGrantList < ListResource
|
15
|
+
##
|
16
|
+
# Initialize the PlaybackGrantList
|
17
|
+
# @param [Version] version Version that contains the resource
|
18
|
+
# @param [String] sid The unique string generated to identify the PlayerStreamer
|
19
|
+
# resource that this PlaybackGrant authorizes views for.
|
20
|
+
# @return [PlaybackGrantList] PlaybackGrantList
|
21
|
+
def initialize(version, sid: nil)
|
22
|
+
super(version)
|
23
|
+
|
24
|
+
# Path Solution
|
25
|
+
@solution = {sid: sid}
|
26
|
+
end
|
27
|
+
|
28
|
+
##
|
29
|
+
# Provide a user friendly representation
|
30
|
+
def to_s
|
31
|
+
'#<Twilio.Media.V1.PlaybackGrantList>'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class PlaybackGrantPage < Page
|
36
|
+
##
|
37
|
+
# Initialize the PlaybackGrantPage
|
38
|
+
# @param [Version] version Version that contains the resource
|
39
|
+
# @param [Response] response Response from the API
|
40
|
+
# @param [Hash] solution Path solution for the resource
|
41
|
+
# @return [PlaybackGrantPage] PlaybackGrantPage
|
42
|
+
def initialize(version, response, solution)
|
43
|
+
super(version, response)
|
44
|
+
|
45
|
+
# Path Solution
|
46
|
+
@solution = solution
|
47
|
+
end
|
48
|
+
|
49
|
+
##
|
50
|
+
# Build an instance of PlaybackGrantInstance
|
51
|
+
# @param [Hash] payload Payload response from the API
|
52
|
+
# @return [PlaybackGrantInstance] PlaybackGrantInstance
|
53
|
+
def get_instance(payload)
|
54
|
+
PlaybackGrantInstance.new(@version, payload, sid: @solution[:sid], )
|
55
|
+
end
|
56
|
+
|
57
|
+
##
|
58
|
+
# Provide a user friendly representation
|
59
|
+
def to_s
|
60
|
+
'<Twilio.Media.V1.PlaybackGrantPage>'
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
class PlaybackGrantContext < InstanceContext
|
65
|
+
##
|
66
|
+
# Initialize the PlaybackGrantContext
|
67
|
+
# @param [Version] version Version that contains the resource
|
68
|
+
# @param [String] sid The SID of the PlayerStreamer resource to fetch.
|
69
|
+
# @return [PlaybackGrantContext] PlaybackGrantContext
|
70
|
+
def initialize(version, sid)
|
71
|
+
super(version)
|
72
|
+
|
73
|
+
# Path Solution
|
74
|
+
@solution = {sid: sid, }
|
75
|
+
@uri = "/PlayerStreamers/#{@solution[:sid]}/PlaybackGrant"
|
76
|
+
end
|
77
|
+
|
78
|
+
##
|
79
|
+
# Create the PlaybackGrantInstance
|
80
|
+
# @param [String] ttl The time to live of the PlaybackGrant. Default value is 15
|
81
|
+
# seconds. Maximum value is 60 seconds.
|
82
|
+
# @param [String] access_control_allow_origin The full origin URL where the
|
83
|
+
# livestream can be streamed. If this is not provided, it can be streamed from any
|
84
|
+
# domain.
|
85
|
+
# @return [PlaybackGrantInstance] Created PlaybackGrantInstance
|
86
|
+
def create(ttl: :unset, access_control_allow_origin: :unset)
|
87
|
+
data = Twilio::Values.of({'Ttl' => ttl, 'AccessControlAllowOrigin' => access_control_allow_origin, })
|
88
|
+
|
89
|
+
payload = @version.create('POST', @uri, data: data)
|
90
|
+
|
91
|
+
PlaybackGrantInstance.new(@version, payload, sid: @solution[:sid], )
|
92
|
+
end
|
93
|
+
|
94
|
+
##
|
95
|
+
# Fetch the PlaybackGrantInstance
|
96
|
+
# @return [PlaybackGrantInstance] Fetched PlaybackGrantInstance
|
97
|
+
def fetch
|
98
|
+
payload = @version.fetch('GET', @uri)
|
99
|
+
|
100
|
+
PlaybackGrantInstance.new(@version, payload, sid: @solution[:sid], )
|
101
|
+
end
|
102
|
+
|
103
|
+
##
|
104
|
+
# Provide a user friendly representation
|
105
|
+
def to_s
|
106
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
107
|
+
"#<Twilio.Media.V1.PlaybackGrantContext #{context}>"
|
108
|
+
end
|
109
|
+
|
110
|
+
##
|
111
|
+
# Provide a detailed, user friendly representation
|
112
|
+
def inspect
|
113
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
114
|
+
"#<Twilio.Media.V1.PlaybackGrantContext #{context}>"
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
class PlaybackGrantInstance < InstanceResource
|
119
|
+
##
|
120
|
+
# Initialize the PlaybackGrantInstance
|
121
|
+
# @param [Version] version Version that contains the resource
|
122
|
+
# @param [Hash] payload payload that contains response from Twilio
|
123
|
+
# @param [String] sid The unique string generated to identify the PlayerStreamer
|
124
|
+
# resource that this PlaybackGrant authorizes views for.
|
125
|
+
# @return [PlaybackGrantInstance] PlaybackGrantInstance
|
126
|
+
def initialize(version, payload, sid: nil)
|
127
|
+
super(version)
|
128
|
+
|
129
|
+
# Marshaled Properties
|
130
|
+
@properties = {
|
131
|
+
'sid' => payload['sid'],
|
132
|
+
'url' => payload['url'],
|
133
|
+
'account_sid' => payload['account_sid'],
|
134
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
135
|
+
'grant' => payload['grant'],
|
136
|
+
}
|
137
|
+
|
138
|
+
# Context
|
139
|
+
@instance_context = nil
|
140
|
+
@params = {'sid' => sid, }
|
141
|
+
end
|
142
|
+
|
143
|
+
##
|
144
|
+
# Generate an instance context for the instance, the context is capable of
|
145
|
+
# performing various actions. All instance actions are proxied to the context
|
146
|
+
# @return [PlaybackGrantContext] PlaybackGrantContext for this PlaybackGrantInstance
|
147
|
+
def context
|
148
|
+
unless @instance_context
|
149
|
+
@instance_context = PlaybackGrantContext.new(@version, @params['sid'], )
|
150
|
+
end
|
151
|
+
@instance_context
|
152
|
+
end
|
153
|
+
|
154
|
+
##
|
155
|
+
# @return [String] The unique string that identifies the PlayerStreamer associated with this PlaybackGrant.
|
156
|
+
def sid
|
157
|
+
@properties['sid']
|
158
|
+
end
|
159
|
+
|
160
|
+
##
|
161
|
+
# @return [String] The absolute URL of the resource
|
162
|
+
def url
|
163
|
+
@properties['url']
|
164
|
+
end
|
165
|
+
|
166
|
+
##
|
167
|
+
# @return [String] The SID of the Account that created the resource
|
168
|
+
def account_sid
|
169
|
+
@properties['account_sid']
|
170
|
+
end
|
171
|
+
|
172
|
+
##
|
173
|
+
# @return [Time] The ISO 8601 date and time in GMT when the resource was created
|
174
|
+
def date_created
|
175
|
+
@properties['date_created']
|
176
|
+
end
|
177
|
+
|
178
|
+
##
|
179
|
+
# @return [Hash] The grant that authorizes the player sdk to connect to the livestream
|
180
|
+
def grant
|
181
|
+
@properties['grant']
|
182
|
+
end
|
183
|
+
|
184
|
+
##
|
185
|
+
# Create the PlaybackGrantInstance
|
186
|
+
# @param [String] ttl The time to live of the PlaybackGrant. Default value is 15
|
187
|
+
# seconds. Maximum value is 60 seconds.
|
188
|
+
# @param [String] access_control_allow_origin The full origin URL where the
|
189
|
+
# livestream can be streamed. If this is not provided, it can be streamed from any
|
190
|
+
# domain.
|
191
|
+
# @return [PlaybackGrantInstance] Created PlaybackGrantInstance
|
192
|
+
def create(ttl: :unset, access_control_allow_origin: :unset)
|
193
|
+
context.create(ttl: ttl, access_control_allow_origin: access_control_allow_origin, )
|
194
|
+
end
|
195
|
+
|
196
|
+
##
|
197
|
+
# Fetch the PlaybackGrantInstance
|
198
|
+
# @return [PlaybackGrantInstance] Fetched PlaybackGrantInstance
|
199
|
+
def fetch
|
200
|
+
context.fetch
|
201
|
+
end
|
202
|
+
|
203
|
+
##
|
204
|
+
# Provide a user friendly representation
|
205
|
+
def to_s
|
206
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
207
|
+
"<Twilio.Media.V1.PlaybackGrantInstance #{values}>"
|
208
|
+
end
|
209
|
+
|
210
|
+
##
|
211
|
+
# Provide a detailed, user friendly representation
|
212
|
+
def inspect
|
213
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
214
|
+
"<Twilio.Media.V1.PlaybackGrantInstance #{values}>"
|
215
|
+
end
|
216
|
+
end
|
217
|
+
end
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|
@@ -0,0 +1,390 @@
|
|
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 Media < Domain
|
12
|
+
class V1 < Version
|
13
|
+
class PlayerStreamerList < ListResource
|
14
|
+
##
|
15
|
+
# Initialize the PlayerStreamerList
|
16
|
+
# @param [Version] version Version that contains the resource
|
17
|
+
# @return [PlayerStreamerList] PlayerStreamerList
|
18
|
+
def initialize(version)
|
19
|
+
super(version)
|
20
|
+
|
21
|
+
# Path Solution
|
22
|
+
@solution = {}
|
23
|
+
@uri = "/PlayerStreamers"
|
24
|
+
end
|
25
|
+
|
26
|
+
##
|
27
|
+
# Create the PlayerStreamerInstance
|
28
|
+
# @param [Boolean] video Specifies whether the PlayerStreamer is configured to
|
29
|
+
# stream video. Defaults to `true`.
|
30
|
+
# @param [String] status_callback The URL to which Twilio will send asynchronous
|
31
|
+
# webhook requests for every PlayerStreamer event. See {Status
|
32
|
+
# Callbacks}[/docs/live/status-callbacks] for more details.
|
33
|
+
# @param [String] status_callback_method The HTTP method Twilio should use to call
|
34
|
+
# the `status_callback` URL. Can be `POST` or `GET` and the default is `POST`.
|
35
|
+
# @return [PlayerStreamerInstance] Created PlayerStreamerInstance
|
36
|
+
def create(video: :unset, status_callback: :unset, status_callback_method: :unset)
|
37
|
+
data = Twilio::Values.of({
|
38
|
+
'Video' => video,
|
39
|
+
'StatusCallback' => status_callback,
|
40
|
+
'StatusCallbackMethod' => status_callback_method,
|
41
|
+
})
|
42
|
+
|
43
|
+
payload = @version.create('POST', @uri, data: data)
|
44
|
+
|
45
|
+
PlayerStreamerInstance.new(@version, payload, )
|
46
|
+
end
|
47
|
+
|
48
|
+
##
|
49
|
+
# Lists PlayerStreamerInstance records from the API as a list.
|
50
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
51
|
+
# memory before returning.
|
52
|
+
# @param [player_streamer.Order] order The sort order of the list by
|
53
|
+
# `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as
|
54
|
+
# the default.
|
55
|
+
# @param [player_streamer.Status] status Status to filter by, with possible values
|
56
|
+
# `created`, `started`, `ended`, or `failed`.
|
57
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
58
|
+
# guarantees to never return more than limit. Default is no limit
|
59
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
60
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
61
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
62
|
+
# efficient page size, i.e. min(limit, 1000)
|
63
|
+
# @return [Array] Array of up to limit results
|
64
|
+
def list(order: :unset, status: :unset, limit: nil, page_size: nil)
|
65
|
+
self.stream(order: order, status: status, limit: limit, page_size: page_size).entries
|
66
|
+
end
|
67
|
+
|
68
|
+
##
|
69
|
+
# Streams PlayerStreamerInstance records from the API as an Enumerable.
|
70
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
71
|
+
# is reached.
|
72
|
+
# @param [player_streamer.Order] order The sort order of the list by
|
73
|
+
# `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as
|
74
|
+
# the default.
|
75
|
+
# @param [player_streamer.Status] status Status to filter by, with possible values
|
76
|
+
# `created`, `started`, `ended`, or `failed`.
|
77
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
78
|
+
# guarantees to never return more than limit. Default is no limit.
|
79
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
80
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
81
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
82
|
+
# efficient page size, i.e. min(limit, 1000)
|
83
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
84
|
+
def stream(order: :unset, status: :unset, limit: nil, page_size: nil)
|
85
|
+
limits = @version.read_limits(limit, page_size)
|
86
|
+
|
87
|
+
page = self.page(order: order, status: status, page_size: limits[:page_size], )
|
88
|
+
|
89
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
90
|
+
end
|
91
|
+
|
92
|
+
##
|
93
|
+
# When passed a block, yields PlayerStreamerInstance records from the API.
|
94
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
95
|
+
# is reached.
|
96
|
+
def each
|
97
|
+
limits = @version.read_limits
|
98
|
+
|
99
|
+
page = self.page(page_size: limits[:page_size], )
|
100
|
+
|
101
|
+
@version.stream(page,
|
102
|
+
limit: limits[:limit],
|
103
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
104
|
+
end
|
105
|
+
|
106
|
+
##
|
107
|
+
# Retrieve a single page of PlayerStreamerInstance records from the API.
|
108
|
+
# Request is executed immediately.
|
109
|
+
# @param [player_streamer.Order] order The sort order of the list by
|
110
|
+
# `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as
|
111
|
+
# the default.
|
112
|
+
# @param [player_streamer.Status] status Status to filter by, with possible values
|
113
|
+
# `created`, `started`, `ended`, or `failed`.
|
114
|
+
# @param [String] page_token PageToken provided by the API
|
115
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
116
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
117
|
+
# @return [Page] Page of PlayerStreamerInstance
|
118
|
+
def page(order: :unset, status: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
|
119
|
+
params = Twilio::Values.of({
|
120
|
+
'Order' => order,
|
121
|
+
'Status' => status,
|
122
|
+
'PageToken' => page_token,
|
123
|
+
'Page' => page_number,
|
124
|
+
'PageSize' => page_size,
|
125
|
+
})
|
126
|
+
|
127
|
+
response = @version.page('GET', @uri, params: params)
|
128
|
+
|
129
|
+
PlayerStreamerPage.new(@version, response, @solution)
|
130
|
+
end
|
131
|
+
|
132
|
+
##
|
133
|
+
# Retrieve a single page of PlayerStreamerInstance records from the API.
|
134
|
+
# Request is executed immediately.
|
135
|
+
# @param [String] target_url API-generated URL for the requested results page
|
136
|
+
# @return [Page] Page of PlayerStreamerInstance
|
137
|
+
def get_page(target_url)
|
138
|
+
response = @version.domain.request(
|
139
|
+
'GET',
|
140
|
+
target_url
|
141
|
+
)
|
142
|
+
PlayerStreamerPage.new(@version, response, @solution)
|
143
|
+
end
|
144
|
+
|
145
|
+
##
|
146
|
+
# Provide a user friendly representation
|
147
|
+
def to_s
|
148
|
+
'#<Twilio.Media.V1.PlayerStreamerList>'
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
class PlayerStreamerPage < Page
|
153
|
+
##
|
154
|
+
# Initialize the PlayerStreamerPage
|
155
|
+
# @param [Version] version Version that contains the resource
|
156
|
+
# @param [Response] response Response from the API
|
157
|
+
# @param [Hash] solution Path solution for the resource
|
158
|
+
# @return [PlayerStreamerPage] PlayerStreamerPage
|
159
|
+
def initialize(version, response, solution)
|
160
|
+
super(version, response)
|
161
|
+
|
162
|
+
# Path Solution
|
163
|
+
@solution = solution
|
164
|
+
end
|
165
|
+
|
166
|
+
##
|
167
|
+
# Build an instance of PlayerStreamerInstance
|
168
|
+
# @param [Hash] payload Payload response from the API
|
169
|
+
# @return [PlayerStreamerInstance] PlayerStreamerInstance
|
170
|
+
def get_instance(payload)
|
171
|
+
PlayerStreamerInstance.new(@version, payload, )
|
172
|
+
end
|
173
|
+
|
174
|
+
##
|
175
|
+
# Provide a user friendly representation
|
176
|
+
def to_s
|
177
|
+
'<Twilio.Media.V1.PlayerStreamerPage>'
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
class PlayerStreamerContext < InstanceContext
|
182
|
+
##
|
183
|
+
# Initialize the PlayerStreamerContext
|
184
|
+
# @param [Version] version Version that contains the resource
|
185
|
+
# @param [String] sid The SID of the PlayerStreamer resource to fetch.
|
186
|
+
# @return [PlayerStreamerContext] PlayerStreamerContext
|
187
|
+
def initialize(version, sid)
|
188
|
+
super(version)
|
189
|
+
|
190
|
+
# Path Solution
|
191
|
+
@solution = {sid: sid, }
|
192
|
+
@uri = "/PlayerStreamers/#{@solution[:sid]}"
|
193
|
+
|
194
|
+
# Dependents
|
195
|
+
@playback_grant = nil
|
196
|
+
end
|
197
|
+
|
198
|
+
##
|
199
|
+
# Fetch the PlayerStreamerInstance
|
200
|
+
# @return [PlayerStreamerInstance] Fetched PlayerStreamerInstance
|
201
|
+
def fetch
|
202
|
+
payload = @version.fetch('GET', @uri)
|
203
|
+
|
204
|
+
PlayerStreamerInstance.new(@version, payload, sid: @solution[:sid], )
|
205
|
+
end
|
206
|
+
|
207
|
+
##
|
208
|
+
# Update the PlayerStreamerInstance
|
209
|
+
# @param [player_streamer.UpdateStatus] status The status the PlayerStreamer
|
210
|
+
# should be transitioned to. Can be: `ended`.
|
211
|
+
# @return [PlayerStreamerInstance] Updated PlayerStreamerInstance
|
212
|
+
def update(status: nil)
|
213
|
+
data = Twilio::Values.of({'Status' => status, })
|
214
|
+
|
215
|
+
payload = @version.update('POST', @uri, data: data)
|
216
|
+
|
217
|
+
PlayerStreamerInstance.new(@version, payload, sid: @solution[:sid], )
|
218
|
+
end
|
219
|
+
|
220
|
+
##
|
221
|
+
# Access the playback_grant
|
222
|
+
# @return [PlaybackGrantList]
|
223
|
+
# @return [PlaybackGrantContext]
|
224
|
+
def playback_grant
|
225
|
+
PlaybackGrantContext.new(@version, @solution[:sid], )
|
226
|
+
end
|
227
|
+
|
228
|
+
##
|
229
|
+
# Provide a user friendly representation
|
230
|
+
def to_s
|
231
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
232
|
+
"#<Twilio.Media.V1.PlayerStreamerContext #{context}>"
|
233
|
+
end
|
234
|
+
|
235
|
+
##
|
236
|
+
# Provide a detailed, user friendly representation
|
237
|
+
def inspect
|
238
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
239
|
+
"#<Twilio.Media.V1.PlayerStreamerContext #{context}>"
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
class PlayerStreamerInstance < InstanceResource
|
244
|
+
##
|
245
|
+
# Initialize the PlayerStreamerInstance
|
246
|
+
# @param [Version] version Version that contains the resource
|
247
|
+
# @param [Hash] payload payload that contains response from Twilio
|
248
|
+
# @param [String] sid The SID of the PlayerStreamer resource to fetch.
|
249
|
+
# @return [PlayerStreamerInstance] PlayerStreamerInstance
|
250
|
+
def initialize(version, payload, sid: nil)
|
251
|
+
super(version)
|
252
|
+
|
253
|
+
# Marshaled Properties
|
254
|
+
@properties = {
|
255
|
+
'account_sid' => payload['account_sid'],
|
256
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
257
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
258
|
+
'video' => payload['video'],
|
259
|
+
'links' => payload['links'],
|
260
|
+
'sid' => payload['sid'],
|
261
|
+
'status' => payload['status'],
|
262
|
+
'url' => payload['url'],
|
263
|
+
'status_callback' => payload['status_callback'],
|
264
|
+
'status_callback_method' => payload['status_callback_method'],
|
265
|
+
'ended_reason' => payload['ended_reason'],
|
266
|
+
}
|
267
|
+
|
268
|
+
# Context
|
269
|
+
@instance_context = nil
|
270
|
+
@params = {'sid' => sid || @properties['sid'], }
|
271
|
+
end
|
272
|
+
|
273
|
+
##
|
274
|
+
# Generate an instance context for the instance, the context is capable of
|
275
|
+
# performing various actions. All instance actions are proxied to the context
|
276
|
+
# @return [PlayerStreamerContext] PlayerStreamerContext for this PlayerStreamerInstance
|
277
|
+
def context
|
278
|
+
unless @instance_context
|
279
|
+
@instance_context = PlayerStreamerContext.new(@version, @params['sid'], )
|
280
|
+
end
|
281
|
+
@instance_context
|
282
|
+
end
|
283
|
+
|
284
|
+
##
|
285
|
+
# @return [String] The SID of the Account that created the resource
|
286
|
+
def account_sid
|
287
|
+
@properties['account_sid']
|
288
|
+
end
|
289
|
+
|
290
|
+
##
|
291
|
+
# @return [Time] The ISO 8601 date and time in GMT when the resource was created
|
292
|
+
def date_created
|
293
|
+
@properties['date_created']
|
294
|
+
end
|
295
|
+
|
296
|
+
##
|
297
|
+
# @return [Time] The ISO 8601 date and time in GMT when the resource was last updated
|
298
|
+
def date_updated
|
299
|
+
@properties['date_updated']
|
300
|
+
end
|
301
|
+
|
302
|
+
##
|
303
|
+
# @return [Boolean] Whether the PlayerStreamer is configured to stream video
|
304
|
+
def video
|
305
|
+
@properties['video']
|
306
|
+
end
|
307
|
+
|
308
|
+
##
|
309
|
+
# @return [String] The URLs of related resources
|
310
|
+
def links
|
311
|
+
@properties['links']
|
312
|
+
end
|
313
|
+
|
314
|
+
##
|
315
|
+
# @return [String] The unique string that identifies the resource
|
316
|
+
def sid
|
317
|
+
@properties['sid']
|
318
|
+
end
|
319
|
+
|
320
|
+
##
|
321
|
+
# @return [player_streamer.Status] The status of the PlayerStreamer
|
322
|
+
def status
|
323
|
+
@properties['status']
|
324
|
+
end
|
325
|
+
|
326
|
+
##
|
327
|
+
# @return [String] The absolute URL of the resource
|
328
|
+
def url
|
329
|
+
@properties['url']
|
330
|
+
end
|
331
|
+
|
332
|
+
##
|
333
|
+
# @return [String] The URL to which Twilio will send PlayerStreamer event updates
|
334
|
+
def status_callback
|
335
|
+
@properties['status_callback']
|
336
|
+
end
|
337
|
+
|
338
|
+
##
|
339
|
+
# @return [String] The HTTP method Twilio should use to call the `status_callback` URL
|
340
|
+
def status_callback_method
|
341
|
+
@properties['status_callback_method']
|
342
|
+
end
|
343
|
+
|
344
|
+
##
|
345
|
+
# @return [player_streamer.EndedReason] The reason why a PlayerStreamer ended
|
346
|
+
def ended_reason
|
347
|
+
@properties['ended_reason']
|
348
|
+
end
|
349
|
+
|
350
|
+
##
|
351
|
+
# Fetch the PlayerStreamerInstance
|
352
|
+
# @return [PlayerStreamerInstance] Fetched PlayerStreamerInstance
|
353
|
+
def fetch
|
354
|
+
context.fetch
|
355
|
+
end
|
356
|
+
|
357
|
+
##
|
358
|
+
# Update the PlayerStreamerInstance
|
359
|
+
# @param [player_streamer.UpdateStatus] status The status the PlayerStreamer
|
360
|
+
# should be transitioned to. Can be: `ended`.
|
361
|
+
# @return [PlayerStreamerInstance] Updated PlayerStreamerInstance
|
362
|
+
def update(status: nil)
|
363
|
+
context.update(status: status, )
|
364
|
+
end
|
365
|
+
|
366
|
+
##
|
367
|
+
# Access the playback_grant
|
368
|
+
# @return [playback_grant] playback_grant
|
369
|
+
def playback_grant
|
370
|
+
context.playback_grant
|
371
|
+
end
|
372
|
+
|
373
|
+
##
|
374
|
+
# Provide a user friendly representation
|
375
|
+
def to_s
|
376
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
377
|
+
"<Twilio.Media.V1.PlayerStreamerInstance #{values}>"
|
378
|
+
end
|
379
|
+
|
380
|
+
##
|
381
|
+
# Provide a detailed, user friendly representation
|
382
|
+
def inspect
|
383
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
384
|
+
"<Twilio.Media.V1.PlayerStreamerInstance #{values}>"
|
385
|
+
end
|
386
|
+
end
|
387
|
+
end
|
388
|
+
end
|
389
|
+
end
|
390
|
+
end
|
@@ -0,0 +1,60 @@
|
|
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 Media
|
12
|
+
class V1 < Version
|
13
|
+
##
|
14
|
+
# Initialize the V1 version of Media
|
15
|
+
def initialize(domain)
|
16
|
+
super
|
17
|
+
@version = 'v1'
|
18
|
+
@media_processor = nil
|
19
|
+
@player_streamer = nil
|
20
|
+
end
|
21
|
+
|
22
|
+
##
|
23
|
+
# @param [String] sid The SID of the MediaProcessor resource to fetch.
|
24
|
+
# @return [Twilio::REST::Media::V1::MediaProcessorContext] if sid was passed.
|
25
|
+
# @return [Twilio::REST::Media::V1::MediaProcessorList]
|
26
|
+
def media_processor(sid=:unset)
|
27
|
+
if sid.nil?
|
28
|
+
raise ArgumentError, 'sid cannot be nil'
|
29
|
+
end
|
30
|
+
if sid == :unset
|
31
|
+
@media_processor ||= MediaProcessorList.new self
|
32
|
+
else
|
33
|
+
MediaProcessorContext.new(self, sid)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
##
|
38
|
+
# @param [String] sid The SID of the PlayerStreamer resource to fetch.
|
39
|
+
# @return [Twilio::REST::Media::V1::PlayerStreamerContext] if sid was passed.
|
40
|
+
# @return [Twilio::REST::Media::V1::PlayerStreamerList]
|
41
|
+
def player_streamer(sid=:unset)
|
42
|
+
if sid.nil?
|
43
|
+
raise ArgumentError, 'sid cannot be nil'
|
44
|
+
end
|
45
|
+
if sid == :unset
|
46
|
+
@player_streamer ||= PlayerStreamerList.new self
|
47
|
+
else
|
48
|
+
PlayerStreamerContext.new(self, sid)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
##
|
53
|
+
# Provide a user friendly representation
|
54
|
+
def to_s
|
55
|
+
'<Twilio::REST::Media::V1>'
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|