twilio-ruby 5.44.0 → 5.47.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (185) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -0
  3. data/CHANGES.md +97 -0
  4. data/LICENSE +1 -1
  5. data/README.md +16 -2
  6. data/lib/twilio-ruby/rest/api/v2010/account/authorized_connect_app.rb +1 -1
  7. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +14 -9
  8. data/lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb +13 -13
  9. data/lib/twilio-ruby/rest/api/v2010/account/call/feedback_summary.rb +1 -1
  10. data/lib/twilio-ruby/rest/api/v2010/account/call/recording.rb +10 -5
  11. data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +17 -12
  12. data/lib/twilio-ruby/rest/api/v2010/account/connect_app.rb +3 -3
  13. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +5 -5
  14. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb +6 -3
  15. data/lib/twilio-ruby/rest/api/v2010/account/token.rb +1 -1
  16. data/lib/twilio-ruby/rest/bulkexports.rb +4 -2
  17. data/lib/twilio-ruby/rest/bulkexports/v1.rb +4 -2
  18. data/lib/twilio-ruby/rest/bulkexports/v1/export.rb +7 -4
  19. data/lib/twilio-ruby/rest/bulkexports/v1/export/day.rb +7 -4
  20. data/lib/twilio-ruby/rest/bulkexports/v1/export/export_custom_job.rb +5 -3
  21. data/lib/twilio-ruby/rest/bulkexports/v1/export/job.rb +5 -3
  22. data/lib/twilio-ruby/rest/bulkexports/v1/export_configuration.rb +5 -3
  23. data/lib/twilio-ruby/rest/chat/v1/service.rb +5 -5
  24. data/lib/twilio-ruby/rest/chat/v1/service/channel.rb +6 -6
  25. data/lib/twilio-ruby/rest/chat/v1/service/channel/invite.rb +3 -3
  26. data/lib/twilio-ruby/rest/chat/v1/service/channel/member.rb +3 -3
  27. data/lib/twilio-ruby/rest/chat/v1/service/role.rb +9 -9
  28. data/lib/twilio-ruby/rest/chat/v2/service.rb +5 -5
  29. data/lib/twilio-ruby/rest/chat/v2/service/binding.rb +7 -7
  30. data/lib/twilio-ruby/rest/chat/v2/service/channel.rb +6 -6
  31. data/lib/twilio-ruby/rest/chat/v2/service/channel/invite.rb +3 -3
  32. data/lib/twilio-ruby/rest/chat/v2/service/channel/member.rb +3 -3
  33. data/lib/twilio-ruby/rest/chat/v2/service/channel/webhook.rb +27 -24
  34. data/lib/twilio-ruby/rest/chat/v2/service/role.rb +9 -9
  35. data/lib/twilio-ruby/rest/chat/v2/service/user/user_binding.rb +10 -10
  36. data/lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb +9 -9
  37. data/lib/twilio-ruby/rest/conversations/v1/conversation/message.rb +1 -1
  38. data/lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb +32 -2
  39. data/lib/twilio-ruby/rest/conversations/v1/conversation/webhook.rb +9 -9
  40. data/lib/twilio-ruby/rest/conversations/v1/role.rb +9 -9
  41. data/lib/twilio-ruby/rest/conversations/v1/service/binding.rb +7 -7
  42. data/lib/twilio-ruby/rest/conversations/v1/service/configuration.rb +17 -2
  43. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb +1 -1
  44. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb +32 -2
  45. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb +9 -9
  46. data/lib/twilio-ruby/rest/conversations/v1/service/role.rb +9 -9
  47. data/lib/twilio-ruby/rest/conversations/v1/service/user.rb +8 -1
  48. data/lib/twilio-ruby/rest/conversations/v1/user.rb +8 -1
  49. data/lib/twilio-ruby/rest/events/v1/sink.rb +4 -2
  50. data/lib/twilio-ruby/rest/events/v1/subscription.rb +3 -2
  51. data/lib/twilio-ruby/rest/flex_api.rb +1 -1
  52. data/lib/twilio-ruby/rest/flex_api/v1.rb +1 -1
  53. data/lib/twilio-ruby/rest/flex_api/v1/channel.rb +5 -5
  54. data/lib/twilio-ruby/rest/flex_api/v1/configuration.rb +18 -4
  55. data/lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb +88 -76
  56. data/lib/twilio-ruby/rest/flex_api/v1/web_channel.rb +2 -2
  57. data/lib/twilio-ruby/rest/insights/v1/call/summary.rb +8 -9
  58. data/lib/twilio-ruby/rest/insights/v1/room.rb +7 -7
  59. data/lib/twilio-ruby/rest/insights/v1/room/participant.rb +1 -1
  60. data/lib/twilio-ruby/rest/ip_messaging/v1/service.rb +3 -3
  61. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb +3 -3
  62. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/invite.rb +3 -3
  63. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/member.rb +3 -3
  64. data/lib/twilio-ruby/rest/ip_messaging/v1/service/role.rb +4 -4
  65. data/lib/twilio-ruby/rest/ip_messaging/v2/service.rb +3 -3
  66. data/lib/twilio-ruby/rest/ip_messaging/v2/service/binding.rb +7 -7
  67. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel.rb +3 -3
  68. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/invite.rb +3 -3
  69. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/member.rb +3 -3
  70. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/webhook.rb +6 -6
  71. data/lib/twilio-ruby/rest/ip_messaging/v2/service/role.rb +4 -4
  72. data/lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb +4 -4
  73. data/lib/twilio-ruby/rest/lookups/v1/phone_number.rb +16 -16
  74. data/lib/twilio-ruby/rest/messaging.rb +22 -0
  75. data/lib/twilio-ruby/rest/messaging/v1.rb +37 -0
  76. data/lib/twilio-ruby/rest/messaging/v1/brand_registration.rb +328 -0
  77. data/lib/twilio-ruby/rest/messaging/v1/campaign.rb +387 -0
  78. data/lib/twilio-ruby/rest/messaging/v1/service/alpha_sender.rb +1 -1
  79. data/lib/twilio-ruby/rest/messaging/v1/service/phone_number.rb +1 -1
  80. data/lib/twilio-ruby/rest/messaging/v1/service/short_code.rb +1 -1
  81. data/lib/twilio-ruby/rest/messaging/v1/use_case.rb +198 -0
  82. data/lib/twilio-ruby/rest/notify/v1/service/binding.rb +16 -15
  83. data/lib/twilio-ruby/rest/notify/v1/service/notification.rb +18 -18
  84. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/evaluation.rb +1 -1
  85. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/end_user_type.rb +1 -1
  86. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/supporting_document_type.rb +1 -1
  87. data/lib/twilio-ruby/rest/preview.rb +4 -23
  88. data/lib/twilio-ruby/rest/preview/bulk_exports.rb +4 -2
  89. data/lib/twilio-ruby/rest/preview/bulk_exports/export.rb +7 -4
  90. data/lib/twilio-ruby/rest/preview/bulk_exports/export/day.rb +7 -4
  91. data/lib/twilio-ruby/rest/preview/bulk_exports/export/export_custom_job.rb +5 -3
  92. data/lib/twilio-ruby/rest/preview/bulk_exports/export/job.rb +5 -3
  93. data/lib/twilio-ruby/rest/preview/bulk_exports/export_configuration.rb +5 -3
  94. data/lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document.rb +13 -13
  95. data/lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document/dependent_hosted_number_order.rb +2 -2
  96. data/lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb +8 -8
  97. data/lib/twilio-ruby/rest/preview/sync/service/document.rb +4 -8
  98. data/lib/twilio-ruby/rest/preview/trusted_comms.rb +0 -30
  99. data/lib/twilio-ruby/rest/preview/wireless/rate_plan.rb +2 -2
  100. data/lib/twilio-ruby/rest/pricing/v1/messaging/country.rb +2 -2
  101. data/lib/twilio-ruby/rest/pricing/v1/phone_number/country.rb +1 -1
  102. data/lib/twilio-ruby/rest/pricing/v1/voice/country.rb +2 -2
  103. data/lib/twilio-ruby/rest/pricing/v2/voice/country.rb +2 -2
  104. data/lib/twilio-ruby/rest/pricing/v2/voice/number.rb +1 -1
  105. data/lib/twilio-ruby/rest/proxy/v1/service/session.rb +1 -1
  106. data/lib/twilio-ruby/rest/proxy/v1/service/session/participant/message_interaction.rb +1 -1
  107. data/lib/twilio-ruby/rest/serverless/v1/service/build.rb +17 -7
  108. data/lib/twilio-ruby/rest/studio/v2/flow.rb +6 -14
  109. data/lib/twilio-ruby/rest/studio/v2/flow/execution.rb +0 -8
  110. data/lib/twilio-ruby/rest/studio/v2/flow/execution/execution_context.rb +0 -8
  111. data/lib/twilio-ruby/rest/studio/v2/flow/execution/execution_step.rb +0 -8
  112. data/lib/twilio-ruby/rest/studio/v2/flow/execution/execution_step/execution_step_context.rb +0 -8
  113. data/lib/twilio-ruby/rest/studio/v2/flow/flow_revision.rb +2 -10
  114. data/lib/twilio-ruby/rest/studio/v2/flow/test_user.rb +10 -16
  115. data/lib/twilio-ruby/rest/studio/v2/flow_validate.rb +6 -11
  116. data/lib/twilio-ruby/rest/supersim/v1/command.rb +4 -4
  117. data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +33 -12
  118. data/lib/twilio-ruby/rest/supersim/v1/network.rb +5 -5
  119. data/lib/twilio-ruby/rest/supersim/v1/network_access_profile.rb +6 -6
  120. data/lib/twilio-ruby/rest/supersim/v1/network_access_profile/network_access_profile_network.rb +5 -5
  121. data/lib/twilio-ruby/rest/supersim/v1/sim.rb +4 -4
  122. data/lib/twilio-ruby/rest/supersim/v1/usage_record.rb +3 -3
  123. data/lib/twilio-ruby/rest/sync/v1/service.rb +0 -8
  124. data/lib/twilio-ruby/rest/sync/v1/service/document.rb +16 -36
  125. data/lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb +0 -8
  126. data/lib/twilio-ruby/rest/sync/v1/service/sync_list.rb +9 -25
  127. data/lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb +24 -43
  128. data/lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_permission.rb +0 -8
  129. data/lib/twilio-ruby/rest/sync/v1/service/sync_map.rb +9 -25
  130. data/lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb +25 -44
  131. data/lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb +1 -9
  132. data/lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb +5 -23
  133. data/lib/twilio-ruby/rest/sync/v1/service/sync_stream/stream_message.rb +1 -7
  134. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb +17 -17
  135. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task/reservation.rb +10 -10
  136. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb +1 -1
  137. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb +10 -10
  138. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.rb +1 -1
  139. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_real_time_statistics.rb +1 -1
  140. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_real_time_statistics.rb +1 -1
  141. data/lib/twilio-ruby/rest/trunking/v1/trunk.rb +1 -1
  142. data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb +3 -3
  143. data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +1 -1
  144. data/lib/twilio-ruby/rest/verify/v2/service/webhook.rb +10 -10
  145. data/lib/twilio-ruby/rest/video/v1/composition.rb +16 -15
  146. data/lib/twilio-ruby/rest/video/v1/composition_hook.rb +26 -26
  147. data/lib/twilio-ruby/rest/video/v1/composition_settings.rb +6 -6
  148. data/lib/twilio-ruby/rest/video/v1/recording.rb +6 -6
  149. data/lib/twilio-ruby/rest/video/v1/recording_settings.rb +6 -6
  150. data/lib/twilio-ruby/rest/video/v1/room.rb +10 -3
  151. data/lib/twilio-ruby/rest/video/v1/room/room_participant/room_participant_subscribe_rule.rb +1 -1
  152. data/lib/twilio-ruby/rest/video/v1/room/room_recording_rule.rb +1 -1
  153. data/lib/twilio-ruby/rest/voice/v1/dialing_permissions/country.rb +1 -1
  154. data/lib/twilio-ruby/rest/wireless/v1/rate_plan.rb +4 -4
  155. data/lib/twilio-ruby/twiml/voice_response.rb +18 -8
  156. data/lib/twilio-ruby/version.rb +1 -1
  157. data/spec/integration/api/v2010/account/conference_spec.rb +302 -44
  158. data/spec/integration/conversations/v1/conversation/participant_spec.rb +30 -10
  159. data/spec/integration/conversations/v1/service/configuration_spec.rb +2 -0
  160. data/spec/integration/conversations/v1/service/conversation/participant_spec.rb +30 -10
  161. data/spec/integration/conversations/v1/service/user_spec.rb +9 -4
  162. data/spec/integration/conversations/v1/user_spec.rb +9 -4
  163. data/spec/integration/events/v1/sink_spec.rb +14 -0
  164. data/spec/integration/flex_api/v1/configuration_spec.rb +24 -0
  165. data/spec/integration/insights/v1/call/summary_spec.rb +1 -0
  166. data/spec/integration/messaging/v1/brand_registration_spec.rb +143 -0
  167. data/spec/integration/messaging/v1/campaign_spec.rb +194 -0
  168. data/spec/integration/messaging/v1/use_case_spec.rb +55 -0
  169. data/spec/integration/preview/sync/service/document_spec.rb +1 -3
  170. data/spec/integration/serverless/v1/service/build_spec.rb +12 -2
  171. data/spec/integration/supersim/v1/fleet_spec.rb +8 -0
  172. data/spec/integration/sync/v1/service/document_spec.rb +1 -3
  173. data/spec/integration/video/v1/room_spec.rb +5 -0
  174. data/spec/twiml/voice_response_spec.rb +1 -1
  175. metadata +11 -17
  176. data/lib/twilio-ruby/rest/preview/trusted_comms/branded_call.rb +0 -243
  177. data/lib/twilio-ruby/rest/preview/trusted_comms/business.rb +0 -213
  178. data/lib/twilio-ruby/rest/preview/trusted_comms/business/insights.rb +0 -108
  179. data/lib/twilio-ruby/rest/preview/trusted_comms/business/insights/impressions_rate.rb +0 -260
  180. data/lib/twilio-ruby/rest/preview/trusted_comms/phone_call.rb +0 -342
  181. data/spec/integration/preview/trusted_comms/branded_call_spec.rb +0 -59
  182. data/spec/integration/preview/trusted_comms/business/insights/impressions_rate_spec.rb +0 -56
  183. data/spec/integration/preview/trusted_comms/business/insights_spec.rb +0 -12
  184. data/spec/integration/preview/trusted_comms/business_spec.rb +0 -45
  185. data/spec/integration/preview/trusted_comms/phone_call_spec.rb +0 -59
@@ -0,0 +1,328 @@
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 Messaging < Domain
12
+ class V1 < Version
13
+ ##
14
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
15
+ class BrandRegistrationList < ListResource
16
+ ##
17
+ # Initialize the BrandRegistrationList
18
+ # @param [Version] version Version that contains the resource
19
+ # @return [BrandRegistrationList] BrandRegistrationList
20
+ def initialize(version)
21
+ super(version)
22
+
23
+ # Path Solution
24
+ @solution = {}
25
+ @uri = "/a2p/BrandRegistrations"
26
+ end
27
+
28
+ ##
29
+ # Lists BrandRegistrationInstance 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 BrandRegistrationInstance 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 BrandRegistrationInstance 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 BrandRegistrationInstance 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 BrandRegistrationInstance
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
+ BrandRegistrationPage.new(@version, response, @solution)
93
+ end
94
+
95
+ ##
96
+ # Retrieve a single page of BrandRegistrationInstance 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 BrandRegistrationInstance
100
+ def get_page(target_url)
101
+ response = @version.domain.request(
102
+ 'GET',
103
+ target_url
104
+ )
105
+ BrandRegistrationPage.new(@version, response, @solution)
106
+ end
107
+
108
+ ##
109
+ # Create the BrandRegistrationInstance
110
+ # @param [String] customer_profile_bundle_sid Customer Profile Bundle Sid.
111
+ # @param [String] a2p_profile_bundle_sid A2P Messaging Profile Bundle Sid.
112
+ # @return [BrandRegistrationInstance] Created BrandRegistrationInstance
113
+ def create(customer_profile_bundle_sid: nil, a2p_profile_bundle_sid: nil)
114
+ data = Twilio::Values.of({
115
+ 'CustomerProfileBundleSid' => customer_profile_bundle_sid,
116
+ 'A2PProfileBundleSid' => a2p_profile_bundle_sid,
117
+ })
118
+
119
+ payload = @version.create('POST', @uri, data: data)
120
+
121
+ BrandRegistrationInstance.new(@version, payload, )
122
+ end
123
+
124
+ ##
125
+ # Provide a user friendly representation
126
+ def to_s
127
+ '#<Twilio.Messaging.V1.BrandRegistrationList>'
128
+ end
129
+ end
130
+
131
+ ##
132
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
133
+ class BrandRegistrationPage < Page
134
+ ##
135
+ # Initialize the BrandRegistrationPage
136
+ # @param [Version] version Version that contains the resource
137
+ # @param [Response] response Response from the API
138
+ # @param [Hash] solution Path solution for the resource
139
+ # @return [BrandRegistrationPage] BrandRegistrationPage
140
+ def initialize(version, response, solution)
141
+ super(version, response)
142
+
143
+ # Path Solution
144
+ @solution = solution
145
+ end
146
+
147
+ ##
148
+ # Build an instance of BrandRegistrationInstance
149
+ # @param [Hash] payload Payload response from the API
150
+ # @return [BrandRegistrationInstance] BrandRegistrationInstance
151
+ def get_instance(payload)
152
+ BrandRegistrationInstance.new(@version, payload, )
153
+ end
154
+
155
+ ##
156
+ # Provide a user friendly representation
157
+ def to_s
158
+ '<Twilio.Messaging.V1.BrandRegistrationPage>'
159
+ end
160
+ end
161
+
162
+ ##
163
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
164
+ class BrandRegistrationContext < InstanceContext
165
+ ##
166
+ # Initialize the BrandRegistrationContext
167
+ # @param [Version] version Version that contains the resource
168
+ # @param [String] sid The SID of the Brand Registration resource to fetch.
169
+ # @return [BrandRegistrationContext] BrandRegistrationContext
170
+ def initialize(version, sid)
171
+ super(version)
172
+
173
+ # Path Solution
174
+ @solution = {sid: sid, }
175
+ @uri = "/a2p/BrandRegistrations/#{@solution[:sid]}"
176
+ end
177
+
178
+ ##
179
+ # Fetch the BrandRegistrationInstance
180
+ # @return [BrandRegistrationInstance] Fetched BrandRegistrationInstance
181
+ def fetch
182
+ payload = @version.fetch('GET', @uri)
183
+
184
+ BrandRegistrationInstance.new(@version, payload, sid: @solution[:sid], )
185
+ end
186
+
187
+ ##
188
+ # Provide a user friendly representation
189
+ def to_s
190
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
191
+ "#<Twilio.Messaging.V1.BrandRegistrationContext #{context}>"
192
+ end
193
+
194
+ ##
195
+ # Provide a detailed, user friendly representation
196
+ def inspect
197
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
198
+ "#<Twilio.Messaging.V1.BrandRegistrationContext #{context}>"
199
+ end
200
+ end
201
+
202
+ ##
203
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
204
+ class BrandRegistrationInstance < InstanceResource
205
+ ##
206
+ # Initialize the BrandRegistrationInstance
207
+ # @param [Version] version Version that contains the resource
208
+ # @param [Hash] payload payload that contains response from Twilio
209
+ # @param [String] sid The SID of the Brand Registration resource to fetch.
210
+ # @return [BrandRegistrationInstance] BrandRegistrationInstance
211
+ def initialize(version, payload, sid: nil)
212
+ super(version)
213
+
214
+ # Marshaled Properties
215
+ @properties = {
216
+ 'sid' => payload['sid'],
217
+ 'account_sid' => payload['account_sid'],
218
+ 'customer_profile_bundle_sid' => payload['customer_profile_bundle_sid'],
219
+ 'a2p_profile_bundle_sid' => payload['a2p_profile_bundle_sid'],
220
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
221
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
222
+ 'status' => payload['status'],
223
+ 'tcr_id' => payload['tcr_id'],
224
+ 'failure_reason' => payload['failure_reason'],
225
+ 'url' => payload['url'],
226
+ }
227
+
228
+ # Context
229
+ @instance_context = nil
230
+ @params = {'sid' => sid || @properties['sid'], }
231
+ end
232
+
233
+ ##
234
+ # Generate an instance context for the instance, the context is capable of
235
+ # performing various actions. All instance actions are proxied to the context
236
+ # @return [BrandRegistrationContext] BrandRegistrationContext for this BrandRegistrationInstance
237
+ def context
238
+ unless @instance_context
239
+ @instance_context = BrandRegistrationContext.new(@version, @params['sid'], )
240
+ end
241
+ @instance_context
242
+ end
243
+
244
+ ##
245
+ # @return [String] A2P BrandRegistration Sid
246
+ def sid
247
+ @properties['sid']
248
+ end
249
+
250
+ ##
251
+ # @return [String] The SID of the Account that created the resource
252
+ def account_sid
253
+ @properties['account_sid']
254
+ end
255
+
256
+ ##
257
+ # @return [String] A2P Messaging Profile Bundle BundleSid
258
+ def customer_profile_bundle_sid
259
+ @properties['customer_profile_bundle_sid']
260
+ end
261
+
262
+ ##
263
+ # @return [String] A2P Messaging Profile Bundle BundleSid
264
+ def a2p_profile_bundle_sid
265
+ @properties['a2p_profile_bundle_sid']
266
+ end
267
+
268
+ ##
269
+ # @return [Time] The ISO 8601 date and time in GMT when the resource was created
270
+ def date_created
271
+ @properties['date_created']
272
+ end
273
+
274
+ ##
275
+ # @return [Time] The ISO 8601 date and time in GMT when the resource was last updated
276
+ def date_updated
277
+ @properties['date_updated']
278
+ end
279
+
280
+ ##
281
+ # @return [brand_registration.Status] Brand Registration status
282
+ def status
283
+ @properties['status']
284
+ end
285
+
286
+ ##
287
+ # @return [String] Campaign Registry (TCR) Brand ID
288
+ def tcr_id
289
+ @properties['tcr_id']
290
+ end
291
+
292
+ ##
293
+ # @return [String] A reason why brand registration has failed
294
+ def failure_reason
295
+ @properties['failure_reason']
296
+ end
297
+
298
+ ##
299
+ # @return [String] The absolute URL of the Brand Registration
300
+ def url
301
+ @properties['url']
302
+ end
303
+
304
+ ##
305
+ # Fetch the BrandRegistrationInstance
306
+ # @return [BrandRegistrationInstance] Fetched BrandRegistrationInstance
307
+ def fetch
308
+ context.fetch
309
+ end
310
+
311
+ ##
312
+ # Provide a user friendly representation
313
+ def to_s
314
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
315
+ "<Twilio.Messaging.V1.BrandRegistrationInstance #{values}>"
316
+ end
317
+
318
+ ##
319
+ # Provide a detailed, user friendly representation
320
+ def inspect
321
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
322
+ "<Twilio.Messaging.V1.BrandRegistrationInstance #{values}>"
323
+ end
324
+ end
325
+ end
326
+ end
327
+ end
328
+ end
@@ -0,0 +1,387 @@
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 Messaging < Domain
12
+ class V1 < Version
13
+ ##
14
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
15
+ class CampaignList < ListResource
16
+ ##
17
+ # Initialize the CampaignList
18
+ # @param [Version] version Version that contains the resource
19
+ # @return [CampaignList] CampaignList
20
+ def initialize(version)
21
+ super(version)
22
+
23
+ # Path Solution
24
+ @solution = {}
25
+ @uri = "/a2p/Campaigns"
26
+ end
27
+
28
+ ##
29
+ # Lists CampaignInstance 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 CampaignInstance 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 CampaignInstance 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 CampaignInstance 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 CampaignInstance
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
+ CampaignPage.new(@version, response, @solution)
93
+ end
94
+
95
+ ##
96
+ # Retrieve a single page of CampaignInstance 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 CampaignInstance
100
+ def get_page(target_url)
101
+ response = @version.domain.request(
102
+ 'GET',
103
+ target_url
104
+ )
105
+ CampaignPage.new(@version, response, @solution)
106
+ end
107
+
108
+ ##
109
+ # Create the CampaignInstance
110
+ # @param [String] brand_registration_sid A2P BrandRegistration Sid
111
+ # @param [String] use_case A2P Campaign UseCase. One of [ 2FA, EMERGENCY,
112
+ # MARKETING ]
113
+ # @param [String] description A short description of what this SMS campaign does.
114
+ # @param [Array[String]] message_samples Message samples, up to 5 sample messages,
115
+ # <=255 chars each. Example: [ "EXPRESS: Denim Days Event is ON", "LAST CHANCE:
116
+ # Book your next flight for just 1 (ONE) EUR" ]
117
+ # @param [Boolean] has_embedded_links Indicate that this SMS campaign will send
118
+ # messages that contain links.
119
+ # @param [Boolean] has_embedded_phone Indicates that this SMS campaign will send
120
+ # messages that contain phone numbers.
121
+ # @param [String] messaging_service_sid The SID of the
122
+ # {Service}[https://www.twilio.com/docs/chat/rest/service-resource] to read the
123
+ # resources from.
124
+ # @return [CampaignInstance] Created CampaignInstance
125
+ def create(brand_registration_sid: nil, use_case: nil, description: nil, message_samples: nil, has_embedded_links: nil, has_embedded_phone: nil, messaging_service_sid: nil)
126
+ data = Twilio::Values.of({
127
+ 'BrandRegistrationSid' => brand_registration_sid,
128
+ 'UseCase' => use_case,
129
+ 'Description' => description,
130
+ 'MessageSamples' => Twilio.serialize_list(message_samples) { |e| e },
131
+ 'HasEmbeddedLinks' => has_embedded_links,
132
+ 'HasEmbeddedPhone' => has_embedded_phone,
133
+ 'MessagingServiceSid' => messaging_service_sid,
134
+ })
135
+
136
+ payload = @version.create('POST', @uri, data: data)
137
+
138
+ CampaignInstance.new(@version, payload, )
139
+ end
140
+
141
+ ##
142
+ # Provide a user friendly representation
143
+ def to_s
144
+ '#<Twilio.Messaging.V1.CampaignList>'
145
+ end
146
+ end
147
+
148
+ ##
149
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
150
+ class CampaignPage < Page
151
+ ##
152
+ # Initialize the CampaignPage
153
+ # @param [Version] version Version that contains the resource
154
+ # @param [Response] response Response from the API
155
+ # @param [Hash] solution Path solution for the resource
156
+ # @return [CampaignPage] CampaignPage
157
+ def initialize(version, response, solution)
158
+ super(version, response)
159
+
160
+ # Path Solution
161
+ @solution = solution
162
+ end
163
+
164
+ ##
165
+ # Build an instance of CampaignInstance
166
+ # @param [Hash] payload Payload response from the API
167
+ # @return [CampaignInstance] CampaignInstance
168
+ def get_instance(payload)
169
+ CampaignInstance.new(@version, payload, )
170
+ end
171
+
172
+ ##
173
+ # Provide a user friendly representation
174
+ def to_s
175
+ '<Twilio.Messaging.V1.CampaignPage>'
176
+ end
177
+ end
178
+
179
+ ##
180
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
181
+ class CampaignContext < InstanceContext
182
+ ##
183
+ # Initialize the CampaignContext
184
+ # @param [Version] version Version that contains the resource
185
+ # @param [String] sid The SID of the Campaign resource to fetch.
186
+ # @return [CampaignContext] CampaignContext
187
+ def initialize(version, sid)
188
+ super(version)
189
+
190
+ # Path Solution
191
+ @solution = {sid: sid, }
192
+ @uri = "/a2p/Campaigns/#{@solution[:sid]}"
193
+ end
194
+
195
+ ##
196
+ # Fetch the CampaignInstance
197
+ # @return [CampaignInstance] Fetched CampaignInstance
198
+ def fetch
199
+ payload = @version.fetch('GET', @uri)
200
+
201
+ CampaignInstance.new(@version, payload, sid: @solution[:sid], )
202
+ end
203
+
204
+ ##
205
+ # Delete the CampaignInstance
206
+ # @return [Boolean] true if delete succeeds, false otherwise
207
+ def delete
208
+ @version.delete('DELETE', @uri)
209
+ end
210
+
211
+ ##
212
+ # Provide a user friendly representation
213
+ def to_s
214
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
215
+ "#<Twilio.Messaging.V1.CampaignContext #{context}>"
216
+ end
217
+
218
+ ##
219
+ # Provide a detailed, user friendly representation
220
+ def inspect
221
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
222
+ "#<Twilio.Messaging.V1.CampaignContext #{context}>"
223
+ end
224
+ end
225
+
226
+ ##
227
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
228
+ class CampaignInstance < InstanceResource
229
+ ##
230
+ # Initialize the CampaignInstance
231
+ # @param [Version] version Version that contains the resource
232
+ # @param [Hash] payload payload that contains response from Twilio
233
+ # @param [String] sid The SID of the Campaign resource to fetch.
234
+ # @return [CampaignInstance] CampaignInstance
235
+ def initialize(version, payload, sid: nil)
236
+ super(version)
237
+
238
+ # Marshaled Properties
239
+ @properties = {
240
+ 'account_sid' => payload['account_sid'],
241
+ 'messaging_service_sid' => payload['messaging_service_sid'],
242
+ 'brand_registration_sid' => payload['brand_registration_sid'],
243
+ 'sid' => payload['sid'],
244
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
245
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
246
+ 'description' => payload['description'],
247
+ 'message_samples' => payload['message_samples'],
248
+ 'status' => payload['status'],
249
+ 'failure_reason' => payload['failure_reason'],
250
+ 'use_case' => payload['use_case'],
251
+ 'has_embedded_links' => payload['has_embedded_links'],
252
+ 'has_embedded_phone' => payload['has_embedded_phone'],
253
+ 'url' => payload['url'],
254
+ }
255
+
256
+ # Context
257
+ @instance_context = nil
258
+ @params = {'sid' => sid || @properties['sid'], }
259
+ end
260
+
261
+ ##
262
+ # Generate an instance context for the instance, the context is capable of
263
+ # performing various actions. All instance actions are proxied to the context
264
+ # @return [CampaignContext] CampaignContext for this CampaignInstance
265
+ def context
266
+ unless @instance_context
267
+ @instance_context = CampaignContext.new(@version, @params['sid'], )
268
+ end
269
+ @instance_context
270
+ end
271
+
272
+ ##
273
+ # @return [String] The SID of the Account that created the resource
274
+ def account_sid
275
+ @properties['account_sid']
276
+ end
277
+
278
+ ##
279
+ # @return [String] MessagingService SID
280
+ def messaging_service_sid
281
+ @properties['messaging_service_sid']
282
+ end
283
+
284
+ ##
285
+ # @return [String] A2P BrandRegistration Sid
286
+ def brand_registration_sid
287
+ @properties['brand_registration_sid']
288
+ end
289
+
290
+ ##
291
+ # @return [String] Campaign sid
292
+ def sid
293
+ @properties['sid']
294
+ end
295
+
296
+ ##
297
+ # @return [Time] The ISO 8601 date and time in GMT when the resource was created
298
+ def date_created
299
+ @properties['date_created']
300
+ end
301
+
302
+ ##
303
+ # @return [Time] The ISO 8601 date and time in GMT when the resource was last updated
304
+ def date_updated
305
+ @properties['date_updated']
306
+ end
307
+
308
+ ##
309
+ # @return [String] A short description of what this SMS campaign does
310
+ def description
311
+ @properties['description']
312
+ end
313
+
314
+ ##
315
+ # @return [Array[String]] Message samples
316
+ def message_samples
317
+ @properties['message_samples']
318
+ end
319
+
320
+ ##
321
+ # @return [campaign.Status] Campaign status
322
+ def status
323
+ @properties['status']
324
+ end
325
+
326
+ ##
327
+ # @return [String] A reason why campaign registration has failed
328
+ def failure_reason
329
+ @properties['failure_reason']
330
+ end
331
+
332
+ ##
333
+ # @return [String] A2P Campaign UseCase.
334
+ def use_case
335
+ @properties['use_case']
336
+ end
337
+
338
+ ##
339
+ # @return [Boolean] Indicate that this SMS campaign will send messages that contain links
340
+ def has_embedded_links
341
+ @properties['has_embedded_links']
342
+ end
343
+
344
+ ##
345
+ # @return [Boolean] Indicates that this SMS campaign will send messages that contain phone numbers
346
+ def has_embedded_phone
347
+ @properties['has_embedded_phone']
348
+ end
349
+
350
+ ##
351
+ # @return [String] The absolute URL of the Campaign resource
352
+ def url
353
+ @properties['url']
354
+ end
355
+
356
+ ##
357
+ # Fetch the CampaignInstance
358
+ # @return [CampaignInstance] Fetched CampaignInstance
359
+ def fetch
360
+ context.fetch
361
+ end
362
+
363
+ ##
364
+ # Delete the CampaignInstance
365
+ # @return [Boolean] true if delete succeeds, false otherwise
366
+ def delete
367
+ context.delete
368
+ end
369
+
370
+ ##
371
+ # Provide a user friendly representation
372
+ def to_s
373
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
374
+ "<Twilio.Messaging.V1.CampaignInstance #{values}>"
375
+ end
376
+
377
+ ##
378
+ # Provide a detailed, user friendly representation
379
+ def inspect
380
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
381
+ "<Twilio.Messaging.V1.CampaignInstance #{values}>"
382
+ end
383
+ end
384
+ end
385
+ end
386
+ end
387
+ end