twilio-ruby 5.52.0 → 5.56.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +7 -7
  3. data/.travis.yml +22 -28
  4. data/CHANGES.md +85 -0
  5. data/README.md +10 -2
  6. data/lib/twilio-ruby.rb +5 -15
  7. data/lib/twilio-ruby/framework/{domain.rb → rest/domain.rb} +0 -0
  8. data/lib/twilio-ruby/framework/{error.rb → rest/error.rb} +0 -0
  9. data/lib/twilio-ruby/framework/{helper.rb → rest/helper.rb} +0 -0
  10. data/lib/twilio-ruby/framework/{obsolete_client.rb → rest/obsolete_client.rb} +0 -0
  11. data/lib/twilio-ruby/framework/{page.rb → rest/page.rb} +0 -0
  12. data/lib/twilio-ruby/framework/{resource.rb → rest/resource.rb} +0 -0
  13. data/lib/twilio-ruby/framework/{version.rb → rest/version.rb} +0 -0
  14. data/lib/twilio-ruby/http.rb +5 -0
  15. data/lib/twilio-ruby/http/http_client.rb +14 -2
  16. data/lib/twilio-ruby/rest.rb +13 -0
  17. data/lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb +23 -23
  18. data/lib/twilio-ruby/rest/api/v2010/account/call/feedback_summary.rb +5 -5
  19. data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +8 -7
  20. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +2 -2
  21. data/lib/twilio-ruby/rest/bulkexports/v1/export.rb +0 -8
  22. data/lib/twilio-ruby/rest/bulkexports/v1/export/day.rb +0 -8
  23. data/lib/twilio-ruby/rest/bulkexports/v1/export/export_custom_job.rb +0 -6
  24. data/lib/twilio-ruby/rest/bulkexports/v1/export/job.rb +0 -8
  25. data/lib/twilio-ruby/rest/bulkexports/v1/export_configuration.rb +0 -8
  26. data/lib/twilio-ruby/rest/client.rb +7 -0
  27. data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +7 -0
  28. data/lib/twilio-ruby/rest/conversations/v1/service/conversation.rb +7 -0
  29. data/lib/twilio-ruby/rest/events/v1/event_type.rb +12 -5
  30. data/lib/twilio-ruby/rest/events/v1/sink.rb +41 -5
  31. data/lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb +28 -22
  32. data/lib/twilio-ruby/rest/frontline_api.rb +47 -0
  33. data/lib/twilio-ruby/rest/frontline_api/v1.rb +45 -0
  34. data/lib/twilio-ruby/rest/frontline_api/v1/user.rb +233 -0
  35. data/lib/twilio-ruby/rest/messaging/v1/external_campaign.rb +7 -0
  36. data/lib/twilio-ruby/rest/messaging/v1/service.rb +8 -2
  37. data/lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb +178 -18
  38. data/lib/twilio-ruby/rest/studio/v1/flow/execution.rb +1 -1
  39. data/lib/twilio-ruby/rest/studio/v2/flow/execution.rb +1 -1
  40. data/lib/twilio-ruby/rest/supersim/v1/sim.rb +30 -1
  41. data/lib/twilio-ruby/rest/supersim/v1/sim/billing_period.rb +231 -0
  42. data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb +16 -7
  43. data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge/notification.rb +6 -7
  44. data/lib/twilio-ruby/rest/verify/v2/service/entity/new_factor.rb +43 -18
  45. data/lib/twilio-ruby/rest/video/v1/composition.rb +0 -8
  46. data/lib/twilio-ruby/rest/video/v1/composition_hook.rb +0 -8
  47. data/lib/twilio-ruby/version.rb +1 -1
  48. metadata +15 -9
@@ -0,0 +1,47 @@
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 FrontlineApi < Domain
12
+ ##
13
+ # Initialize the FrontlineApi Domain
14
+ def initialize(twilio)
15
+ super
16
+
17
+ @base_url = 'https://frontline-api.twilio.com'
18
+ @host = 'frontline-api.twilio.com'
19
+ @port = 443
20
+
21
+ # Versions
22
+ @v1 = nil
23
+ end
24
+
25
+ ##
26
+ # Version v1 of frontline_api
27
+ def v1
28
+ @v1 ||= V1.new self
29
+ end
30
+
31
+ ##
32
+ # @param [String] sid The unique string that we created to identify the User
33
+ # resource.
34
+ # @return [Twilio::REST::Frontline_api::V1::UserInstance] if sid was passed.
35
+ # @return [Twilio::REST::Frontline_api::V1::UserList]
36
+ def users(sid=:unset)
37
+ self.v1.users(sid)
38
+ end
39
+
40
+ ##
41
+ # Provide a user friendly representation
42
+ def to_s
43
+ '#<Twilio::REST::FrontlineApi>'
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,45 @@
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 FrontlineApi
12
+ class V1 < Version
13
+ ##
14
+ # Initialize the V1 version of FrontlineApi
15
+ def initialize(domain)
16
+ super
17
+ @version = 'v1'
18
+ @users = nil
19
+ end
20
+
21
+ ##
22
+ # @param [String] sid The SID of the User resource to fetch. This value can be
23
+ # either the `sid` or the `identity` of the User resource to fetch.
24
+ # @return [Twilio::REST::Frontline_api::V1::UserContext] if sid was passed.
25
+ # @return [Twilio::REST::Frontline_api::V1::UserList]
26
+ def users(sid=:unset)
27
+ if sid.nil?
28
+ raise ArgumentError, 'sid cannot be nil'
29
+ end
30
+ if sid == :unset
31
+ @users ||= UserList.new self
32
+ else
33
+ UserContext.new(self, sid)
34
+ end
35
+ end
36
+
37
+ ##
38
+ # Provide a user friendly representation
39
+ def to_s
40
+ '<Twilio::REST::FrontlineApi::V1>'
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,233 @@
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 FrontlineApi < 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 UserList < ListResource
16
+ ##
17
+ # Initialize the UserList
18
+ # @param [Version] version Version that contains the resource
19
+ # @return [UserList] UserList
20
+ def initialize(version)
21
+ super(version)
22
+
23
+ # Path Solution
24
+ @solution = {}
25
+ end
26
+
27
+ ##
28
+ # Provide a user friendly representation
29
+ def to_s
30
+ '#<Twilio.FrontlineApi.V1.UserList>'
31
+ end
32
+ end
33
+
34
+ ##
35
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
36
+ class UserPage < Page
37
+ ##
38
+ # Initialize the UserPage
39
+ # @param [Version] version Version that contains the resource
40
+ # @param [Response] response Response from the API
41
+ # @param [Hash] solution Path solution for the resource
42
+ # @return [UserPage] UserPage
43
+ def initialize(version, response, solution)
44
+ super(version, response)
45
+
46
+ # Path Solution
47
+ @solution = solution
48
+ end
49
+
50
+ ##
51
+ # Build an instance of UserInstance
52
+ # @param [Hash] payload Payload response from the API
53
+ # @return [UserInstance] UserInstance
54
+ def get_instance(payload)
55
+ UserInstance.new(@version, payload, )
56
+ end
57
+
58
+ ##
59
+ # Provide a user friendly representation
60
+ def to_s
61
+ '<Twilio.FrontlineApi.V1.UserPage>'
62
+ end
63
+ end
64
+
65
+ ##
66
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
67
+ class UserContext < InstanceContext
68
+ ##
69
+ # Initialize the UserContext
70
+ # @param [Version] version Version that contains the resource
71
+ # @param [String] sid The SID of the User resource to fetch. This value can be
72
+ # either the `sid` or the `identity` of the User resource to fetch.
73
+ # @return [UserContext] UserContext
74
+ def initialize(version, sid)
75
+ super(version)
76
+
77
+ # Path Solution
78
+ @solution = {sid: sid, }
79
+ @uri = "/Users/#{@solution[:sid]}"
80
+ end
81
+
82
+ ##
83
+ # Fetch the UserInstance
84
+ # @return [UserInstance] Fetched UserInstance
85
+ def fetch
86
+ payload = @version.fetch('GET', @uri)
87
+
88
+ UserInstance.new(@version, payload, sid: @solution[:sid], )
89
+ end
90
+
91
+ ##
92
+ # Update the UserInstance
93
+ # @param [String] friendly_name The string that you assigned to describe the User.
94
+ # @param [String] avatar The avatar URL which will be shown in Frontline
95
+ # application.
96
+ # @param [user.StateType] state Current state of this user. Can be either `active`
97
+ # or `deactivated` and defaults to `active`
98
+ # @return [UserInstance] Updated UserInstance
99
+ def update(friendly_name: :unset, avatar: :unset, state: :unset)
100
+ data = Twilio::Values.of({'FriendlyName' => friendly_name, 'Avatar' => avatar, 'State' => state, })
101
+
102
+ payload = @version.update('POST', @uri, data: data)
103
+
104
+ UserInstance.new(@version, payload, sid: @solution[:sid], )
105
+ end
106
+
107
+ ##
108
+ # Provide a user friendly representation
109
+ def to_s
110
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
111
+ "#<Twilio.FrontlineApi.V1.UserContext #{context}>"
112
+ end
113
+
114
+ ##
115
+ # Provide a detailed, user friendly representation
116
+ def inspect
117
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
118
+ "#<Twilio.FrontlineApi.V1.UserContext #{context}>"
119
+ end
120
+ end
121
+
122
+ ##
123
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
124
+ class UserInstance < InstanceResource
125
+ ##
126
+ # Initialize the UserInstance
127
+ # @param [Version] version Version that contains the resource
128
+ # @param [Hash] payload payload that contains response from Twilio
129
+ # @param [String] sid The SID of the User resource to fetch. This value can be
130
+ # either the `sid` or the `identity` of the User resource to fetch.
131
+ # @return [UserInstance] UserInstance
132
+ def initialize(version, payload, sid: nil)
133
+ super(version)
134
+
135
+ # Marshaled Properties
136
+ @properties = {
137
+ 'sid' => payload['sid'],
138
+ 'identity' => payload['identity'],
139
+ 'friendly_name' => payload['friendly_name'],
140
+ 'avatar' => payload['avatar'],
141
+ 'state' => payload['state'],
142
+ 'url' => payload['url'],
143
+ }
144
+
145
+ # Context
146
+ @instance_context = nil
147
+ @params = {'sid' => sid || @properties['sid'], }
148
+ end
149
+
150
+ ##
151
+ # Generate an instance context for the instance, the context is capable of
152
+ # performing various actions. All instance actions are proxied to the context
153
+ # @return [UserContext] UserContext for this UserInstance
154
+ def context
155
+ unless @instance_context
156
+ @instance_context = UserContext.new(@version, @params['sid'], )
157
+ end
158
+ @instance_context
159
+ end
160
+
161
+ ##
162
+ # @return [String] The unique string that identifies the resource
163
+ def sid
164
+ @properties['sid']
165
+ end
166
+
167
+ ##
168
+ # @return [String] The string that identifies the resource's User
169
+ def identity
170
+ @properties['identity']
171
+ end
172
+
173
+ ##
174
+ # @return [String] The string that you assigned to describe the User
175
+ def friendly_name
176
+ @properties['friendly_name']
177
+ end
178
+
179
+ ##
180
+ # @return [String] The avatar URL which will be shown in Frontline application
181
+ def avatar
182
+ @properties['avatar']
183
+ end
184
+
185
+ ##
186
+ # @return [user.StateType] Current state of this user
187
+ def state
188
+ @properties['state']
189
+ end
190
+
191
+ ##
192
+ # @return [String] An absolute URL for this user.
193
+ def url
194
+ @properties['url']
195
+ end
196
+
197
+ ##
198
+ # Fetch the UserInstance
199
+ # @return [UserInstance] Fetched UserInstance
200
+ def fetch
201
+ context.fetch
202
+ end
203
+
204
+ ##
205
+ # Update the UserInstance
206
+ # @param [String] friendly_name The string that you assigned to describe the User.
207
+ # @param [String] avatar The avatar URL which will be shown in Frontline
208
+ # application.
209
+ # @param [user.StateType] state Current state of this user. Can be either `active`
210
+ # or `deactivated` and defaults to `active`
211
+ # @return [UserInstance] Updated UserInstance
212
+ def update(friendly_name: :unset, avatar: :unset, state: :unset)
213
+ context.update(friendly_name: friendly_name, avatar: avatar, state: state, )
214
+ end
215
+
216
+ ##
217
+ # Provide a user friendly representation
218
+ def to_s
219
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
220
+ "<Twilio.FrontlineApi.V1.UserInstance #{values}>"
221
+ end
222
+
223
+ ##
224
+ # Provide a detailed, user friendly representation
225
+ def inspect
226
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
227
+ "<Twilio.FrontlineApi.V1.UserInstance #{values}>"
228
+ end
229
+ end
230
+ end
231
+ end
232
+ end
233
+ end
@@ -94,6 +94,7 @@ module Twilio
94
94
 
95
95
  # Marshaled Properties
96
96
  @properties = {
97
+ 'sid' => payload['sid'],
97
98
  'account_sid' => payload['account_sid'],
98
99
  'campaign_id' => payload['campaign_id'],
99
100
  'messaging_service_sid' => payload['messaging_service_sid'],
@@ -101,6 +102,12 @@ module Twilio
101
102
  }
102
103
  end
103
104
 
105
+ ##
106
+ # @return [String] The unique string that identifies a US A2P Compliance resource
107
+ def sid
108
+ @properties['sid']
109
+ end
110
+
104
111
  ##
105
112
  # @return [String] The SID of the Account that created the resource
106
113
  def account_sid
@@ -385,8 +385,14 @@ module Twilio
385
385
  ##
386
386
  # Access the us_app_to_person
387
387
  # @return [UsAppToPersonList]
388
- # @return [UsAppToPersonContext]
389
- def us_app_to_person
388
+ # @return [UsAppToPersonContext] if sid was passed.
389
+ def us_app_to_person(sid=:unset)
390
+ raise ArgumentError, 'sid cannot be nil' if sid.nil?
391
+
392
+ if sid != :unset
393
+ return UsAppToPersonContext.new(@version, @solution[:sid], sid, )
394
+ end
395
+
390
396
  unless @us_app_to_person
391
397
  @us_app_to_person = UsAppToPersonList.new(@version, messaging_service_sid: @solution[:sid], )
392
398
  end
@@ -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,7 +266,7 @@ 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'],
@@ -155,6 +274,31 @@ module Twilio
155
274
  'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
156
275
  'url' => payload['url'],
157
276
  }
277
+
278
+ # Context
279
+ @instance_context = nil
280
+ @params = {'messaging_service_sid' => messaging_service_sid, 'sid' => sid || @properties['sid'], }
281
+ end
282
+
283
+ ##
284
+ # Generate an instance context for the instance, the context is capable of
285
+ # performing various actions. All instance actions are proxied to the context
286
+ # @return [UsAppToPersonContext] UsAppToPersonContext for this UsAppToPersonInstance
287
+ def context
288
+ unless @instance_context
289
+ @instance_context = UsAppToPersonContext.new(
290
+ @version,
291
+ @params['messaging_service_sid'],
292
+ @params['sid'],
293
+ )
294
+ end
295
+ @instance_context
296
+ end
297
+
298
+ ##
299
+ # @return [String] The unique string that identifies a US A2P Compliance resource
300
+ def sid
301
+ @properties['sid']
158
302
  end
159
303
 
160
304
  ##
@@ -207,8 +351,8 @@ module Twilio
207
351
 
208
352
  ##
209
353
  # @return [String] Campaign status
210
- def status
211
- @properties['status']
354
+ def campaign_status
355
+ @properties['campaign_status']
212
356
  end
213
357
 
214
358
  ##
@@ -247,16 +391,32 @@ module Twilio
247
391
  @properties['url']
248
392
  end
249
393
 
394
+ ##
395
+ # Delete the UsAppToPersonInstance
396
+ # @return [Boolean] true if delete succeeds, false otherwise
397
+ def delete
398
+ context.delete
399
+ end
400
+
401
+ ##
402
+ # Fetch the UsAppToPersonInstance
403
+ # @return [UsAppToPersonInstance] Fetched UsAppToPersonInstance
404
+ def fetch
405
+ context.fetch
406
+ end
407
+
250
408
  ##
251
409
  # Provide a user friendly representation
252
410
  def to_s
253
- "<Twilio.Messaging.V1.UsAppToPersonInstance>"
411
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
412
+ "<Twilio.Messaging.V1.UsAppToPersonInstance #{values}>"
254
413
  end
255
414
 
256
415
  ##
257
416
  # Provide a detailed, user friendly representation
258
417
  def inspect
259
- "<Twilio.Messaging.V1.UsAppToPersonInstance>"
418
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
419
+ "<Twilio.Messaging.V1.UsAppToPersonInstance #{values}>"
260
420
  end
261
421
  end
262
422
  end