twilio-ruby 5.0.0.rc4 → 5.0.0.rc5

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 (104) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +8 -1
  3. data/Makefile +3 -0
  4. data/lib/twilio-ruby.rb +0 -1
  5. data/lib/twilio-ruby/framework/version.rb +4 -4
  6. data/lib/twilio-ruby/rest/api/v2010/account.rb +0 -13
  7. data/lib/twilio-ruby/rest/api/v2010/account/address.rb +0 -13
  8. data/lib/twilio-ruby/rest/api/v2010/account/application.rb +0 -14
  9. data/lib/twilio-ruby/rest/api/v2010/account/authorized_connect_app.rb +0 -13
  10. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb +0 -13
  11. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +0 -13
  12. data/lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb +0 -11
  13. data/lib/twilio-ruby/rest/api/v2010/account/call/feedback_summary.rb +0 -13
  14. data/lib/twilio-ruby/rest/api/v2010/account/call/notification.rb +0 -14
  15. data/lib/twilio-ruby/rest/api/v2010/account/call/recording.rb +0 -14
  16. data/lib/twilio-ruby/rest/api/v2010/account/conference.rb +0 -13
  17. data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +0 -14
  18. data/lib/twilio-ruby/rest/api/v2010/account/connect_app.rb +0 -13
  19. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb +0 -14
  20. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +0 -13
  21. data/lib/twilio-ruby/rest/api/v2010/account/message/media.rb +0 -14
  22. data/lib/twilio-ruby/rest/api/v2010/account/notification.rb +0 -13
  23. data/lib/twilio-ruby/rest/api/v2010/account/outgoing_caller_id.rb +0 -14
  24. data/lib/twilio-ruby/rest/api/v2010/account/queue.rb +0 -13
  25. data/lib/twilio-ruby/rest/api/v2010/account/queue/member.rb +0 -14
  26. data/lib/twilio-ruby/rest/api/v2010/account/recording.rb +0 -13
  27. data/lib/twilio-ruby/rest/api/v2010/account/recording/transcription.rb +0 -14
  28. data/lib/twilio-ruby/rest/api/v2010/account/sandbox.rb +0 -10
  29. data/lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb +0 -13
  30. data/lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb +0 -14
  31. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb +0 -13
  32. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/credential_list_mapping.rb +0 -14
  33. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.rb +0 -14
  34. data/lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list.rb +0 -14
  35. data/lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list/ip_address.rb +0 -14
  36. data/lib/twilio-ruby/rest/api/v2010/account/sms/short_code.rb +0 -13
  37. data/lib/twilio-ruby/rest/api/v2010/account/sms/sms_message.rb +0 -13
  38. data/lib/twilio-ruby/rest/api/v2010/account/transcription.rb +0 -13
  39. data/lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb +0 -13
  40. data/lib/twilio-ruby/rest/client.rb +7 -7
  41. data/lib/twilio-ruby/rest/ip_messaging/v1/credential.rb +0 -12
  42. data/lib/twilio-ruby/rest/ip_messaging/v1/service.rb +0 -12
  43. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb +0 -13
  44. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/member.rb +0 -14
  45. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb +0 -14
  46. data/lib/twilio-ruby/rest/ip_messaging/v1/service/role.rb +0 -13
  47. data/lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb +0 -18
  48. data/lib/twilio-ruby/rest/lookups/v1/phone_number.rb +0 -12
  49. data/lib/twilio-ruby/rest/monitor/v1/alert.rb +0 -12
  50. data/lib/twilio-ruby/rest/monitor/v1/event.rb +0 -12
  51. data/lib/twilio-ruby/rest/notifications.rb +4 -0
  52. data/lib/twilio-ruby/rest/notifications/v1.rb +9 -0
  53. data/lib/twilio-ruby/rest/notifications/v1/credential.rb +390 -0
  54. data/lib/twilio-ruby/rest/notifications/v1/service.rb +0 -12
  55. data/lib/twilio-ruby/rest/notifications/v1/service/binding.rb +0 -13
  56. data/lib/twilio-ruby/rest/preview.rb +47 -0
  57. data/lib/twilio-ruby/rest/preview/wireless.rb +53 -0
  58. data/lib/twilio-ruby/rest/preview/wireless/command.rb +345 -0
  59. data/lib/twilio-ruby/rest/preview/wireless/device.rb +456 -0
  60. data/lib/twilio-ruby/rest/preview/wireless/device/usage.rb +227 -0
  61. data/lib/twilio-ruby/rest/preview/wireless/rate_plan.rb +325 -0
  62. data/lib/twilio-ruby/rest/pricing/v1/messaging/country.rb +0 -12
  63. data/lib/twilio-ruby/rest/pricing/v1/phone_number/country.rb +0 -12
  64. data/lib/twilio-ruby/rest/pricing/v1/voice/country.rb +0 -12
  65. data/lib/twilio-ruby/rest/pricing/v1/voice/number.rb +0 -12
  66. data/lib/twilio-ruby/rest/taskrouter/v1/workspace.rb +0 -12
  67. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb +0 -13
  68. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb +0 -13
  69. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb +0 -13
  70. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task/reservation.rb +0 -14
  71. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb +0 -13
  72. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.rb +0 -11
  73. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb +0 -13
  74. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_statistics.rb +0 -11
  75. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_statistics.rb +0 -10
  76. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb +0 -13
  77. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_statistics.rb +0 -11
  78. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_statistics.rb +0 -10
  79. data/lib/twilio-ruby/rest/trunking/v1/trunk.rb +0 -12
  80. data/lib/twilio-ruby/rest/trunking/v1/trunk/credential_list.rb +0 -13
  81. data/lib/twilio-ruby/rest/trunking/v1/trunk/ip_access_control_list.rb +0 -13
  82. data/lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb +0 -13
  83. data/lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb +0 -13
  84. data/lib/twilio-ruby/version.rb +1 -1
  85. data/spec/integration/api/v2010/account/usage/trigger_spec.rb +3 -3
  86. data/spec/integration/ip_messaging/v1/credential_spec.rb +1 -1
  87. data/spec/integration/ip_messaging/v1/service/role_spec.rb +1 -1
  88. data/spec/integration/notifications/v1/credential_spec.rb +228 -0
  89. data/spec/integration/notifications/v1/service/binding_spec.rb +2 -2
  90. data/spec/integration/preview/wireless/command_spec.rb +58 -0
  91. data/spec/integration/preview/wireless/device/usage_spec.rb +25 -0
  92. data/spec/integration/preview/wireless/device_spec.rb +72 -0
  93. data/spec/integration/preview/wireless/rate_plan_spec.rb +39 -0
  94. metadata +19 -16
  95. data/lib/twilio-ruby/rest/conversations.rb +0 -40
  96. data/lib/twilio-ruby/rest/conversations/v1.rb +0 -35
  97. data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +0 -270
  98. data/lib/twilio-ruby/rest/conversations/v1/conversation/completed.rb +0 -217
  99. data/lib/twilio-ruby/rest/conversations/v1/conversation/in_progress.rb +0 -217
  100. data/lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb +0 -352
  101. data/spec/integration/conversations/v1/conversation/completed_spec.rb +0 -89
  102. data/spec/integration/conversations/v1/conversation/in_progress_spec.rb +0 -89
  103. data/spec/integration/conversations/v1/conversation/participant_spec.rb +0 -174
  104. data/spec/integration/conversations/v1/conversation_spec.rb +0 -49
@@ -141,20 +141,6 @@ module Twilio
141
141
  return MessagePage.new(@version, response, @solution)
142
142
  end
143
143
 
144
- ##
145
- # Constructs a MessageContext
146
- # @param [String] sid The sid
147
-
148
- # @return [MessageContext] MessageContext
149
- def get(sid)
150
- MessageContext.new(
151
- @version,
152
- service_sid: @solution[:service_sid],
153
- channel_sid: @solution[:channel_sid],
154
- sid: sid,
155
- )
156
- end
157
-
158
144
  ##
159
145
  # Provide a user friendly representation
160
146
  def to_s
@@ -139,19 +139,6 @@ module Twilio
139
139
  return RolePage.new(@version, response, @solution)
140
140
  end
141
141
 
142
- ##
143
- # Constructs a RoleContext
144
- # @param [String] sid The sid
145
-
146
- # @return [RoleContext] RoleContext
147
- def get(sid)
148
- RoleContext.new(
149
- @version,
150
- service_sid: @solution[:service_sid],
151
- sid: sid,
152
- )
153
- end
154
-
155
142
  ##
156
143
  # Provide a user friendly representation
157
144
  def to_s
@@ -137,19 +137,6 @@ module Twilio
137
137
  return UserPage.new(@version, response, @solution)
138
138
  end
139
139
 
140
- ##
141
- # Constructs a UserContext
142
- # @param [String] sid The sid
143
-
144
- # @return [UserContext] UserContext
145
- def get(sid)
146
- UserContext.new(
147
- @version,
148
- service_sid: @solution[:service_sid],
149
- sid: sid,
150
- )
151
- end
152
-
153
140
  ##
154
141
  # Provide a user friendly representation
155
142
  def to_s
@@ -293,7 +280,6 @@ module Twilio
293
280
  'date_created' => Twilio.deserialize_iso8601(payload['date_created']),
294
281
  'date_updated' => Twilio.deserialize_iso8601(payload['date_updated']),
295
282
  'url' => payload['url'],
296
- 'links' => payload['links'],
297
283
  }
298
284
 
299
285
  # Context
@@ -353,10 +339,6 @@ module Twilio
353
339
  @properties['url']
354
340
  end
355
341
 
356
- def links
357
- @properties['links']
358
- end
359
-
360
342
  ##
361
343
  # Fetch a UserInstance
362
344
  # @return [UserInstance] Fetched UserInstance
@@ -21,18 +21,6 @@ module Twilio
21
21
  @solution = {}
22
22
  end
23
23
 
24
- ##
25
- # Constructs a PhoneNumberContext
26
- # @param [String] phone_number The phone_number
27
-
28
- # @return [PhoneNumberContext] PhoneNumberContext
29
- def get(phone_number)
30
- PhoneNumberContext.new(
31
- @version,
32
- phone_number: phone_number,
33
- )
34
- end
35
-
36
24
  ##
37
25
  # Provide a user friendly representation
38
26
  def to_s
@@ -156,18 +156,6 @@ module Twilio
156
156
  return AlertPage.new(@version, response, @solution)
157
157
  end
158
158
 
159
- ##
160
- # Constructs a AlertContext
161
- # @param [String] sid The sid
162
-
163
- # @return [AlertContext] AlertContext
164
- def get(sid)
165
- AlertContext.new(
166
- @version,
167
- sid: sid,
168
- )
169
- end
170
-
171
159
  ##
172
160
  # Provide a user friendly representation
173
161
  def to_s
@@ -177,18 +177,6 @@ module Twilio
177
177
  return EventPage.new(@version, response, @solution)
178
178
  end
179
179
 
180
- ##
181
- # Constructs a EventContext
182
- # @param [String] sid The sid
183
-
184
- # @return [EventContext] EventContext
185
- def get(sid)
186
- EventContext.new(
187
- @version,
188
- sid: sid,
189
- )
190
- end
191
-
192
180
  ##
193
181
  # Provide a user friendly representation
194
182
  def to_s
@@ -26,6 +26,10 @@ module Twilio
26
26
  @v1 ||= V1.new self
27
27
  end
28
28
 
29
+ def credentials
30
+ self.v1.credentials
31
+ end
32
+
29
33
  def services
30
34
  self.v1.services
31
35
  end
@@ -13,9 +13,18 @@ module Twilio
13
13
  def initialize(domain)
14
14
  super
15
15
  @version = 'v1'
16
+ @credentials = nil
16
17
  @services = nil
17
18
  end
18
19
 
20
+ def credentials(sid=:unset)
21
+ if sid == :unset
22
+ @credentials ||= CredentialList.new self
23
+ else
24
+ CredentialContext.new(self, sid)
25
+ end
26
+ end
27
+
19
28
  def services(sid=:unset)
20
29
  if sid == :unset
21
30
  @services ||= ServiceList.new self
@@ -0,0 +1,390 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+
7
+ module Twilio
8
+ module REST
9
+ class Notifications < Domain
10
+ class V1 < Version
11
+ class CredentialList < ListResource
12
+ ##
13
+ # Initialize the CredentialList
14
+ # @param [Version] version Version that contains the resource
15
+
16
+ # @return [CredentialList] CredentialList
17
+ def initialize(version)
18
+ super(version)
19
+
20
+ # Path Solution
21
+ @solution = {}
22
+ @uri = "/Credentials"
23
+ end
24
+
25
+ ##
26
+ # Lists CredentialInstance records from the API as a list.
27
+ # Unlike stream(), this operation is eager and will load `limit` records into
28
+ # memory before returning.
29
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
30
+ # guarantees to never return more than limit. Default is no limit
31
+ # @param [Integer] page_size Number of records to fetch per request, when not set will use
32
+ # the default value of 50 records. If no page_size is defined
33
+ # but a limit is defined, stream() will attempt to read the
34
+ # limit with the most efficient page size, i.e. min(limit, 1000)
35
+
36
+ # @return [Array] Array of up to limit results
37
+ def list(limit: nil, page_size: nil)
38
+ self.stream(
39
+ limit: limit,
40
+ page_size: page_size
41
+ ).entries
42
+ end
43
+
44
+ ##
45
+ # Streams CredentialInstance records from the API as an Enumerable.
46
+ # This operation lazily loads records as efficiently as possible until the limit
47
+ # is reached.
48
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
49
+ # guarantees to never return more than limit. Default is no limit
50
+ # @param [Integer] page_size Number of records to fetch per request, when not set will use
51
+ # the default value of 50 records. If no page_size is defined
52
+ # but a limit is defined, stream() will attempt to read the
53
+ # limit with the most efficient page size, i.e. min(limit, 1000)
54
+
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(
60
+ page_size: limits['page_size'],
61
+ )
62
+
63
+ @version.stream(page, limit: limits['limit'], page_limit: limits['page_limit'])
64
+ end
65
+
66
+ ##
67
+ # When passed a block, yields CredentialInstance records from the API.
68
+ # This operation lazily loads records as efficiently as possible until the limit
69
+ # is reached.
70
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
71
+ # guarantees to never return more than limit. Default is no limit
72
+ # @param [Integer] page_size Number of records to fetch per request, when not set will use
73
+ # the default value of 50 records. If no page_size is defined
74
+ # but a limit is defined, stream() will attempt to read the
75
+ # limit with the most efficient page size, i.e. min(limit, 1000)
76
+ def each
77
+ limits = @version.read_limits
78
+
79
+ page = self.page(
80
+ page_size: limits['page_size'],
81
+ )
82
+
83
+ @version.stream(page,
84
+ limit: limits['limit'],
85
+ page_limit: limits['page_limit']).each {|x| yield x}
86
+ end
87
+
88
+ ##
89
+ # Retrieve a single page of CredentialInstance records from the API.
90
+ # Request is executed immediately.
91
+ # @param [String] page_token PageToken provided by the API
92
+ # @param [Integer] page_number Page Number, this value is simply for client state
93
+ # @param [Integer] page_size Number of records to return, defaults to 50
94
+
95
+ # @return [Page] Page of CredentialInstance
96
+ def page(page_token: nil, page_number: nil, page_size: nil)
97
+ params = {
98
+ 'PageToken' => page_token,
99
+ 'Page' => page_number,
100
+ 'PageSize' => page_size,
101
+ }
102
+ response = @version.page(
103
+ 'GET',
104
+ @uri,
105
+ params
106
+ )
107
+ return CredentialPage.new(@version, response, @solution)
108
+ end
109
+
110
+ ##
111
+ # Retrieve a single page of CredentialInstance records from the API.
112
+ # Request is executed immediately.
113
+ # @param [String] friendly_name The friendly_name
114
+ # @param [credential.PushService] type The type
115
+ # @param [String] certificate The certificate
116
+ # @param [String] private_key The private_key
117
+ # @param [Boolean] sandbox The sandbox
118
+ # @param [String] api_key The api_key
119
+
120
+ # @return [CredentialInstance] Newly created CredentialInstance
121
+ def create(friendly_name: nil, type: nil, certificate: nil, private_key: nil, sandbox: nil, api_key: nil)
122
+ data = {
123
+ 'FriendlyName' => friendly_name,
124
+ 'Type' => type,
125
+ 'Certificate' => certificate,
126
+ 'PrivateKey' => private_key,
127
+ 'Sandbox' => sandbox,
128
+ 'ApiKey' => api_key,
129
+ }
130
+
131
+ payload = @version.create(
132
+ 'POST',
133
+ @uri,
134
+ data: data
135
+ )
136
+
137
+ return CredentialInstance.new(
138
+ @version,
139
+ payload,
140
+ )
141
+ end
142
+
143
+ ##
144
+ # Provide a user friendly representation
145
+ def to_s
146
+ '#<Twilio.Notifications.V1.CredentialList>'
147
+ end
148
+ end
149
+
150
+ class CredentialPage < Page
151
+ ##
152
+ # Initialize the CredentialPage
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
+
157
+ # @return [CredentialPage] CredentialPage
158
+ def initialize(version, response, solution)
159
+ super(version, response)
160
+
161
+ # Path Solution
162
+ @solution = solution
163
+ end
164
+
165
+ ##
166
+ # Build an instance of CredentialInstance
167
+ # @param [Hash] payload Payload response from the API
168
+
169
+ # @return [CredentialInstance] CredentialInstance
170
+ def get_instance(payload)
171
+ return CredentialInstance.new(
172
+ @version,
173
+ payload,
174
+ )
175
+ end
176
+
177
+ ##
178
+ # Provide a user friendly representation
179
+ def to_s
180
+ '<Twilio.Notifications.V1.CredentialPage>'
181
+ end
182
+ end
183
+
184
+ class CredentialContext < InstanceContext
185
+ ##
186
+ # Initialize the CredentialContext
187
+ # @param [Version] version Version that contains the resource
188
+ # @param [String] sid The sid
189
+
190
+ # @return [CredentialContext] CredentialContext
191
+ def initialize(version, sid)
192
+ super(version)
193
+
194
+ # Path Solution
195
+ @solution = {
196
+ sid: sid,
197
+ }
198
+ @uri = "/Credentials/#{@solution[:sid]}"
199
+ end
200
+
201
+ ##
202
+ # Fetch a CredentialInstance
203
+ # @return [CredentialInstance] Fetched CredentialInstance
204
+ def fetch
205
+ params = {}
206
+
207
+ payload = @version.fetch(
208
+ 'GET',
209
+ @uri,
210
+ params,
211
+ )
212
+
213
+ return CredentialInstance.new(
214
+ @version,
215
+ payload,
216
+ sid: @solution['sid'],
217
+ )
218
+ end
219
+
220
+ ##
221
+ # Update the CredentialInstance
222
+ # @param [String] friendly_name The friendly_name
223
+ # @param [credential.PushService] type The type
224
+ # @param [String] certificate The certificate
225
+ # @param [String] private_key The private_key
226
+ # @param [Boolean] sandbox The sandbox
227
+ # @param [String] api_key The api_key
228
+
229
+ # @return [CredentialInstance] Updated CredentialInstance
230
+ def update(friendly_name: nil, type: nil, certificate: nil, private_key: nil, sandbox: nil, api_key: nil)
231
+ data = {
232
+ 'FriendlyName' => friendly_name,
233
+ 'Type' => type,
234
+ 'Certificate' => certificate,
235
+ 'PrivateKey' => private_key,
236
+ 'Sandbox' => sandbox,
237
+ 'ApiKey' => api_key,
238
+ }
239
+
240
+ payload = @version.update(
241
+ 'POST',
242
+ @uri,
243
+ data: data,
244
+ )
245
+
246
+ return CredentialInstance.new(
247
+ @version,
248
+ payload,
249
+ sid: @solution['sid'],
250
+ )
251
+ end
252
+
253
+ ##
254
+ # Deletes the CredentialInstance
255
+ # @return [Boolean] true if delete succeeds, true otherwise
256
+ def delete
257
+ return @version.delete('delete', @uri)
258
+ end
259
+
260
+ ##
261
+ # Provide a user friendly representation
262
+ def to_s
263
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
264
+ "#<Twilio.Notifications.V1.CredentialContext #{context}>"
265
+ end
266
+ end
267
+
268
+ class CredentialInstance < InstanceResource
269
+ ##
270
+ # Initialize the CredentialInstance
271
+ # @param [Version] version Version that contains the resource
272
+ # @param [Hash] payload payload that contains response from Twilio
273
+ # @param [String] sid The sid
274
+
275
+ # @return [CredentialInstance] CredentialInstance
276
+ def initialize(version, payload, sid: nil)
277
+ super(version)
278
+
279
+ # Marshaled Properties
280
+ @properties = {
281
+ 'sid' => payload['sid'],
282
+ 'account_sid' => payload['account_sid'],
283
+ 'friendly_name' => payload['friendly_name'],
284
+ 'type' => payload['type'],
285
+ 'sandbox' => payload['sandbox'],
286
+ 'date_created' => Twilio.deserialize_iso8601(payload['date_created']),
287
+ 'date_updated' => Twilio.deserialize_iso8601(payload['date_updated']),
288
+ 'url' => payload['url'],
289
+ }
290
+
291
+ # Context
292
+ @instance_context = nil
293
+ @params = {
294
+ 'sid' => sid || @properties['sid'],
295
+ }
296
+ end
297
+
298
+ ##
299
+ # Generate an instance context for the instance, the context is capable of
300
+ # performing various actions. All instance actions are proxied to the context
301
+ # @param [Version] version Version that contains the resource
302
+
303
+ # @return [CredentialContext] CredentialContext for this CredentialInstance
304
+ def context
305
+ unless @instance_context
306
+ @instance_context = CredentialContext.new(
307
+ @version,
308
+ @params['sid'],
309
+ )
310
+ end
311
+ @instance_context
312
+ end
313
+
314
+ def sid
315
+ @properties['sid']
316
+ end
317
+
318
+ def account_sid
319
+ @properties['account_sid']
320
+ end
321
+
322
+ def friendly_name
323
+ @properties['friendly_name']
324
+ end
325
+
326
+ def type
327
+ @properties['type']
328
+ end
329
+
330
+ def sandbox
331
+ @properties['sandbox']
332
+ end
333
+
334
+ def date_created
335
+ @properties['date_created']
336
+ end
337
+
338
+ def date_updated
339
+ @properties['date_updated']
340
+ end
341
+
342
+ def url
343
+ @properties['url']
344
+ end
345
+
346
+ ##
347
+ # Fetch a CredentialInstance
348
+ # @return [CredentialInstance] Fetched CredentialInstance
349
+ def fetch
350
+ @context.fetch()
351
+ end
352
+
353
+ ##
354
+ # Update the CredentialInstance
355
+ # @param [String] friendly_name The friendly_name
356
+ # @param [credential.PushService] type The type
357
+ # @param [String] certificate The certificate
358
+ # @param [String] private_key The private_key
359
+ # @param [Boolean] sandbox The sandbox
360
+ # @param [String] api_key The api_key
361
+
362
+ # @return [CredentialInstance] Updated CredentialInstance
363
+ def update(friendly_name: nil, type: nil, certificate: nil, private_key: nil, sandbox: nil, api_key: nil)
364
+ @context.update(
365
+ type: type,
366
+ certificate: certificate,
367
+ private_key: private_key,
368
+ sandbox: sandbox,
369
+ api_key: api_key,
370
+ )
371
+ end
372
+
373
+ ##
374
+ # Deletes the CredentialInstance
375
+ # @return [Boolean] true if delete succeeds, true otherwise
376
+ def delete
377
+ @context.delete()
378
+ end
379
+
380
+ ##
381
+ # Provide a user friendly representation
382
+ def to_s
383
+ context = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
384
+ "<Twilio.Notifications.V1.CredentialInstance #{context}>"
385
+ end
386
+ end
387
+ end
388
+ end
389
+ end
390
+ end