twilio-ruby 5.39.1 → 5.40.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/CHANGES.md +101 -1
  4. data/CONTRIBUTING.md +2 -2
  5. data/ISSUE_TEMPLATE.md +5 -1
  6. data/Makefile +1 -1
  7. data/PULL_REQUEST_TEMPLATE.md +1 -1
  8. data/README.md +4 -3
  9. data/lib/twilio-ruby/framework/version.rb +2 -7
  10. data/lib/twilio-ruby/rest/api/v2010/account/application.rb +6 -4
  11. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number/local.rb +3 -3
  12. data/lib/twilio-ruby/rest/api/v2010/account/call/payment.rb +79 -60
  13. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/local.rb +14 -0
  14. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/mobile.rb +14 -0
  15. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/toll_free.rb +14 -0
  16. data/lib/twilio-ruby/rest/client.rb +7 -0
  17. data/lib/twilio-ruby/rest/conversations.rb +52 -0
  18. data/lib/twilio-ruby/rest/conversations/v1.rb +88 -1
  19. data/lib/twilio-ruby/rest/conversations/v1/configuration.rb +258 -0
  20. data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +15 -4
  21. data/lib/twilio-ruby/rest/conversations/v1/conversation/message/delivery_receipt.rb +19 -10
  22. data/lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb +12 -2
  23. data/lib/twilio-ruby/rest/conversations/v1/credential.rb +427 -0
  24. data/lib/twilio-ruby/rest/conversations/v1/notification.rb +310 -0
  25. data/lib/twilio-ruby/rest/conversations/v1/role.rb +372 -0
  26. data/lib/twilio-ruby/rest/conversations/v1/service.rb +442 -0
  27. data/lib/twilio-ruby/rest/conversations/v1/service/binding.rb +385 -0
  28. data/lib/twilio-ruby/rest/conversations/v1/service/configuration.rb +259 -0
  29. data/lib/twilio-ruby/rest/conversations/v1/service/conversation.rb +586 -0
  30. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb +546 -0
  31. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/message/delivery_receipt.rb +388 -0
  32. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb +513 -0
  33. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb +454 -0
  34. data/lib/twilio-ruby/rest/conversations/v1/service/role.rb +393 -0
  35. data/lib/twilio-ruby/rest/conversations/v1/service/user.rb +419 -0
  36. data/lib/twilio-ruby/rest/conversations/v1/user.rb +398 -0
  37. data/lib/twilio-ruby/rest/events.rb +63 -0
  38. data/lib/twilio-ruby/rest/events/v1.rb +74 -0
  39. data/lib/twilio-ruby/rest/events/v1/event_type.rb +291 -0
  40. data/lib/twilio-ruby/rest/events/v1/sink.rb +380 -0
  41. data/lib/twilio-ruby/rest/events/v1/sink/sink_test.rb +115 -0
  42. data/lib/twilio-ruby/rest/events/v1/sink/sink_validate.rb +119 -0
  43. data/lib/twilio-ruby/rest/events/v1/subscription.rb +363 -0
  44. data/lib/twilio-ruby/rest/events/v1/subscription/subscribed_event.rb +322 -0
  45. data/lib/twilio-ruby/rest/messaging.rb +6 -0
  46. data/lib/twilio-ruby/rest/messaging/v1.rb +7 -0
  47. data/lib/twilio-ruby/rest/messaging/v1/deactivation.rb +164 -0
  48. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance.rb +3 -3
  49. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/end_user.rb +16 -2
  50. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/supporting_document.rb +18 -4
  51. data/lib/twilio-ruby/rest/proxy/v1/service/session.rb +45 -4
  52. data/lib/twilio-ruby/rest/proxy/v1/service/session/participant.rb +14 -1
  53. data/lib/twilio-ruby/rest/serverless/v1/service.rb +13 -13
  54. data/lib/twilio-ruby/rest/serverless/v1/service/asset.rb +6 -6
  55. data/lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb +5 -5
  56. data/lib/twilio-ruby/rest/serverless/v1/service/build.rb +8 -8
  57. data/lib/twilio-ruby/rest/serverless/v1/service/environment.rb +6 -8
  58. data/lib/twilio-ruby/rest/serverless/v1/service/environment/deployment.rb +8 -8
  59. data/lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb +14 -14
  60. data/lib/twilio-ruby/rest/serverless/v1/service/function.rb +4 -4
  61. data/lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb +7 -7
  62. data/lib/twilio-ruby/rest/serverless/v1/service/function/function_version/function_version_content.rb +1 -1
  63. data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +12 -11
  64. data/lib/twilio-ruby/rest/supersim/v1/sim.rb +39 -9
  65. data/lib/twilio-ruby/rest/supersim/v1/usage_record.rb +75 -9
  66. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb +2 -1
  67. data/lib/twilio-ruby/rest/trunking/v1/trunk.rb +25 -3
  68. data/lib/twilio-ruby/rest/verify/v2/service.rb +21 -9
  69. data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb +10 -2
  70. data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +4 -1
  71. data/lib/twilio-ruby/rest/video/v1/room/room_participant/room_participant_subscribe_rule.rb +0 -6
  72. data/lib/twilio-ruby/rest/wireless/v1/sim/data_session.rb +5 -19
  73. data/lib/twilio-ruby/version.rb +1 -1
  74. data/spec/framework/version_spec.rb +42 -0
  75. data/spec/holodeck/holodeck.rb +3 -3
  76. data/spec/integration/api/v2010/account/incoming_phone_number/local_spec.rb +35 -36
  77. data/spec/integration/api/v2010/account/incoming_phone_number/mobile_spec.rb +39 -40
  78. data/spec/integration/api/v2010/account/incoming_phone_number/toll_free_spec.rb +35 -36
  79. data/spec/integration/api/v2010/account/incoming_phone_number_spec.rb +25 -23
  80. data/spec/integration/api/v2010/account/message_spec.rb +37 -0
  81. data/spec/integration/bulkexports/v1/export/day_spec.rb +5 -5
  82. data/spec/integration/bulkexports/v1/export_configuration_spec.rb +4 -4
  83. data/spec/integration/bulkexports/v1/export_spec.rb +3 -3
  84. data/spec/integration/conversations/v1/configuration_spec.rb +85 -0
  85. data/spec/integration/conversations/v1/conversation/message/delivery_receipt_spec.rb +4 -0
  86. data/spec/integration/conversations/v1/conversation/message_spec.rb +38 -0
  87. data/spec/integration/conversations/v1/conversation/participant_spec.rb +60 -4
  88. data/spec/integration/conversations/v1/conversation_spec.rb +35 -0
  89. data/spec/integration/conversations/v1/credential_spec.rb +219 -0
  90. data/spec/integration/conversations/v1/notification_spec.rb +107 -0
  91. data/spec/integration/conversations/v1/role_spec.rb +249 -0
  92. data/spec/integration/conversations/v1/service/binding_spec.rb +166 -0
  93. data/spec/integration/conversations/v1/service/configuration_spec.rb +87 -0
  94. data/spec/integration/conversations/v1/service/conversation/message/delivery_receipt_spec.rb +144 -0
  95. data/spec/integration/conversations/v1/service/conversation/message_spec.rb +429 -0
  96. data/spec/integration/conversations/v1/service/conversation/participant_spec.rb +407 -0
  97. data/spec/integration/conversations/v1/service/conversation/webhook_spec.rb +299 -0
  98. data/spec/integration/conversations/v1/service/conversation_spec.rb +289 -0
  99. data/spec/integration/conversations/v1/service/role_spec.rb +260 -0
  100. data/spec/integration/conversations/v1/service/user_spec.rb +230 -0
  101. data/spec/integration/conversations/v1/service_spec.rb +174 -0
  102. data/spec/integration/conversations/v1/user_spec.rb +220 -0
  103. data/spec/integration/events/v1/event_type_spec.rb +133 -0
  104. data/spec/integration/events/v1/sink/sink_test_spec.rb +42 -0
  105. data/spec/integration/events/v1/sink/sink_validate_spec.rb +44 -0
  106. data/spec/integration/events/v1/sink_spec.rb +217 -0
  107. data/spec/integration/events/v1/subscription/subscribed_event_spec.rb +212 -0
  108. data/spec/integration/events/v1/subscription_spec.rb +205 -0
  109. data/spec/integration/messaging/v1/deactivation_spec.rb +40 -0
  110. data/spec/integration/numbers/v2/regulatory_compliance/end_user_spec.rb +27 -0
  111. data/spec/integration/numbers/v2/regulatory_compliance/supporting_document_spec.rb +27 -0
  112. data/spec/integration/studio/v1/flow/execution/execution_step_spec.rb +1 -0
  113. data/spec/integration/studio/v2/flow/execution/execution_step_spec.rb +1 -0
  114. data/spec/integration/supersim/v1/sim_spec.rb +23 -0
  115. data/spec/integration/supersim/v1/usage_record_spec.rb +463 -18
  116. data/spec/integration/trunking/v1/trunk_spec.rb +4 -0
  117. data/spec/integration/verify/v2/service/access_token_spec.rb +1 -1
  118. data/spec/integration/verify/v2/service/entity/challenge_spec.rb +8 -8
  119. data/spec/integration/video/v1/room_spec.rb +37 -0
  120. data/spec/integration/wireless/v1/sim/data_session_spec.rb +2 -2
  121. data/spec/spec_helper.rb +1 -1
  122. metadata +70 -2
@@ -0,0 +1,322 @@
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 Events < Domain
12
+ class V1 < Version
13
+ class SubscriptionContext < InstanceContext
14
+ ##
15
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
16
+ class SubscribedEventList < ListResource
17
+ ##
18
+ # Initialize the SubscribedEventList
19
+ # @param [Version] version Version that contains the resource
20
+ # @param [String] subscription_sid The unique SID identifier of the Subscription.
21
+ # @return [SubscribedEventList] SubscribedEventList
22
+ def initialize(version, subscription_sid: nil)
23
+ super(version)
24
+
25
+ # Path Solution
26
+ @solution = {subscription_sid: subscription_sid}
27
+ @uri = "/Subscriptions/#{@solution[:subscription_sid]}/SubscribedEvents"
28
+ end
29
+
30
+ ##
31
+ # Lists SubscribedEventInstance records from the API as a list.
32
+ # Unlike stream(), this operation is eager and will load `limit` records into
33
+ # memory before returning.
34
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
35
+ # guarantees to never return more than limit. Default is no limit
36
+ # @param [Integer] page_size Number of records to fetch per request, when
37
+ # not set will use the default value of 50 records. If no page_size is defined
38
+ # but a limit is defined, stream() will attempt to read the limit with the most
39
+ # efficient page size, i.e. min(limit, 1000)
40
+ # @return [Array] Array of up to limit results
41
+ def list(limit: nil, page_size: nil)
42
+ self.stream(limit: limit, page_size: page_size).entries
43
+ end
44
+
45
+ ##
46
+ # Streams SubscribedEventInstance records from the API as an Enumerable.
47
+ # This operation lazily loads records as efficiently as possible until the limit
48
+ # is reached.
49
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
50
+ # guarantees to never return more than limit. Default is no limit.
51
+ # @param [Integer] page_size Number of records to fetch per request, when
52
+ # not set will use the default value of 50 records. If no page_size is defined
53
+ # but a limit is defined, stream() will attempt to read the limit with the most
54
+ # efficient page size, i.e. min(limit, 1000)
55
+ # @return [Enumerable] Enumerable that will yield up to limit results
56
+ def stream(limit: nil, page_size: nil)
57
+ limits = @version.read_limits(limit, page_size)
58
+
59
+ page = self.page(page_size: limits[:page_size], )
60
+
61
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
62
+ end
63
+
64
+ ##
65
+ # When passed a block, yields SubscribedEventInstance records from the API.
66
+ # This operation lazily loads records as efficiently as possible until the limit
67
+ # is reached.
68
+ def each
69
+ limits = @version.read_limits
70
+
71
+ page = self.page(page_size: limits[:page_size], )
72
+
73
+ @version.stream(page,
74
+ limit: limits[:limit],
75
+ page_limit: limits[:page_limit]).each {|x| yield x}
76
+ end
77
+
78
+ ##
79
+ # Retrieve a single page of SubscribedEventInstance records from the API.
80
+ # Request is executed immediately.
81
+ # @param [String] page_token PageToken provided by the API
82
+ # @param [Integer] page_number Page Number, this value is simply for client state
83
+ # @param [Integer] page_size Number of records to return, defaults to 50
84
+ # @return [Page] Page of SubscribedEventInstance
85
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
86
+ params = Twilio::Values.of({
87
+ 'PageToken' => page_token,
88
+ 'Page' => page_number,
89
+ 'PageSize' => page_size,
90
+ })
91
+
92
+ response = @version.page('GET', @uri, params: params)
93
+
94
+ SubscribedEventPage.new(@version, response, @solution)
95
+ end
96
+
97
+ ##
98
+ # Retrieve a single page of SubscribedEventInstance records from the API.
99
+ # Request is executed immediately.
100
+ # @param [String] target_url API-generated URL for the requested results page
101
+ # @return [Page] Page of SubscribedEventInstance
102
+ def get_page(target_url)
103
+ response = @version.domain.request(
104
+ 'GET',
105
+ target_url
106
+ )
107
+ SubscribedEventPage.new(@version, response, @solution)
108
+ end
109
+
110
+ ##
111
+ # Create the SubscribedEventInstance
112
+ # @param [String] type Type of event being subscribed to.
113
+ # @param [String] version The schema version that the subscription should use.
114
+ # @return [SubscribedEventInstance] Created SubscribedEventInstance
115
+ def create(type: nil, version: :unset)
116
+ data = Twilio::Values.of({'Type' => type, 'Version' => version, })
117
+
118
+ payload = @version.create('POST', @uri, data: data)
119
+
120
+ SubscribedEventInstance.new(@version, payload, subscription_sid: @solution[:subscription_sid], )
121
+ end
122
+
123
+ ##
124
+ # Provide a user friendly representation
125
+ def to_s
126
+ '#<Twilio.Events.V1.SubscribedEventList>'
127
+ end
128
+ end
129
+
130
+ ##
131
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
132
+ class SubscribedEventPage < Page
133
+ ##
134
+ # Initialize the SubscribedEventPage
135
+ # @param [Version] version Version that contains the resource
136
+ # @param [Response] response Response from the API
137
+ # @param [Hash] solution Path solution for the resource
138
+ # @return [SubscribedEventPage] SubscribedEventPage
139
+ def initialize(version, response, solution)
140
+ super(version, response)
141
+
142
+ # Path Solution
143
+ @solution = solution
144
+ end
145
+
146
+ ##
147
+ # Build an instance of SubscribedEventInstance
148
+ # @param [Hash] payload Payload response from the API
149
+ # @return [SubscribedEventInstance] SubscribedEventInstance
150
+ def get_instance(payload)
151
+ SubscribedEventInstance.new(@version, payload, subscription_sid: @solution[:subscription_sid], )
152
+ end
153
+
154
+ ##
155
+ # Provide a user friendly representation
156
+ def to_s
157
+ '<Twilio.Events.V1.SubscribedEventPage>'
158
+ end
159
+ end
160
+
161
+ ##
162
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
163
+ class SubscribedEventContext < InstanceContext
164
+ ##
165
+ # Initialize the SubscribedEventContext
166
+ # @param [Version] version Version that contains the resource
167
+ # @param [String] subscription_sid The unique SID identifier of the Subscription.
168
+ # @param [String] type Type of event being subscribed to.
169
+ # @return [SubscribedEventContext] SubscribedEventContext
170
+ def initialize(version, subscription_sid, type)
171
+ super(version)
172
+
173
+ # Path Solution
174
+ @solution = {subscription_sid: subscription_sid, type: type, }
175
+ @uri = "/Subscriptions/#{@solution[:subscription_sid]}/SubscribedEvents/#{@solution[:type]}"
176
+ end
177
+
178
+ ##
179
+ # Update the SubscribedEventInstance
180
+ # @param [String] version The schema version that the subscription should use.
181
+ # @return [SubscribedEventInstance] Updated SubscribedEventInstance
182
+ def update(version: nil)
183
+ data = Twilio::Values.of({'Version' => version, })
184
+
185
+ payload = @version.update('POST', @uri, data: data)
186
+
187
+ SubscribedEventInstance.new(
188
+ @version,
189
+ payload,
190
+ subscription_sid: @solution[:subscription_sid],
191
+ type: @solution[:type],
192
+ )
193
+ end
194
+
195
+ ##
196
+ # Delete the SubscribedEventInstance
197
+ # @return [Boolean] true if delete succeeds, false otherwise
198
+ def delete
199
+ @version.delete('DELETE', @uri)
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.Events.V1.SubscribedEventContext #{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.Events.V1.SubscribedEventContext #{context}>"
214
+ end
215
+ end
216
+
217
+ ##
218
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
219
+ class SubscribedEventInstance < InstanceResource
220
+ ##
221
+ # Initialize the SubscribedEventInstance
222
+ # @param [Version] version Version that contains the resource
223
+ # @param [Hash] payload payload that contains response from Twilio
224
+ # @param [String] subscription_sid The unique SID identifier of the Subscription.
225
+ # @param [String] type Type of event being subscribed to.
226
+ # @return [SubscribedEventInstance] SubscribedEventInstance
227
+ def initialize(version, payload, subscription_sid: nil, type: nil)
228
+ super(version)
229
+
230
+ # Marshaled Properties
231
+ @properties = {
232
+ 'account_sid' => payload['account_sid'],
233
+ 'type' => payload['type'],
234
+ 'version' => payload['version'].to_i,
235
+ 'subscription_sid' => payload['subscription_sid'],
236
+ 'url' => payload['url'],
237
+ }
238
+
239
+ # Context
240
+ @instance_context = nil
241
+ @params = {'subscription_sid' => subscription_sid, 'type' => type || @properties['type'], }
242
+ end
243
+
244
+ ##
245
+ # Generate an instance context for the instance, the context is capable of
246
+ # performing various actions. All instance actions are proxied to the context
247
+ # @return [SubscribedEventContext] SubscribedEventContext for this SubscribedEventInstance
248
+ def context
249
+ unless @instance_context
250
+ @instance_context = SubscribedEventContext.new(
251
+ @version,
252
+ @params['subscription_sid'],
253
+ @params['type'],
254
+ )
255
+ end
256
+ @instance_context
257
+ end
258
+
259
+ ##
260
+ # @return [String] Account SID.
261
+ def account_sid
262
+ @properties['account_sid']
263
+ end
264
+
265
+ ##
266
+ # @return [String] Type of event being subscribed to.
267
+ def type
268
+ @properties['type']
269
+ end
270
+
271
+ ##
272
+ # @return [String] The schema version that the subscription should use.
273
+ def version
274
+ @properties['version']
275
+ end
276
+
277
+ ##
278
+ # @return [String] Subscription SID.
279
+ def subscription_sid
280
+ @properties['subscription_sid']
281
+ end
282
+
283
+ ##
284
+ # @return [String] The URL of this resource.
285
+ def url
286
+ @properties['url']
287
+ end
288
+
289
+ ##
290
+ # Update the SubscribedEventInstance
291
+ # @param [String] version The schema version that the subscription should use.
292
+ # @return [SubscribedEventInstance] Updated SubscribedEventInstance
293
+ def update(version: nil)
294
+ context.update(version: version, )
295
+ end
296
+
297
+ ##
298
+ # Delete the SubscribedEventInstance
299
+ # @return [Boolean] true if delete succeeds, false otherwise
300
+ def delete
301
+ context.delete
302
+ end
303
+
304
+ ##
305
+ # Provide a user friendly representation
306
+ def to_s
307
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
308
+ "<Twilio.Events.V1.SubscribedEventInstance #{values}>"
309
+ end
310
+
311
+ ##
312
+ # Provide a detailed, user friendly representation
313
+ def inspect
314
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
315
+ "<Twilio.Events.V1.SubscribedEventInstance #{values}>"
316
+ end
317
+ end
318
+ end
319
+ end
320
+ end
321
+ end
322
+ end
@@ -28,6 +28,12 @@ module Twilio
28
28
  @v1 ||= V1.new self
29
29
  end
30
30
 
31
+ ##
32
+ # @return [Twilio::REST::Messaging::V1::DeactivationsInstance]
33
+ def deactivations
34
+ self.v1.deactivations()
35
+ end
36
+
31
37
  ##
32
38
  # @param [String] sid The unique string that we created to identify the Service
33
39
  # resource.
@@ -15,9 +15,16 @@ module Twilio
15
15
  def initialize(domain)
16
16
  super
17
17
  @version = 'v1'
18
+ @deactivations = nil
18
19
  @services = nil
19
20
  end
20
21
 
22
+ ##
23
+ # @return [Twilio::REST::Messaging::V1::DeactivationsContext]
24
+ def deactivations
25
+ @deactivations ||= DeactivationsContext.new self
26
+ end
27
+
21
28
  ##
22
29
  # @param [String] sid The SID of the Service resource to fetch.
23
30
  # @return [Twilio::REST::Messaging::V1::ServiceContext] if sid was passed.
@@ -0,0 +1,164 @@
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
+ class DeactivationsList < ListResource
14
+ ##
15
+ # Initialize the DeactivationsList
16
+ # @param [Version] version Version that contains the resource
17
+ # @return [DeactivationsList] DeactivationsList
18
+ def initialize(version)
19
+ super(version)
20
+
21
+ # Path Solution
22
+ @solution = {}
23
+ end
24
+
25
+ ##
26
+ # Provide a user friendly representation
27
+ def to_s
28
+ '#<Twilio.Messaging.V1.DeactivationsList>'
29
+ end
30
+ end
31
+
32
+ class DeactivationsPage < Page
33
+ ##
34
+ # Initialize the DeactivationsPage
35
+ # @param [Version] version Version that contains the resource
36
+ # @param [Response] response Response from the API
37
+ # @param [Hash] solution Path solution for the resource
38
+ # @return [DeactivationsPage] DeactivationsPage
39
+ def initialize(version, response, solution)
40
+ super(version, response)
41
+
42
+ # Path Solution
43
+ @solution = solution
44
+ end
45
+
46
+ ##
47
+ # Build an instance of DeactivationsInstance
48
+ # @param [Hash] payload Payload response from the API
49
+ # @return [DeactivationsInstance] DeactivationsInstance
50
+ def get_instance(payload)
51
+ DeactivationsInstance.new(@version, payload, )
52
+ end
53
+
54
+ ##
55
+ # Provide a user friendly representation
56
+ def to_s
57
+ '<Twilio.Messaging.V1.DeactivationsPage>'
58
+ end
59
+ end
60
+
61
+ class DeactivationsContext < InstanceContext
62
+ ##
63
+ # Initialize the DeactivationsContext
64
+ # @param [Version] version Version that contains the resource
65
+ # @return [DeactivationsContext] DeactivationsContext
66
+ def initialize(version)
67
+ super(version)
68
+
69
+ # Path Solution
70
+ @solution = {}
71
+ @uri = "/Deactivations"
72
+ end
73
+
74
+ ##
75
+ # Fetch the DeactivationsInstance
76
+ # @param [Date] date The request will return a list of all United States Phone
77
+ # Numbers that were deactivated on the day specified by this parameter. This date
78
+ # should be specified in YYYY-MM-DD format.
79
+ # @return [DeactivationsInstance] Fetched DeactivationsInstance
80
+ def fetch(date: :unset)
81
+ params = Twilio::Values.of({'Date' => Twilio.serialize_iso8601_date(date), })
82
+
83
+ payload = @version.fetch('GET', @uri, params: params)
84
+
85
+ DeactivationsInstance.new(@version, payload, )
86
+ end
87
+
88
+ ##
89
+ # Provide a user friendly representation
90
+ def to_s
91
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
92
+ "#<Twilio.Messaging.V1.DeactivationsContext #{context}>"
93
+ end
94
+
95
+ ##
96
+ # Provide a detailed, user friendly representation
97
+ def inspect
98
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
99
+ "#<Twilio.Messaging.V1.DeactivationsContext #{context}>"
100
+ end
101
+ end
102
+
103
+ class DeactivationsInstance < InstanceResource
104
+ ##
105
+ # Initialize the DeactivationsInstance
106
+ # @param [Version] version Version that contains the resource
107
+ # @param [Hash] payload payload that contains response from Twilio
108
+ # @return [DeactivationsInstance] DeactivationsInstance
109
+ def initialize(version, payload)
110
+ super(version)
111
+
112
+ # Marshaled Properties
113
+ @properties = {'redirect_to' => payload['redirect_to'], }
114
+
115
+ # Context
116
+ @instance_context = nil
117
+ @params = {}
118
+ end
119
+
120
+ ##
121
+ # Generate an instance context for the instance, the context is capable of
122
+ # performing various actions. All instance actions are proxied to the context
123
+ # @return [DeactivationsContext] DeactivationsContext for this DeactivationsInstance
124
+ def context
125
+ unless @instance_context
126
+ @instance_context = DeactivationsContext.new(@version, )
127
+ end
128
+ @instance_context
129
+ end
130
+
131
+ ##
132
+ # @return [String] Redirect url to the list of deactivated numbers.
133
+ def redirect_to
134
+ @properties['redirect_to']
135
+ end
136
+
137
+ ##
138
+ # Fetch the DeactivationsInstance
139
+ # @param [Date] date The request will return a list of all United States Phone
140
+ # Numbers that were deactivated on the day specified by this parameter. This date
141
+ # should be specified in YYYY-MM-DD format.
142
+ # @return [DeactivationsInstance] Fetched DeactivationsInstance
143
+ def fetch(date: :unset)
144
+ context.fetch(date: date, )
145
+ end
146
+
147
+ ##
148
+ # Provide a user friendly representation
149
+ def to_s
150
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
151
+ "<Twilio.Messaging.V1.DeactivationsInstance #{values}>"
152
+ end
153
+
154
+ ##
155
+ # Provide a detailed, user friendly representation
156
+ def inspect
157
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
158
+ "<Twilio.Messaging.V1.DeactivationsInstance #{values}>"
159
+ end
160
+ end
161
+ end
162
+ end
163
+ end
164
+ end