twilio-ruby 5.61.0 → 5.61.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2f67e55070e1d0eddd733aab27eb25aaac27b3ca
4
- data.tar.gz: 8152831ec638b70b0bae3a6596080c1fa6c7ced9
3
+ metadata.gz: 0744c60bf47ebe5674a6c2ea371fdda3ae937ef4
4
+ data.tar.gz: a8d42def7f349fb8a99c035f59c3436d8f969fe9
5
5
  SHA512:
6
- metadata.gz: 4386a3cee85ffba9015d8eb0aba9012fbe5e8465635f96bfe563fafbd2aa6d99c0b4228a6b8dfca7fb958c16175b079eaa44e9c06d1944fdc8fdd630de3f58af
7
- data.tar.gz: f57664647dd26b987cd3cc45b6ff2035880bb324acc1b790a9271d66bdbdc7ca12d73164be50fe023e11ece500db1044717db855006791569b903f7d42cdf927
6
+ metadata.gz: 0b62a9817b86b3f5e03c491072907cf359eff878d21b315f92848e9546a6f1f3664d29c1be464e17444bc15754af6079703f3e46d17f7845d9ed460ae9d8ff44
7
+ data.tar.gz: 5612432558411b78da25b0b6e1dfcb4edd51ed710c3562cb9174fe6e93bcdc0cd88e55aa02dc19a361534dcbe3e88a52d3ca64ed6032ac42af2045547e30d70e
@@ -12,6 +12,8 @@ jobs:
12
12
  steps:
13
13
  - name: Checkout twilio-ruby
14
14
  uses: actions/checkout@v2
15
+ with:
16
+ fetch-depth: 0
15
17
 
16
18
  - name: Login to Docker Hub
17
19
  uses: docker/login-action@v1
@@ -17,6 +17,7 @@ jobs:
17
17
  strategy:
18
18
  matrix:
19
19
  ruby: [2.4, 2.5, 2.6, 2.7, '3.0', ruby-head, jruby-9.2]
20
+ continue-on-error: ${{ matrix.ruby == 'ruby-head' }}
20
21
  steps:
21
22
  - name: Checkout twilio-ruby
22
23
  uses: actions/checkout@v2
data/.gitignore CHANGED
@@ -13,5 +13,6 @@ docs/_build
13
13
  *.iml
14
14
  .bundle
15
15
  .rakeTasks
16
+ .yardoc
16
17
 
17
18
  coverage
data/.rubocop.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
3
  AllCops:
4
- TargetRubyVersion: 2.6
4
+ TargetRubyVersion: 2.4
5
5
  Exclude:
6
6
  - 'lib/twilio-ruby/rest/**/*'
7
7
  - 'spec/integration/**/*'
data/CHANGES.md CHANGED
@@ -1,6 +1,57 @@
1
1
  twilio-ruby changelog
2
2
  =====================
3
3
 
4
+ [2021-12-01] Version 5.61.2
5
+ ---------------------------
6
+ **Library - Chore**
7
+ - [PR #579](https://github.com/twilio/twilio-ruby/pull/579): make ruby-head test optional. Thanks to [@eshanholtz](https://github.com/eshanholtz)!
8
+
9
+ **Conversations**
10
+ - Add `Service Webhook Configuration` resource
11
+
12
+ **Flex**
13
+ - Adding `flex_insights_drilldown` and `flex_url` objects to Flex Configuration
14
+
15
+ **Messaging**
16
+ - Update us_app_to_person endpoints to remove beta feature flag based access
17
+
18
+ **Supersim**
19
+ - Add IP Commands resource
20
+
21
+ **Verify**
22
+ - Add optional `factor_friendly_name` parameter to the create access token endpoint.
23
+
24
+ **Video**
25
+ - Add maxParticipantDuration param to Rooms
26
+
27
+ **Twiml**
28
+ - Unrevert Add supported SSML children to `<emphasis>`, `<lang>`, `<p>`, `<prosody>`, `<s>`, and `<w>`.
29
+ - Revert Add supported SSML children to `<emphasis>`, `<lang>`, `<p>`, `<prosody>`, `<s>`, and `<w>`.
30
+
31
+
32
+ [2021-11-17] Version 5.61.1
33
+ ---------------------------
34
+ **Library - Chore**
35
+ - [PR #578](https://github.com/twilio/twilio-ruby/pull/578): remove yardoc files. Thanks to [@eshanholtz](https://github.com/eshanholtz)!
36
+
37
+ **Library - Fix**
38
+ - [PR #576](https://github.com/twilio/twilio-ruby/pull/576): git log retrieval issues. Thanks to [@shwetha-manvinkurke](https://github.com/shwetha-manvinkurke)!
39
+
40
+ **Frontline**
41
+ - Added `is_available` to User's resource
42
+
43
+ **Messaging**
44
+ - Added GET vetting API
45
+
46
+ **Verify**
47
+ - Add `WHATSAPP` to the attempts API.
48
+ - Allow to update `config.notification_platform` from `none` to `apn` or `fcm` and viceversa for Verify Push
49
+ - Add `none` as a valid `config.notification_platform` value for Verify Push
50
+
51
+ **Twiml**
52
+ - Add supported SSML children to `<emphasis>`, `<lang>`, `<p>`, `<prosody>`, `<s>`, and `<w>`.
53
+
54
+
4
55
  [2021-11-03] Version 5.61.0
5
56
  ---------------------------
6
57
  **Library - Chore**
data/Makefile CHANGED
@@ -10,7 +10,7 @@ test: lint
10
10
  bundle exec rake spec
11
11
 
12
12
  lint:
13
- bundle exec rubocop --cache true --parallel
13
+ bundle exec rubocop -d --cache true --parallel
14
14
 
15
15
  docs:
16
16
  yard doc --output-dir ./doc
data/README.md CHANGED
@@ -35,13 +35,13 @@ This library supports the following Ruby implementations:
35
35
  To install using [Bundler][bundler] grab the latest stable version:
36
36
 
37
37
  ```ruby
38
- gem 'twilio-ruby', '~> 5.61.0'
38
+ gem 'twilio-ruby', '~> 5.61.2'
39
39
  ```
40
40
 
41
41
  To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:
42
42
 
43
43
  ```bash
44
- gem install twilio-ruby -v 5.61.0
44
+ gem install twilio-ruby -v 5.61.2
45
45
  ```
46
46
 
47
47
  To build and install the development branch yourself from the latest source:
@@ -144,9 +144,9 @@ module Twilio
144
144
  # Calls Beta)
145
145
  # @param [String] call_token A token string needed to invoke a forwarded call. A
146
146
  # call_token is generated when an incoming call is received on a Twilio number.
147
- # this field should be populated by the incoming call's call_token to make this
148
- # outgoing call as a forwarded call of incoming call. A forwarded call should bear
149
- # the same caller-id of incoming call.
147
+ # Pass an incoming call's call_token value to a forwarded call via the call_token
148
+ # parameter when creating a new call. A forwarded call should bear the same
149
+ # CallerID of the original incoming call.
150
150
  # @param [String] recording_track The audio track to record for the call. Can be:
151
151
  # `inbound`, `outbound` or `both`. The default is `both`. `inbound` records the
152
152
  # audio that is received by Twilio. `outbound` records the audio that is generated
@@ -0,0 +1,269 @@
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 Conversations < Domain
12
+ class V1 < Version
13
+ class ServiceContext < InstanceContext
14
+ class ConfigurationContext < InstanceContext
15
+ class WebhookList < ListResource
16
+ ##
17
+ # Initialize the WebhookList
18
+ # @param [Version] version Version that contains the resource
19
+ # @param [String] chat_service_sid The unique string that we created to identify
20
+ # the Service configuration resource.
21
+ # @return [WebhookList] WebhookList
22
+ def initialize(version, chat_service_sid: nil)
23
+ super(version)
24
+
25
+ # Path Solution
26
+ @solution = {chat_service_sid: chat_service_sid}
27
+ end
28
+
29
+ ##
30
+ # Provide a user friendly representation
31
+ def to_s
32
+ '#<Twilio.Conversations.V1.WebhookList>'
33
+ end
34
+ end
35
+
36
+ class WebhookPage < Page
37
+ ##
38
+ # Initialize the WebhookPage
39
+ # @param [Version] version Version that contains the resource
40
+ # @param [Response] response Response from the API
41
+ # @param [Hash] solution Path solution for the resource
42
+ # @return [WebhookPage] WebhookPage
43
+ def initialize(version, response, solution)
44
+ super(version, response)
45
+
46
+ # Path Solution
47
+ @solution = solution
48
+ end
49
+
50
+ ##
51
+ # Build an instance of WebhookInstance
52
+ # @param [Hash] payload Payload response from the API
53
+ # @return [WebhookInstance] WebhookInstance
54
+ def get_instance(payload)
55
+ WebhookInstance.new(@version, payload, chat_service_sid: @solution[:chat_service_sid], )
56
+ end
57
+
58
+ ##
59
+ # Provide a user friendly representation
60
+ def to_s
61
+ '<Twilio.Conversations.V1.WebhookPage>'
62
+ end
63
+ end
64
+
65
+ class WebhookContext < InstanceContext
66
+ ##
67
+ # Initialize the WebhookContext
68
+ # @param [Version] version Version that contains the resource
69
+ # @param [String] chat_service_sid The unique ID of the {Conversation
70
+ # Service}[https://www.twilio.com/docs/conversations/api/service-resource] this
71
+ # conversation belongs to.
72
+ # @return [WebhookContext] WebhookContext
73
+ def initialize(version, chat_service_sid)
74
+ super(version)
75
+
76
+ # Path Solution
77
+ @solution = {chat_service_sid: chat_service_sid, }
78
+ @uri = "/Services/#{@solution[:chat_service_sid]}/Configuration/Webhooks"
79
+ end
80
+
81
+ ##
82
+ # Update the WebhookInstance
83
+ # @param [String] pre_webhook_url The absolute url the pre-event webhook request
84
+ # should be sent to.
85
+ # @param [String] post_webhook_url The absolute url the post-event webhook request
86
+ # should be sent to.
87
+ # @param [Array[String]] filters The list of webhook event triggers that are
88
+ # enabled for this Service. Possible values are `onParticipantAdd`,
89
+ # `onParticipantAdded`, `onDeliveryUpdated`, `onConversationUpdated`,
90
+ # `onConversationRemove`, `onParticipantRemove`, `onConversationUpdate`,
91
+ # `onMessageAdd`, `onMessageRemoved`, `onParticipantUpdated`,
92
+ # `onConversationAdded`, `onMessageAdded`, `onConversationAdd`,
93
+ # `onConversationRemoved`, `onParticipantUpdate`, `onMessageRemove`,
94
+ # `onMessageUpdated`, `onParticipantRemoved`, `onMessageUpdate` or
95
+ # `onConversationStateUpdated`.
96
+ # @param [String] method The HTTP method to be used when sending a webhook
97
+ # request. One of `GET` or `POST`.
98
+ # @return [WebhookInstance] Updated WebhookInstance
99
+ def update(pre_webhook_url: :unset, post_webhook_url: :unset, filters: :unset, method: :unset)
100
+ data = Twilio::Values.of({
101
+ 'PreWebhookUrl' => pre_webhook_url,
102
+ 'PostWebhookUrl' => post_webhook_url,
103
+ 'Filters' => Twilio.serialize_list(filters) { |e| e },
104
+ 'Method' => method,
105
+ })
106
+
107
+ payload = @version.update('POST', @uri, data: data)
108
+
109
+ WebhookInstance.new(@version, payload, chat_service_sid: @solution[:chat_service_sid], )
110
+ end
111
+
112
+ ##
113
+ # Fetch the WebhookInstance
114
+ # @return [WebhookInstance] Fetched WebhookInstance
115
+ def fetch
116
+ payload = @version.fetch('GET', @uri)
117
+
118
+ WebhookInstance.new(@version, payload, chat_service_sid: @solution[:chat_service_sid], )
119
+ end
120
+
121
+ ##
122
+ # Provide a user friendly representation
123
+ def to_s
124
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
125
+ "#<Twilio.Conversations.V1.WebhookContext #{context}>"
126
+ end
127
+
128
+ ##
129
+ # Provide a detailed, user friendly representation
130
+ def inspect
131
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
132
+ "#<Twilio.Conversations.V1.WebhookContext #{context}>"
133
+ end
134
+ end
135
+
136
+ class WebhookInstance < InstanceResource
137
+ ##
138
+ # Initialize the WebhookInstance
139
+ # @param [Version] version Version that contains the resource
140
+ # @param [Hash] payload payload that contains response from Twilio
141
+ # @param [String] chat_service_sid The unique string that we created to identify
142
+ # the Service configuration resource.
143
+ # @return [WebhookInstance] WebhookInstance
144
+ def initialize(version, payload, chat_service_sid: nil)
145
+ super(version)
146
+
147
+ # Marshaled Properties
148
+ @properties = {
149
+ 'account_sid' => payload['account_sid'],
150
+ 'chat_service_sid' => payload['chat_service_sid'],
151
+ 'pre_webhook_url' => payload['pre_webhook_url'],
152
+ 'post_webhook_url' => payload['post_webhook_url'],
153
+ 'filters' => payload['filters'],
154
+ 'method' => payload['method'],
155
+ 'url' => payload['url'],
156
+ }
157
+
158
+ # Context
159
+ @instance_context = nil
160
+ @params = {'chat_service_sid' => chat_service_sid, }
161
+ end
162
+
163
+ ##
164
+ # Generate an instance context for the instance, the context is capable of
165
+ # performing various actions. All instance actions are proxied to the context
166
+ # @return [WebhookContext] WebhookContext for this WebhookInstance
167
+ def context
168
+ unless @instance_context
169
+ @instance_context = WebhookContext.new(@version, @params['chat_service_sid'], )
170
+ end
171
+ @instance_context
172
+ end
173
+
174
+ ##
175
+ # @return [String] The unique ID of the Account responsible for this service.
176
+ def account_sid
177
+ @properties['account_sid']
178
+ end
179
+
180
+ ##
181
+ # @return [String] The chat_service_sid
182
+ def chat_service_sid
183
+ @properties['chat_service_sid']
184
+ end
185
+
186
+ ##
187
+ # @return [String] The absolute url the pre-event webhook request should be sent to.
188
+ def pre_webhook_url
189
+ @properties['pre_webhook_url']
190
+ end
191
+
192
+ ##
193
+ # @return [String] The absolute url the post-event webhook request should be sent to.
194
+ def post_webhook_url
195
+ @properties['post_webhook_url']
196
+ end
197
+
198
+ ##
199
+ # @return [Array[String]] The list of webhook event triggers that are enabled for this Service.
200
+ def filters
201
+ @properties['filters']
202
+ end
203
+
204
+ ##
205
+ # @return [webhook.Method] The HTTP method to be used when sending a webhook request
206
+ def method
207
+ @properties['method']
208
+ end
209
+
210
+ ##
211
+ # @return [String] An absolute URL for this webhook.
212
+ def url
213
+ @properties['url']
214
+ end
215
+
216
+ ##
217
+ # Update the WebhookInstance
218
+ # @param [String] pre_webhook_url The absolute url the pre-event webhook request
219
+ # should be sent to.
220
+ # @param [String] post_webhook_url The absolute url the post-event webhook request
221
+ # should be sent to.
222
+ # @param [Array[String]] filters The list of webhook event triggers that are
223
+ # enabled for this Service. Possible values are `onParticipantAdd`,
224
+ # `onParticipantAdded`, `onDeliveryUpdated`, `onConversationUpdated`,
225
+ # `onConversationRemove`, `onParticipantRemove`, `onConversationUpdate`,
226
+ # `onMessageAdd`, `onMessageRemoved`, `onParticipantUpdated`,
227
+ # `onConversationAdded`, `onMessageAdded`, `onConversationAdd`,
228
+ # `onConversationRemoved`, `onParticipantUpdate`, `onMessageRemove`,
229
+ # `onMessageUpdated`, `onParticipantRemoved`, `onMessageUpdate` or
230
+ # `onConversationStateUpdated`.
231
+ # @param [String] method The HTTP method to be used when sending a webhook
232
+ # request. One of `GET` or `POST`.
233
+ # @return [WebhookInstance] Updated WebhookInstance
234
+ def update(pre_webhook_url: :unset, post_webhook_url: :unset, filters: :unset, method: :unset)
235
+ context.update(
236
+ pre_webhook_url: pre_webhook_url,
237
+ post_webhook_url: post_webhook_url,
238
+ filters: filters,
239
+ method: method,
240
+ )
241
+ end
242
+
243
+ ##
244
+ # Fetch the WebhookInstance
245
+ # @return [WebhookInstance] Fetched WebhookInstance
246
+ def fetch
247
+ context.fetch
248
+ end
249
+
250
+ ##
251
+ # Provide a user friendly representation
252
+ def to_s
253
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
254
+ "<Twilio.Conversations.V1.WebhookInstance #{values}>"
255
+ end
256
+
257
+ ##
258
+ # Provide a detailed, user friendly representation
259
+ def inspect
260
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
261
+ "<Twilio.Conversations.V1.WebhookInstance #{values}>"
262
+ end
263
+ end
264
+ end
265
+ end
266
+ end
267
+ end
268
+ end
269
+ end
@@ -77,6 +77,7 @@ module Twilio
77
77
 
78
78
  # Components
79
79
  @notifications = nil
80
+ @webhooks = nil
80
81
  end
81
82
 
82
83
  ##
@@ -127,6 +128,13 @@ module Twilio
127
128
  return NotificationContext.new(@version, @solution[:chat_service_sid], )
128
129
  end
129
130
 
131
+ ##
132
+ # Access the webhooks
133
+ # @return [WebhookContext] WebhookContext
134
+ def webhooks
135
+ return WebhookContext.new(@version, @solution[:chat_service_sid], )
136
+ end
137
+
130
138
  ##
131
139
  # Provide a user friendly representation
132
140
  def to_s
@@ -168,6 +168,8 @@ module Twilio
168
168
  'markdown' => payload['markdown'],
169
169
  'url' => payload['url'],
170
170
  'flex_insights_hr' => payload['flex_insights_hr'],
171
+ 'flex_insights_drilldown' => payload['flex_insights_drilldown'],
172
+ 'flex_url' => payload['flex_url'],
171
173
  }
172
174
 
173
175
  # Context
@@ -426,6 +428,18 @@ module Twilio
426
428
  @properties['flex_insights_hr']
427
429
  end
428
430
 
431
+ ##
432
+ # @return [Boolean] Setting to enable Flex UI redirection
433
+ def flex_insights_drilldown
434
+ @properties['flex_insights_drilldown']
435
+ end
436
+
437
+ ##
438
+ # @return [String] URL to redirect to in case drilldown is enabled.
439
+ def flex_url
440
+ @properties['flex_url']
441
+ end
442
+
429
443
  ##
430
444
  # Fetch the ConfigurationInstance
431
445
  # @param [String] ui_version The Pinned UI version of the Configuration resource
@@ -94,10 +94,19 @@ module Twilio
94
94
  # @param [String] avatar The avatar URL which will be shown in Frontline
95
95
  # application.
96
96
  # @param [user.StateType] state Current state of this user. Can be either `active`
97
- # or `deactivated` and defaults to `active`
97
+ # or `deactivated`.
98
+ # @param [Boolean] is_available Whether the User is available for new
99
+ # conversations. Set to `false` to prevent User from receiving new inbound
100
+ # conversations if you are using {Pool
101
+ # Routing}[https://www.twilio.com/docs/frontline/handle-incoming-conversations#3-pool-routing].
98
102
  # @return [UserInstance] Updated UserInstance
99
- def update(friendly_name: :unset, avatar: :unset, state: :unset)
100
- data = Twilio::Values.of({'FriendlyName' => friendly_name, 'Avatar' => avatar, 'State' => state, })
103
+ def update(friendly_name: :unset, avatar: :unset, state: :unset, is_available: :unset)
104
+ data = Twilio::Values.of({
105
+ 'FriendlyName' => friendly_name,
106
+ 'Avatar' => avatar,
107
+ 'State' => state,
108
+ 'IsAvailable' => is_available,
109
+ })
101
110
 
102
111
  payload = @version.update('POST', @uri, data: data)
103
112
 
@@ -139,6 +148,7 @@ module Twilio
139
148
  'friendly_name' => payload['friendly_name'],
140
149
  'avatar' => payload['avatar'],
141
150
  'state' => payload['state'],
151
+ 'is_available' => payload['is_available'],
142
152
  'url' => payload['url'],
143
153
  }
144
154
 
@@ -188,6 +198,12 @@ module Twilio
188
198
  @properties['state']
189
199
  end
190
200
 
201
+ ##
202
+ # @return [Boolean] Whether the User is available for new conversations
203
+ def is_available
204
+ @properties['is_available']
205
+ end
206
+
191
207
  ##
192
208
  # @return [String] An absolute URL for this user.
193
209
  def url
@@ -207,10 +223,19 @@ module Twilio
207
223
  # @param [String] avatar The avatar URL which will be shown in Frontline
208
224
  # application.
209
225
  # @param [user.StateType] state Current state of this user. Can be either `active`
210
- # or `deactivated` and defaults to `active`
226
+ # or `deactivated`.
227
+ # @param [Boolean] is_available Whether the User is available for new
228
+ # conversations. Set to `false` to prevent User from receiving new inbound
229
+ # conversations if you are using {Pool
230
+ # Routing}[https://www.twilio.com/docs/frontline/handle-incoming-conversations#3-pool-routing].
211
231
  # @return [UserInstance] Updated UserInstance
212
- def update(friendly_name: :unset, avatar: :unset, state: :unset)
213
- context.update(friendly_name: friendly_name, avatar: avatar, state: state, )
232
+ def update(friendly_name: :unset, avatar: :unset, state: :unset, is_available: :unset)
233
+ context.update(
234
+ friendly_name: friendly_name,
235
+ avatar: avatar,
236
+ state: state,
237
+ is_available: is_available,
238
+ )
214
239
  end
215
240
 
216
241
  ##
@@ -166,6 +166,54 @@ module Twilio
166
166
  end
167
167
  end
168
168
 
169
+ ##
170
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
171
+ class BrandVettingContext < InstanceContext
172
+ ##
173
+ # Initialize the BrandVettingContext
174
+ # @param [Version] version Version that contains the resource
175
+ # @param [String] brand_sid The SID of the Brand Registration resource of the
176
+ # vettings to read .
177
+ # @param [String] brand_vetting_sid The Twilio SID of the third-party vetting
178
+ # record.
179
+ # @return [BrandVettingContext] BrandVettingContext
180
+ def initialize(version, brand_sid, brand_vetting_sid)
181
+ super(version)
182
+
183
+ # Path Solution
184
+ @solution = {brand_sid: brand_sid, brand_vetting_sid: brand_vetting_sid, }
185
+ @uri = "/a2p/BrandRegistrations/#{@solution[:brand_sid]}/Vettings/#{@solution[:brand_vetting_sid]}"
186
+ end
187
+
188
+ ##
189
+ # Fetch the BrandVettingInstance
190
+ # @return [BrandVettingInstance] Fetched BrandVettingInstance
191
+ def fetch
192
+ payload = @version.fetch('GET', @uri)
193
+
194
+ BrandVettingInstance.new(
195
+ @version,
196
+ payload,
197
+ brand_sid: @solution[:brand_sid],
198
+ brand_vetting_sid: @solution[:brand_vetting_sid],
199
+ )
200
+ end
201
+
202
+ ##
203
+ # Provide a user friendly representation
204
+ def to_s
205
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
206
+ "#<Twilio.Messaging.V1.BrandVettingContext #{context}>"
207
+ end
208
+
209
+ ##
210
+ # Provide a detailed, user friendly representation
211
+ def inspect
212
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
213
+ "#<Twilio.Messaging.V1.BrandVettingContext #{context}>"
214
+ end
215
+ end
216
+
169
217
  ##
170
218
  # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
171
219
  class BrandVettingInstance < InstanceResource
@@ -174,8 +222,10 @@ module Twilio
174
222
  # @param [Version] version Version that contains the resource
175
223
  # @param [Hash] payload payload that contains response from Twilio
176
224
  # @param [String] brand_sid The unique string to identify Brand Registration.
225
+ # @param [String] brand_vetting_sid The Twilio SID of the third-party vetting
226
+ # record.
177
227
  # @return [BrandVettingInstance] BrandVettingInstance
178
- def initialize(version, payload, brand_sid: nil)
228
+ def initialize(version, payload, brand_sid: nil, brand_vetting_sid: nil)
179
229
  super(version)
180
230
 
181
231
  # Marshaled Properties
@@ -191,6 +241,28 @@ module Twilio
191
241
  'vetting_provider' => payload['vetting_provider'],
192
242
  'url' => payload['url'],
193
243
  }
244
+
245
+ # Context
246
+ @instance_context = nil
247
+ @params = {
248
+ 'brand_sid' => brand_sid,
249
+ 'brand_vetting_sid' => brand_vetting_sid || @properties['brand_vetting_sid'],
250
+ }
251
+ end
252
+
253
+ ##
254
+ # Generate an instance context for the instance, the context is capable of
255
+ # performing various actions. All instance actions are proxied to the context
256
+ # @return [BrandVettingContext] BrandVettingContext for this BrandVettingInstance
257
+ def context
258
+ unless @instance_context
259
+ @instance_context = BrandVettingContext.new(
260
+ @version,
261
+ @params['brand_sid'],
262
+ @params['brand_vetting_sid'],
263
+ )
264
+ end
265
+ @instance_context
194
266
  end
195
267
 
196
268
  ##
@@ -253,16 +325,25 @@ module Twilio
253
325
  @properties['url']
254
326
  end
255
327
 
328
+ ##
329
+ # Fetch the BrandVettingInstance
330
+ # @return [BrandVettingInstance] Fetched BrandVettingInstance
331
+ def fetch
332
+ context.fetch
333
+ end
334
+
256
335
  ##
257
336
  # Provide a user friendly representation
258
337
  def to_s
259
- "<Twilio.Messaging.V1.BrandVettingInstance>"
338
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
339
+ "<Twilio.Messaging.V1.BrandVettingInstance #{values}>"
260
340
  end
261
341
 
262
342
  ##
263
343
  # Provide a detailed, user friendly representation
264
344
  def inspect
265
- "<Twilio.Messaging.V1.BrandVettingInstance>"
345
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
346
+ "<Twilio.Messaging.V1.BrandVettingInstance #{values}>"
266
347
  end
267
348
  end
268
349
  end
@@ -201,8 +201,14 @@ module Twilio
201
201
  ##
202
202
  # Access the brand_vettings
203
203
  # @return [BrandVettingList]
204
- # @return [BrandVettingContext]
205
- def brand_vettings
204
+ # @return [BrandVettingContext] if brand_vetting_sid was passed.
205
+ def brand_vettings(brand_vetting_sid=:unset)
206
+ raise ArgumentError, 'brand_vetting_sid cannot be nil' if brand_vetting_sid.nil?
207
+
208
+ if brand_vetting_sid != :unset
209
+ return BrandVettingContext.new(@version, @solution[:sid], brand_vetting_sid, )
210
+ end
211
+
206
212
  unless @brand_vettings
207
213
  @brand_vettings = BrandVettingList.new(@version, brand_sid: @solution[:sid], )
208
214
  end