twilio-ruby 5.52.0 → 5.67.3

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.
Files changed (163) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/pr-lint.yml +15 -0
  3. data/.github/workflows/test-and-deploy.yml +129 -0
  4. data/.gitignore +5 -1
  5. data/.rubocop.yml +1 -1
  6. data/.rubocop_todo.yml +91 -28
  7. data/CHANGES.md +563 -0
  8. data/Gemfile +1 -0
  9. data/Makefile +8 -11
  10. data/README.md +13 -6
  11. data/examples/examples.rb +1 -1
  12. data/lib/rack/twilio_webhook_authentication.rb +25 -1
  13. data/lib/twilio-ruby/http/http_client.rb +20 -4
  14. data/lib/twilio-ruby/http.rb +5 -0
  15. data/lib/twilio-ruby/jwt/access_token.rb +13 -0
  16. data/lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb +23 -23
  17. data/lib/twilio-ruby/rest/api/v2010/account/call/feedback_summary.rb +5 -5
  18. data/lib/twilio-ruby/rest/api/v2010/account/call/payment.rb +8 -8
  19. data/lib/twilio-ruby/rest/api/v2010/account/call/siprec.rb +674 -0
  20. data/lib/twilio-ruby/rest/api/v2010/account/call/stream.rb +674 -0
  21. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +68 -14
  22. data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +12 -8
  23. data/lib/twilio-ruby/rest/api/v2010/account/conference/recording.rb +1 -1
  24. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/local.rb +11 -4
  25. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/mobile.rb +11 -4
  26. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/toll_free.rb +11 -4
  27. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb +17 -10
  28. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +18 -5
  29. data/lib/twilio-ruby/rest/api/v2010/account/recording.rb +34 -7
  30. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/credential_list_mapping.rb +11 -11
  31. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.rb +11 -11
  32. data/lib/twilio-ruby/rest/bulkexports/v1/export/day.rb +0 -8
  33. data/lib/twilio-ruby/rest/bulkexports/v1/export/export_custom_job.rb +0 -6
  34. data/lib/twilio-ruby/rest/bulkexports/v1/export/job.rb +0 -8
  35. data/lib/twilio-ruby/rest/bulkexports/v1/export.rb +0 -8
  36. data/lib/twilio-ruby/rest/bulkexports/v1/export_configuration.rb +0 -8
  37. data/lib/twilio-ruby/rest/chat/v2/service/user/user_channel.rb +10 -4
  38. data/lib/twilio-ruby/rest/chat/v3/channel.rb +275 -0
  39. data/lib/twilio-ruby/rest/chat/v3.rb +48 -0
  40. data/lib/twilio-ruby/rest/chat.rb +16 -0
  41. data/lib/twilio-ruby/rest/client.rb +21 -12
  42. data/lib/twilio-ruby/rest/conversations/v1/address_configuration.rb +454 -0
  43. data/lib/twilio-ruby/rest/conversations/v1/conversation/message.rb +12 -5
  44. data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +7 -0
  45. data/lib/twilio-ruby/rest/conversations/v1/participant_conversation.rb +312 -0
  46. data/lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb +18 -2
  47. data/lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb +269 -0
  48. data/lib/twilio-ruby/rest/conversations/v1/service/configuration.rb +8 -0
  49. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb +12 -5
  50. data/lib/twilio-ruby/rest/conversations/v1/service/conversation.rb +7 -0
  51. data/lib/twilio-ruby/rest/conversations/v1/service/participant_conversation.rb +324 -0
  52. data/lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb +466 -0
  53. data/lib/twilio-ruby/rest/conversations/v1/service/user.rb +44 -0
  54. data/lib/twilio-ruby/rest/conversations/v1/service.rb +23 -0
  55. data/lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb +442 -0
  56. data/lib/twilio-ruby/rest/conversations/v1/user.rb +35 -0
  57. data/lib/twilio-ruby/rest/conversations/v1.rb +24 -0
  58. data/lib/twilio-ruby/rest/conversations.rb +15 -0
  59. data/lib/twilio-ruby/rest/events/v1/event_type.rb +12 -5
  60. data/lib/twilio-ruby/rest/events/v1/sink.rb +41 -5
  61. data/lib/twilio-ruby/rest/flex_api/v1/configuration.rb +28 -0
  62. data/lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb +55 -34
  63. data/lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_invite.rb +236 -0
  64. data/lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_participant.rb +330 -0
  65. data/lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb +384 -0
  66. data/lib/twilio-ruby/rest/flex_api/v1/interaction.rb +233 -0
  67. data/lib/twilio-ruby/rest/flex_api/v1.rb +16 -0
  68. data/lib/twilio-ruby/rest/flex_api.rb +9 -0
  69. data/lib/twilio-ruby/rest/frontline_api/v1/user.rb +258 -0
  70. data/lib/twilio-ruby/rest/{fax → frontline_api}/v1.rb +11 -11
  71. data/lib/twilio-ruby/rest/{fax.rb → frontline_api.rb} +11 -11
  72. data/lib/twilio-ruby/rest/insights/v1/annotation.rb +271 -0
  73. data/lib/twilio-ruby/rest/insights/v1/call_summaries.rb +434 -0
  74. data/lib/twilio-ruby/rest/insights/v1/conference/conference_participant.rb +474 -0
  75. data/lib/twilio-ruby/rest/insights/v1/conference.rb +512 -0
  76. data/lib/twilio-ruby/rest/insights/v1/setting.rb +215 -0
  77. data/lib/twilio-ruby/rest/insights/v1.rb +46 -0
  78. data/lib/twilio-ruby/rest/insights.rb +28 -0
  79. data/lib/twilio-ruby/rest/lookups/v2/phone_number.rb +268 -0
  80. data/lib/twilio-ruby/rest/lookups/v2.rb +45 -0
  81. data/lib/twilio-ruby/rest/lookups.rb +7 -0
  82. data/lib/twilio-ruby/rest/media/v1/media_processor.rb +397 -0
  83. data/lib/twilio-ruby/rest/media/v1/media_recording.rb +406 -0
  84. data/lib/twilio-ruby/rest/media/v1/player_streamer/playback_grant.rb +221 -0
  85. data/lib/twilio-ruby/rest/media/v1/player_streamer.rb +403 -0
  86. data/lib/twilio-ruby/rest/media/v1.rb +76 -0
  87. data/lib/twilio-ruby/rest/media.rb +65 -0
  88. data/lib/twilio-ruby/rest/{fax/v1/fax/fax_media.rb → messaging/v1/brand_registration/brand_vetting.rb} +134 -95
  89. data/lib/twilio-ruby/rest/messaging/v1/brand_registration.rb +127 -2
  90. data/lib/twilio-ruby/rest/messaging/v1/external_campaign.rb +7 -0
  91. data/lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb +187 -20
  92. data/lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person_usecase.rb +6 -2
  93. data/lib/twilio-ruby/rest/messaging/v1/service.rb +37 -5
  94. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.rb +268 -0
  95. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/replace_items.rb +188 -0
  96. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb +128 -26
  97. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/supporting_document.rb +7 -0
  98. data/lib/twilio-ruby/rest/pricing/v2/country.rb +280 -0
  99. data/lib/twilio-ruby/rest/pricing/v2/number.rb +225 -0
  100. data/lib/twilio-ruby/rest/pricing/v2.rb +37 -0
  101. data/lib/twilio-ruby/rest/pricing.rb +19 -0
  102. data/lib/twilio-ruby/rest/serverless/v1/service/environment.rb +1 -1
  103. data/lib/twilio-ruby/rest/serverless/v1/service.rb +7 -0
  104. data/lib/twilio-ruby/rest/studio/v1/flow/execution.rb +1 -1
  105. data/lib/twilio-ruby/rest/studio/v2/flow/execution.rb +1 -1
  106. data/lib/twilio-ruby/rest/supersim/v1/esim_profile.rb +372 -0
  107. data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +44 -55
  108. data/lib/twilio-ruby/rest/supersim/v1/{command.rb → ip_command.rb} +132 -84
  109. data/lib/twilio-ruby/rest/supersim/v1/sim/billing_period.rb +231 -0
  110. data/lib/twilio-ruby/rest/supersim/v1/sim.rb +30 -1
  111. data/lib/twilio-ruby/rest/supersim/v1/sms_command.rb +1 -1
  112. data/lib/twilio-ruby/rest/supersim/v1/usage_record.rb +23 -9
  113. data/lib/twilio-ruby/rest/supersim/v1.rb +23 -7
  114. data/lib/twilio-ruby/rest/supersim.rb +15 -6
  115. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb +7 -0
  116. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task/reservation.rb +7 -3
  117. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.rb +6 -2
  118. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb +7 -3
  119. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb +23 -11
  120. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.rb +4 -2
  121. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb +4 -2
  122. data/lib/twilio-ruby/rest/taskrouter/v1/workspace.rb +38 -22
  123. data/lib/twilio-ruby/rest/trunking/v1/trunk.rb +19 -3
  124. data/lib/twilio-ruby/rest/verify/v2/service/access_token.rb +155 -10
  125. data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge/notification.rb +12 -9
  126. data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb +74 -22
  127. data/lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb +34 -15
  128. data/lib/twilio-ruby/rest/verify/v2/service/entity/new_factor.rb +66 -31
  129. data/lib/twilio-ruby/rest/verify/v2/service/entity.rb +7 -3
  130. data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +25 -7
  131. data/lib/twilio-ruby/rest/verify/v2/service/webhook.rb +24 -5
  132. data/lib/twilio-ruby/rest/verify/v2/service.rb +40 -11
  133. data/lib/twilio-ruby/rest/verify/v2/template.rb +206 -0
  134. data/lib/twilio-ruby/rest/verify/v2/verification_attempt.rb +89 -21
  135. data/lib/twilio-ruby/rest/verify/v2/verification_attempts_summary.rb +234 -0
  136. data/lib/twilio-ruby/rest/verify/v2.rb +14 -0
  137. data/lib/twilio-ruby/rest/verify.rb +14 -2
  138. data/lib/twilio-ruby/rest/video/v1/composition.rb +21 -8
  139. data/lib/twilio-ruby/rest/video/v1/composition_hook.rb +0 -8
  140. data/lib/twilio-ruby/rest/video/v1/recording.rb +21 -0
  141. data/lib/twilio-ruby/rest/video/v1/room/recording.rb +7 -0
  142. data/lib/twilio-ruby/rest/video/v1/room.rb +62 -5
  143. data/lib/twilio-ruby/rest/voice/v1/archived_call.rb +184 -0
  144. data/lib/twilio-ruby/rest/voice/v1.rb +21 -0
  145. data/lib/twilio-ruby/rest/voice.rb +8 -0
  146. data/lib/twilio-ruby/rest/wireless/v1/rate_plan.rb +3 -3
  147. data/lib/twilio-ruby/rest/wireless/v1/sim.rb +16 -26
  148. data/lib/twilio-ruby/rest.rb +13 -0
  149. data/lib/twilio-ruby/twiml/voice_response.rb +727 -87
  150. data/lib/twilio-ruby/version.rb +1 -1
  151. data/lib/twilio-ruby.rb +6 -16
  152. data/sonar-project.properties +13 -0
  153. data/twilio-ruby.gemspec +1 -2
  154. metadata +59 -32
  155. data/.travis.yml +0 -45
  156. data/lib/twilio-ruby/rest/fax/v1/fax.rb +0 -536
  157. /data/lib/twilio-ruby/framework/{domain.rb → rest/domain.rb} +0 -0
  158. /data/lib/twilio-ruby/framework/{error.rb → rest/error.rb} +0 -0
  159. /data/lib/twilio-ruby/framework/{helper.rb → rest/helper.rb} +0 -0
  160. /data/lib/twilio-ruby/framework/{obsolete_client.rb → rest/obsolete_client.rb} +0 -0
  161. /data/lib/twilio-ruby/framework/{page.rb → rest/page.rb} +0 -0
  162. /data/lib/twilio-ruby/framework/{resource.rb → rest/resource.rb} +0 -0
  163. /data/lib/twilio-ruby/framework/{version.rb → rest/version.rb} +0 -0
@@ -33,8 +33,8 @@ module Twilio
33
33
  # Create the UsAppToPersonInstance
34
34
  # @param [String] brand_registration_sid A2P Brand Registration SID
35
35
  # @param [String] description A short description of what this SMS campaign does.
36
- # @param [Array[String]] message_samples Message samples, up to 5 sample messages,
37
- # <=1024 chars each.
36
+ # @param [Array[String]] message_samples Message samples, at least 2 and up to 5
37
+ # sample messages, <=1024 chars each.
38
38
  # @param [String] us_app_to_person_usecase A2P Campaign Use Case. Examples: [ 2FA,
39
39
  # EMERGENCY, MARKETING..]
40
40
  # @param [Boolean] has_embedded_links Indicates that this SMS campaign will send
@@ -62,23 +62,83 @@ module Twilio
62
62
  end
63
63
 
64
64
  ##
65
- # Delete the UsAppToPersonInstance
66
- # @return [Boolean] true if delete succeeds, false otherwise
67
- def delete
68
- @version.delete('DELETE', @uri)
65
+ # Lists UsAppToPersonInstance records from the API as a list.
66
+ # Unlike stream(), this operation is eager and will load `limit` records into
67
+ # memory before returning.
68
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
69
+ # guarantees to never return more than limit. Default is no limit
70
+ # @param [Integer] page_size Number of records to fetch per request, when
71
+ # not set will use the default value of 50 records. If no page_size is defined
72
+ # but a limit is defined, stream() will attempt to read the limit with the most
73
+ # efficient page size, i.e. min(limit, 1000)
74
+ # @return [Array] Array of up to limit results
75
+ def list(limit: nil, page_size: nil)
76
+ self.stream(limit: limit, page_size: page_size).entries
69
77
  end
70
78
 
71
79
  ##
72
- # Fetch the UsAppToPersonInstance
73
- # @return [UsAppToPersonInstance] Fetched UsAppToPersonInstance
74
- def fetch
75
- payload = @version.fetch('GET', @uri)
80
+ # Streams UsAppToPersonInstance records from the API as an Enumerable.
81
+ # This operation lazily loads records as efficiently as possible until the limit
82
+ # is reached.
83
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
84
+ # guarantees to never return more than limit. Default is no limit.
85
+ # @param [Integer] page_size Number of records to fetch per request, when
86
+ # not set will use the default value of 50 records. If no page_size is defined
87
+ # but a limit is defined, stream() will attempt to read the limit with the most
88
+ # efficient page size, i.e. min(limit, 1000)
89
+ # @return [Enumerable] Enumerable that will yield up to limit results
90
+ def stream(limit: nil, page_size: nil)
91
+ limits = @version.read_limits(limit, page_size)
92
+
93
+ page = self.page(page_size: limits[:page_size], )
94
+
95
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
96
+ end
76
97
 
77
- UsAppToPersonInstance.new(
78
- @version,
79
- payload,
80
- messaging_service_sid: @solution[:messaging_service_sid],
98
+ ##
99
+ # When passed a block, yields UsAppToPersonInstance records from the API.
100
+ # This operation lazily loads records as efficiently as possible until the limit
101
+ # is reached.
102
+ def each
103
+ limits = @version.read_limits
104
+
105
+ page = self.page(page_size: limits[:page_size], )
106
+
107
+ @version.stream(page,
108
+ limit: limits[:limit],
109
+ page_limit: limits[:page_limit]).each {|x| yield x}
110
+ end
111
+
112
+ ##
113
+ # Retrieve a single page of UsAppToPersonInstance records from the API.
114
+ # Request is executed immediately.
115
+ # @param [String] page_token PageToken provided by the API
116
+ # @param [Integer] page_number Page Number, this value is simply for client state
117
+ # @param [Integer] page_size Number of records to return, defaults to 50
118
+ # @return [Page] Page of UsAppToPersonInstance
119
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
120
+ params = Twilio::Values.of({
121
+ 'PageToken' => page_token,
122
+ 'Page' => page_number,
123
+ 'PageSize' => page_size,
124
+ })
125
+
126
+ response = @version.page('GET', @uri, params: params)
127
+
128
+ UsAppToPersonPage.new(@version, response, @solution)
129
+ end
130
+
131
+ ##
132
+ # Retrieve a single page of UsAppToPersonInstance records from the API.
133
+ # Request is executed immediately.
134
+ # @param [String] target_url API-generated URL for the requested results page
135
+ # @return [Page] Page of UsAppToPersonInstance
136
+ def get_page(target_url)
137
+ response = @version.domain.request(
138
+ 'GET',
139
+ target_url
81
140
  )
141
+ UsAppToPersonPage.new(@version, response, @solution)
82
142
  end
83
143
 
84
144
  ##
@@ -123,6 +183,62 @@ module Twilio
123
183
  end
124
184
  end
125
185
 
186
+ ##
187
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
188
+ class UsAppToPersonContext < InstanceContext
189
+ ##
190
+ # Initialize the UsAppToPersonContext
191
+ # @param [Version] version Version that contains the resource
192
+ # @param [String] messaging_service_sid The SID of the {Messaging
193
+ # Service}[https://www.twilio.com/docs/messaging/services/api] to fetch the
194
+ # resource from.
195
+ # @param [String] sid The SID of the US A2P Compliance resource to fetch
196
+ # `QE2c6890da8086d771620e9b13fadeba0b`.
197
+ # @return [UsAppToPersonContext] UsAppToPersonContext
198
+ def initialize(version, messaging_service_sid, sid)
199
+ super(version)
200
+
201
+ # Path Solution
202
+ @solution = {messaging_service_sid: messaging_service_sid, sid: sid, }
203
+ @uri = "/Services/#{@solution[:messaging_service_sid]}/Compliance/Usa2p/#{@solution[:sid]}"
204
+ end
205
+
206
+ ##
207
+ # Delete the UsAppToPersonInstance
208
+ # @return [Boolean] true if delete succeeds, false otherwise
209
+ def delete
210
+ @version.delete('DELETE', @uri)
211
+ end
212
+
213
+ ##
214
+ # Fetch the UsAppToPersonInstance
215
+ # @return [UsAppToPersonInstance] Fetched UsAppToPersonInstance
216
+ def fetch
217
+ payload = @version.fetch('GET', @uri)
218
+
219
+ UsAppToPersonInstance.new(
220
+ @version,
221
+ payload,
222
+ messaging_service_sid: @solution[:messaging_service_sid],
223
+ sid: @solution[:sid],
224
+ )
225
+ end
226
+
227
+ ##
228
+ # Provide a user friendly representation
229
+ def to_s
230
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
231
+ "#<Twilio.Messaging.V1.UsAppToPersonContext #{context}>"
232
+ end
233
+
234
+ ##
235
+ # Provide a detailed, user friendly representation
236
+ def inspect
237
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
238
+ "#<Twilio.Messaging.V1.UsAppToPersonContext #{context}>"
239
+ end
240
+ end
241
+
126
242
  ##
127
243
  # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
128
244
  class UsAppToPersonInstance < InstanceResource
@@ -133,12 +249,15 @@ module Twilio
133
249
  # @param [String] messaging_service_sid The SID of the {Messaging
134
250
  # Service}[https://www.twilio.com/docs/messaging/services/api] that the resource
135
251
  # is associated with.
252
+ # @param [String] sid The SID of the US A2P Compliance resource to fetch
253
+ # `QE2c6890da8086d771620e9b13fadeba0b`.
136
254
  # @return [UsAppToPersonInstance] UsAppToPersonInstance
137
- def initialize(version, payload, messaging_service_sid: nil)
255
+ def initialize(version, payload, messaging_service_sid: nil, sid: nil)
138
256
  super(version)
139
257
 
140
258
  # Marshaled Properties
141
259
  @properties = {
260
+ 'sid' => payload['sid'],
142
261
  'account_sid' => payload['account_sid'],
143
262
  'brand_registration_sid' => payload['brand_registration_sid'],
144
263
  'messaging_service_sid' => payload['messaging_service_sid'],
@@ -147,14 +266,40 @@ module Twilio
147
266
  'us_app_to_person_usecase' => payload['us_app_to_person_usecase'],
148
267
  'has_embedded_links' => payload['has_embedded_links'],
149
268
  'has_embedded_phone' => payload['has_embedded_phone'],
150
- 'status' => payload['status'],
269
+ 'campaign_status' => payload['campaign_status'],
151
270
  'campaign_id' => payload['campaign_id'],
152
271
  'is_externally_registered' => payload['is_externally_registered'],
153
272
  'rate_limits' => payload['rate_limits'],
154
273
  'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
155
274
  'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
156
275
  'url' => payload['url'],
276
+ 'mock' => payload['mock'],
157
277
  }
278
+
279
+ # Context
280
+ @instance_context = nil
281
+ @params = {'messaging_service_sid' => messaging_service_sid, 'sid' => sid || @properties['sid'], }
282
+ end
283
+
284
+ ##
285
+ # Generate an instance context for the instance, the context is capable of
286
+ # performing various actions. All instance actions are proxied to the context
287
+ # @return [UsAppToPersonContext] UsAppToPersonContext for this UsAppToPersonInstance
288
+ def context
289
+ unless @instance_context
290
+ @instance_context = UsAppToPersonContext.new(
291
+ @version,
292
+ @params['messaging_service_sid'],
293
+ @params['sid'],
294
+ )
295
+ end
296
+ @instance_context
297
+ end
298
+
299
+ ##
300
+ # @return [String] The unique string that identifies a US A2P Compliance resource
301
+ def sid
302
+ @properties['sid']
158
303
  end
159
304
 
160
305
  ##
@@ -207,8 +352,8 @@ module Twilio
207
352
 
208
353
  ##
209
354
  # @return [String] Campaign status
210
- def status
211
- @properties['status']
355
+ def campaign_status
356
+ @properties['campaign_status']
212
357
  end
213
358
 
214
359
  ##
@@ -247,16 +392,38 @@ module Twilio
247
392
  @properties['url']
248
393
  end
249
394
 
395
+ ##
396
+ # @return [Boolean] A boolean that specifies whether campaign is a mock or not.
397
+ def mock
398
+ @properties['mock']
399
+ end
400
+
401
+ ##
402
+ # Delete the UsAppToPersonInstance
403
+ # @return [Boolean] true if delete succeeds, false otherwise
404
+ def delete
405
+ context.delete
406
+ end
407
+
408
+ ##
409
+ # Fetch the UsAppToPersonInstance
410
+ # @return [UsAppToPersonInstance] Fetched UsAppToPersonInstance
411
+ def fetch
412
+ context.fetch
413
+ end
414
+
250
415
  ##
251
416
  # Provide a user friendly representation
252
417
  def to_s
253
- "<Twilio.Messaging.V1.UsAppToPersonInstance>"
418
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
419
+ "<Twilio.Messaging.V1.UsAppToPersonInstance #{values}>"
254
420
  end
255
421
 
256
422
  ##
257
423
  # Provide a detailed, user friendly representation
258
424
  def inspect
259
- "<Twilio.Messaging.V1.UsAppToPersonInstance>"
425
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
426
+ "<Twilio.Messaging.V1.UsAppToPersonInstance #{values}>"
260
427
  end
261
428
  end
262
429
  end
@@ -30,9 +30,13 @@ module Twilio
30
30
 
31
31
  ##
32
32
  # Fetch the UsAppToPersonUsecaseInstance
33
+ # @param [String] brand_registration_sid The unique string to identify the A2P
34
+ # brand.
33
35
  # @return [UsAppToPersonUsecaseInstance] Fetched UsAppToPersonUsecaseInstance
34
- def fetch
35
- payload = @version.fetch('GET', @uri)
36
+ def fetch(brand_registration_sid: :unset)
37
+ params = Twilio::Values.of({'BrandRegistrationSid' => brand_registration_sid, })
38
+
39
+ payload = @version.fetch('GET', @uri, params: params)
36
40
 
37
41
  UsAppToPersonUsecaseInstance.new(
38
42
  @version,
@@ -67,6 +67,9 @@ module Twilio
67
67
  # @param [String] validity_period How long, in seconds, messages sent from the
68
68
  # Service are valid. Can be an integer from `1` to `14,400`.
69
69
  # @param [Boolean] synchronous_validation Reserved.
70
+ # @param [String] usecase A string that describes the scenario in which the
71
+ # Messaging Service will be used. Examples: [notification, marketing,
72
+ # verification, poll ..].
70
73
  # @param [Boolean] use_inbound_webhook_on_number A boolean value that indicates
71
74
  # either the webhook url configured on the phone number will be used or
72
75
  # `inbound_request_url`/`fallback_url` url will be called when a message is
@@ -74,7 +77,7 @@ module Twilio
74
77
  # defined on the phone number will override the
75
78
  # `inbound_request_url`/`fallback_url` defined for the Messaging Service.
76
79
  # @return [ServiceInstance] Created ServiceInstance
77
- def create(friendly_name: nil, inbound_request_url: :unset, inbound_method: :unset, fallback_url: :unset, fallback_method: :unset, status_callback: :unset, sticky_sender: :unset, mms_converter: :unset, smart_encoding: :unset, scan_message_content: :unset, fallback_to_long_code: :unset, area_code_geomatch: :unset, validity_period: :unset, synchronous_validation: :unset, use_inbound_webhook_on_number: :unset)
80
+ def create(friendly_name: nil, inbound_request_url: :unset, inbound_method: :unset, fallback_url: :unset, fallback_method: :unset, status_callback: :unset, sticky_sender: :unset, mms_converter: :unset, smart_encoding: :unset, scan_message_content: :unset, fallback_to_long_code: :unset, area_code_geomatch: :unset, validity_period: :unset, synchronous_validation: :unset, usecase: :unset, use_inbound_webhook_on_number: :unset)
78
81
  data = Twilio::Values.of({
79
82
  'FriendlyName' => friendly_name,
80
83
  'InboundRequestUrl' => inbound_request_url,
@@ -90,6 +93,7 @@ module Twilio
90
93
  'AreaCodeGeomatch' => area_code_geomatch,
91
94
  'ValidityPeriod' => validity_period,
92
95
  'SynchronousValidation' => synchronous_validation,
96
+ 'Usecase' => usecase,
93
97
  'UseInboundWebhookOnNumber' => use_inbound_webhook_on_number,
94
98
  })
95
99
 
@@ -281,6 +285,9 @@ module Twilio
281
285
  # @param [String] validity_period How long, in seconds, messages sent from the
282
286
  # Service are valid. Can be an integer from `1` to `14,400`.
283
287
  # @param [Boolean] synchronous_validation Reserved.
288
+ # @param [String] usecase A string that describes the scenario in which the
289
+ # Messaging Service will be used. Examples: [notification, marketing,
290
+ # verification, poll ..]
284
291
  # @param [Boolean] use_inbound_webhook_on_number A boolean value that indicates
285
292
  # either the webhook url configured on the phone number will be used or
286
293
  # `inbound_request_url`/`fallback_url` url will be called when a message is
@@ -288,7 +295,7 @@ module Twilio
288
295
  # defined on the phone number will override the
289
296
  # `inbound_request_url`/`fallback_url` defined for the Messaging Service.
290
297
  # @return [ServiceInstance] Updated ServiceInstance
291
- def update(friendly_name: :unset, inbound_request_url: :unset, inbound_method: :unset, fallback_url: :unset, fallback_method: :unset, status_callback: :unset, sticky_sender: :unset, mms_converter: :unset, smart_encoding: :unset, scan_message_content: :unset, fallback_to_long_code: :unset, area_code_geomatch: :unset, validity_period: :unset, synchronous_validation: :unset, use_inbound_webhook_on_number: :unset)
298
+ def update(friendly_name: :unset, inbound_request_url: :unset, inbound_method: :unset, fallback_url: :unset, fallback_method: :unset, status_callback: :unset, sticky_sender: :unset, mms_converter: :unset, smart_encoding: :unset, scan_message_content: :unset, fallback_to_long_code: :unset, area_code_geomatch: :unset, validity_period: :unset, synchronous_validation: :unset, usecase: :unset, use_inbound_webhook_on_number: :unset)
292
299
  data = Twilio::Values.of({
293
300
  'FriendlyName' => friendly_name,
294
301
  'InboundRequestUrl' => inbound_request_url,
@@ -304,6 +311,7 @@ module Twilio
304
311
  'AreaCodeGeomatch' => area_code_geomatch,
305
312
  'ValidityPeriod' => validity_period,
306
313
  'SynchronousValidation' => synchronous_validation,
314
+ 'Usecase' => usecase,
307
315
  'UseInboundWebhookOnNumber' => use_inbound_webhook_on_number,
308
316
  })
309
317
 
@@ -385,8 +393,14 @@ module Twilio
385
393
  ##
386
394
  # Access the us_app_to_person
387
395
  # @return [UsAppToPersonList]
388
- # @return [UsAppToPersonContext]
389
- def us_app_to_person
396
+ # @return [UsAppToPersonContext] if sid was passed.
397
+ def us_app_to_person(sid=:unset)
398
+ raise ArgumentError, 'sid cannot be nil' if sid.nil?
399
+
400
+ if sid != :unset
401
+ return UsAppToPersonContext.new(@version, @solution[:sid], sid, )
402
+ end
403
+
390
404
  unless @us_app_to_person
391
405
  @us_app_to_person = UsAppToPersonList.new(@version, messaging_service_sid: @solution[:sid], )
392
406
  end
@@ -458,6 +472,8 @@ module Twilio
458
472
  'validity_period' => payload['validity_period'].to_i,
459
473
  'url' => payload['url'],
460
474
  'links' => payload['links'],
475
+ 'usecase' => payload['usecase'],
476
+ 'us_app_to_person_registered' => payload['us_app_to_person_registered'],
461
477
  'use_inbound_webhook_on_number' => payload['use_inbound_webhook_on_number'],
462
478
  }
463
479
 
@@ -597,6 +613,18 @@ module Twilio
597
613
  @properties['links']
598
614
  end
599
615
 
616
+ ##
617
+ # @return [String] A string describing the scenario in which the Messaging Service will be used
618
+ def usecase
619
+ @properties['usecase']
620
+ end
621
+
622
+ ##
623
+ # @return [Boolean] Whether US A2P campaign is registered for this Service.
624
+ def us_app_to_person_registered
625
+ @properties['us_app_to_person_registered']
626
+ end
627
+
600
628
  ##
601
629
  # @return [Boolean] If enabled, the webhook url configured on the phone number will be used and will override the `inbound_request_url`/`fallback_url` url called when an inbound message is received.
602
630
  def use_inbound_webhook_on_number
@@ -645,6 +673,9 @@ module Twilio
645
673
  # @param [String] validity_period How long, in seconds, messages sent from the
646
674
  # Service are valid. Can be an integer from `1` to `14,400`.
647
675
  # @param [Boolean] synchronous_validation Reserved.
676
+ # @param [String] usecase A string that describes the scenario in which the
677
+ # Messaging Service will be used. Examples: [notification, marketing,
678
+ # verification, poll ..]
648
679
  # @param [Boolean] use_inbound_webhook_on_number A boolean value that indicates
649
680
  # either the webhook url configured on the phone number will be used or
650
681
  # `inbound_request_url`/`fallback_url` url will be called when a message is
@@ -652,7 +683,7 @@ module Twilio
652
683
  # defined on the phone number will override the
653
684
  # `inbound_request_url`/`fallback_url` defined for the Messaging Service.
654
685
  # @return [ServiceInstance] Updated ServiceInstance
655
- def update(friendly_name: :unset, inbound_request_url: :unset, inbound_method: :unset, fallback_url: :unset, fallback_method: :unset, status_callback: :unset, sticky_sender: :unset, mms_converter: :unset, smart_encoding: :unset, scan_message_content: :unset, fallback_to_long_code: :unset, area_code_geomatch: :unset, validity_period: :unset, synchronous_validation: :unset, use_inbound_webhook_on_number: :unset)
686
+ def update(friendly_name: :unset, inbound_request_url: :unset, inbound_method: :unset, fallback_url: :unset, fallback_method: :unset, status_callback: :unset, sticky_sender: :unset, mms_converter: :unset, smart_encoding: :unset, scan_message_content: :unset, fallback_to_long_code: :unset, area_code_geomatch: :unset, validity_period: :unset, synchronous_validation: :unset, usecase: :unset, use_inbound_webhook_on_number: :unset)
656
687
  context.update(
657
688
  friendly_name: friendly_name,
658
689
  inbound_request_url: inbound_request_url,
@@ -668,6 +699,7 @@ module Twilio
668
699
  area_code_geomatch: area_code_geomatch,
669
700
  validity_period: validity_period,
670
701
  synchronous_validation: synchronous_validation,
702
+ usecase: usecase,
671
703
  use_inbound_webhook_on_number: use_inbound_webhook_on_number,
672
704
  )
673
705
  end