twilio-ruby 5.25.2 → 5.25.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +11 -0
  3. data/README.md +2 -2
  4. data/lib/twilio-ruby/rest/authy.rb +8 -8
  5. data/lib/twilio-ruby/rest/authy/v1.rb +15 -15
  6. data/lib/twilio-ruby/rest/client.rb +7 -0
  7. data/lib/twilio-ruby/rest/conversations.rb +53 -0
  8. data/lib/twilio-ruby/rest/conversations/v1.rb +51 -0
  9. data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +471 -0
  10. data/lib/twilio-ruby/rest/conversations/v1/conversation/message.rb +416 -0
  11. data/lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb +407 -0
  12. data/lib/twilio-ruby/rest/conversations/v1/conversation/webhook.rb +432 -0
  13. data/lib/twilio-ruby/rest/conversations/v1/webhook.rb +272 -0
  14. data/lib/twilio-ruby/rest/flex_api.rb +6 -6
  15. data/lib/twilio-ruby/rest/flex_api/v1.rb +7 -7
  16. data/lib/twilio-ruby/rest/messaging.rb +8 -8
  17. data/lib/twilio-ruby/rest/messaging/v1.rb +14 -14
  18. data/lib/twilio-ruby/rest/preview.rb +20 -20
  19. data/lib/twilio-ruby/rest/preview/marketplace.rb +13 -13
  20. data/lib/twilio-ruby/rest/preview/trusted_comms.rb +14 -14
  21. data/lib/twilio-ruby/rest/serverless/v1/service/build.rb +14 -0
  22. data/lib/twilio-ruby/rest/serverless/v1/service/environment.rb +30 -0
  23. data/lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb +370 -0
  24. data/lib/twilio-ruby/rest/video.rb +9 -9
  25. data/lib/twilio-ruby/rest/video/v1.rb +16 -16
  26. data/lib/twilio-ruby/rest/wireless.rb +6 -6
  27. data/lib/twilio-ruby/rest/wireless/v1.rb +9 -8
  28. data/lib/twilio-ruby/rest/wireless/v1/rate_plan.rb +27 -18
  29. data/lib/twilio-ruby/twiml/voice_response.rb +161 -11
  30. data/lib/twilio-ruby/version.rb +1 -1
  31. data/spec/integration/conversations/v1/conversation/message_spec.rb +223 -0
  32. data/spec/integration/conversations/v1/conversation/participant_spec.rb +265 -0
  33. data/spec/integration/conversations/v1/conversation/webhook_spec.rb +286 -0
  34. data/spec/integration/conversations/v1/conversation_spec.rb +218 -0
  35. data/spec/integration/conversations/v1/webhook_spec.rb +88 -0
  36. data/spec/integration/serverless/v1/service/build_spec.rb +28 -0
  37. data/spec/integration/serverless/v1/service/environment/log_spec.rb +98 -0
  38. data/spec/integration/serverless/v1/service/environment_spec.rb +4 -2
  39. data/spec/integration/verify/v2/service/verification_spec.rb +36 -0
  40. data/spec/integration/wireless/v1/rate_plan_spec.rb +12 -12
  41. metadata +22 -2
@@ -28,12 +28,6 @@ module Twilio
28
28
  @v1 ||= V1.new self
29
29
  end
30
30
 
31
- ##
32
- # @return [Twilio::REST::Flex_api::V1::ConfigurationInstance]
33
- def configuration
34
- self.v1.configuration()
35
- end
36
-
37
31
  ##
38
32
  # @param [String] sid The unique ID of the FlexFlow
39
33
  # @return [Twilio::REST::Flex_api::V1::FlexFlowInstance] if sid was passed.
@@ -42,6 +36,12 @@ module Twilio
42
36
  self.v1.flex_flow(sid)
43
37
  end
44
38
 
39
+ ##
40
+ # @return [Twilio::REST::Flex_api::V1::ConfigurationInstance]
41
+ def configuration
42
+ self.v1.configuration()
43
+ end
44
+
45
45
  ##
46
46
  # Provide a user friendly representation
47
47
  def to_s
@@ -15,14 +15,8 @@ module Twilio
15
15
  def initialize(domain)
16
16
  super
17
17
  @version = 'v1'
18
- @configuration = nil
19
18
  @flex_flow = nil
20
- end
21
-
22
- ##
23
- # @return [Twilio::REST::Flex_api::V1::ConfigurationContext]
24
- def configuration
25
- @configuration ||= ConfigurationContext.new self
19
+ @configuration = nil
26
20
  end
27
21
 
28
22
  ##
@@ -39,6 +33,12 @@ module Twilio
39
33
  end
40
34
  end
41
35
 
36
+ ##
37
+ # @return [Twilio::REST::Flex_api::V1::ConfigurationContext]
38
+ def configuration
39
+ @configuration ||= ConfigurationContext.new self
40
+ end
41
+
42
42
  ##
43
43
  # Provide a user friendly representation
44
44
  def to_s
@@ -28,14 +28,6 @@ module Twilio
28
28
  @v1 ||= V1.new self
29
29
  end
30
30
 
31
- ##
32
- # @param [String] sid Unique 34 character ID of the Service.
33
- # @return [Twilio::REST::Messaging::V1::ServiceInstance] if sid was passed.
34
- # @return [Twilio::REST::Messaging::V1::ServiceList]
35
- def services(sid=:unset)
36
- self.v1.services(sid)
37
- end
38
-
39
31
  ##
40
32
  # @param [String] sid A 34 character string that uniquely identifies this
41
33
  # resource.
@@ -45,6 +37,14 @@ module Twilio
45
37
  self.v1.sessions(sid)
46
38
  end
47
39
 
40
+ ##
41
+ # @param [String] sid Unique 34 character ID of the Service.
42
+ # @return [Twilio::REST::Messaging::V1::ServiceInstance] if sid was passed.
43
+ # @return [Twilio::REST::Messaging::V1::ServiceList]
44
+ def services(sid=:unset)
45
+ self.v1.services(sid)
46
+ end
47
+
48
48
  ##
49
49
  # @return [Twilio::REST::Messaging::V1::WebhookInstance]
50
50
  def webhooks
@@ -15,37 +15,37 @@ module Twilio
15
15
  def initialize(domain)
16
16
  super
17
17
  @version = 'v1'
18
- @services = nil
19
18
  @sessions = nil
19
+ @services = nil
20
20
  @webhooks = nil
21
21
  end
22
22
 
23
23
  ##
24
- # @param [String] sid The sid
25
- # @return [Twilio::REST::Messaging::V1::ServiceContext] if sid was passed.
26
- # @return [Twilio::REST::Messaging::V1::ServiceList]
27
- def services(sid=:unset)
24
+ # @param [String] sid A 34 character string that uniquely identifies this
25
+ # resource.
26
+ # @return [Twilio::REST::Messaging::V1::SessionContext] if sid was passed.
27
+ # @return [Twilio::REST::Messaging::V1::SessionList]
28
+ def sessions(sid=:unset)
28
29
  if sid.nil?
29
30
  raise ArgumentError, 'sid cannot be nil'
30
31
  elsif sid == :unset
31
- @services ||= ServiceList.new self
32
+ @sessions ||= SessionList.new self
32
33
  else
33
- ServiceContext.new(self, sid)
34
+ SessionContext.new(self, sid)
34
35
  end
35
36
  end
36
37
 
37
38
  ##
38
- # @param [String] sid A 34 character string that uniquely identifies this
39
- # resource.
40
- # @return [Twilio::REST::Messaging::V1::SessionContext] if sid was passed.
41
- # @return [Twilio::REST::Messaging::V1::SessionList]
42
- def sessions(sid=:unset)
39
+ # @param [String] sid The sid
40
+ # @return [Twilio::REST::Messaging::V1::ServiceContext] if sid was passed.
41
+ # @return [Twilio::REST::Messaging::V1::ServiceList]
42
+ def services(sid=:unset)
43
43
  if sid.nil?
44
44
  raise ArgumentError, 'sid cannot be nil'
45
45
  elsif sid == :unset
46
- @sessions ||= SessionList.new self
46
+ @services ||= ServiceList.new self
47
47
  else
48
- SessionContext.new(self, sid)
48
+ ServiceContext.new(self, sid)
49
49
  end
50
50
  end
51
51
 
@@ -127,14 +127,6 @@ module Twilio
127
127
  self.hosted_numbers.hosted_number_orders(sid)
128
128
  end
129
129
 
130
- ##
131
- # @param [String] sid A 34 character string that uniquely identifies this Add-on.
132
- # @return [Twilio::REST::Preview::Marketplace::AvailableAddOnInstance] if sid was passed.
133
- # @return [Twilio::REST::Preview::Marketplace::AvailableAddOnList]
134
- def available_add_ons(sid=:unset)
135
- self.marketplace.available_add_ons(sid)
136
- end
137
-
138
130
  ##
139
131
  # @param [String] sid 34 character string that uniquely identifies the Add-on.
140
132
  # This Sid can also be found in the Console on that specific Add-ons page as the
@@ -145,6 +137,14 @@ module Twilio
145
137
  self.marketplace.installed_add_ons(sid)
146
138
  end
147
139
 
140
+ ##
141
+ # @param [String] sid A 34 character string that uniquely identifies this Add-on.
142
+ # @return [Twilio::REST::Preview::Marketplace::AvailableAddOnInstance] if sid was passed.
143
+ # @return [Twilio::REST::Preview::Marketplace::AvailableAddOnList]
144
+ def available_add_ons(sid=:unset)
145
+ self.marketplace.available_add_ons(sid)
146
+ end
147
+
148
148
  ##
149
149
  # @param [String] sid The sid
150
150
  # @return [Twilio::REST::Preview::Sync::ServiceInstance] if sid was passed.
@@ -192,18 +192,6 @@ module Twilio
192
192
  self.trusted_comms.branded_calls()
193
193
  end
194
194
 
195
- ##
196
- # @return [Twilio::REST::Preview::TrustedComms::CpsInstance]
197
- def cps
198
- self.trusted_comms.cps()
199
- end
200
-
201
- ##
202
- # @return [Twilio::REST::Preview::TrustedComms::CurrentCallInstance]
203
- def current_calls
204
- self.trusted_comms.current_calls()
205
- end
206
-
207
195
  ##
208
196
  # @return [Twilio::REST::Preview::TrustedComms::DeviceInstance]
209
197
  def devices
@@ -216,6 +204,18 @@ module Twilio
216
204
  self.trusted_comms.phone_calls()
217
205
  end
218
206
 
207
+ ##
208
+ # @return [Twilio::REST::Preview::TrustedComms::CurrentCallInstance]
209
+ def current_calls
210
+ self.trusted_comms.current_calls()
211
+ end
212
+
213
+ ##
214
+ # @return [Twilio::REST::Preview::TrustedComms::CpsInstance]
215
+ def cps
216
+ self.trusted_comms.cps()
217
+ end
218
+
219
219
  ##
220
220
  # Provide a user friendly representation
221
221
  def to_s
@@ -15,37 +15,37 @@ module Twilio
15
15
  def initialize(domain)
16
16
  super
17
17
  @version = 'marketplace'
18
- @available_add_ons = nil
19
18
  @installed_add_ons = nil
19
+ @available_add_ons = nil
20
20
  end
21
21
 
22
22
  ##
23
- # @param [String] sid The Available Add-on Sid that uniquely identifies this
23
+ # @param [String] sid The Installed Add-on Sid that uniquely identifies this
24
24
  # resource
25
- # @return [Twilio::REST::Preview::Marketplace::AvailableAddOnContext] if sid was passed.
26
- # @return [Twilio::REST::Preview::Marketplace::AvailableAddOnList]
27
- def available_add_ons(sid=:unset)
25
+ # @return [Twilio::REST::Preview::Marketplace::InstalledAddOnContext] if sid was passed.
26
+ # @return [Twilio::REST::Preview::Marketplace::InstalledAddOnList]
27
+ def installed_add_ons(sid=:unset)
28
28
  if sid.nil?
29
29
  raise ArgumentError, 'sid cannot be nil'
30
30
  elsif sid == :unset
31
- @available_add_ons ||= AvailableAddOnList.new self
31
+ @installed_add_ons ||= InstalledAddOnList.new self
32
32
  else
33
- AvailableAddOnContext.new(self, sid)
33
+ InstalledAddOnContext.new(self, sid)
34
34
  end
35
35
  end
36
36
 
37
37
  ##
38
- # @param [String] sid The Installed Add-on Sid that uniquely identifies this
38
+ # @param [String] sid The Available Add-on Sid that uniquely identifies this
39
39
  # resource
40
- # @return [Twilio::REST::Preview::Marketplace::InstalledAddOnContext] if sid was passed.
41
- # @return [Twilio::REST::Preview::Marketplace::InstalledAddOnList]
42
- def installed_add_ons(sid=:unset)
40
+ # @return [Twilio::REST::Preview::Marketplace::AvailableAddOnContext] if sid was passed.
41
+ # @return [Twilio::REST::Preview::Marketplace::AvailableAddOnList]
42
+ def available_add_ons(sid=:unset)
43
43
  if sid.nil?
44
44
  raise ArgumentError, 'sid cannot be nil'
45
45
  elsif sid == :unset
46
- @installed_add_ons ||= InstalledAddOnList.new self
46
+ @available_add_ons ||= AvailableAddOnList.new self
47
47
  else
48
- InstalledAddOnContext.new(self, sid)
48
+ AvailableAddOnContext.new(self, sid)
49
49
  end
50
50
  end
51
51
 
@@ -16,10 +16,10 @@ module Twilio
16
16
  super
17
17
  @version = 'TrustedComms'
18
18
  @branded_calls = nil
19
- @cps = nil
20
- @current_calls = nil
21
19
  @devices = nil
22
20
  @phone_calls = nil
21
+ @current_calls = nil
22
+ @cps = nil
23
23
  end
24
24
 
25
25
  ##
@@ -28,18 +28,6 @@ module Twilio
28
28
  @branded_calls ||= BrandedCallList.new self
29
29
  end
30
30
 
31
- ##
32
- # @return [Twilio::REST::Preview::TrustedComms::CpsContext]
33
- def cps
34
- @cps ||= CpsContext.new self
35
- end
36
-
37
- ##
38
- # @return [Twilio::REST::Preview::TrustedComms::CurrentCallContext]
39
- def current_calls
40
- @current_calls ||= CurrentCallContext.new self
41
- end
42
-
43
31
  ##
44
32
  # @return [Twilio::REST::Preview::TrustedComms::DeviceContext]
45
33
  def devices
@@ -52,6 +40,18 @@ module Twilio
52
40
  @phone_calls ||= PhoneCallList.new self
53
41
  end
54
42
 
43
+ ##
44
+ # @return [Twilio::REST::Preview::TrustedComms::CurrentCallContext]
45
+ def current_calls
46
+ @current_calls ||= CurrentCallContext.new self
47
+ end
48
+
49
+ ##
50
+ # @return [Twilio::REST::Preview::TrustedComms::CpsContext]
51
+ def cps
52
+ @cps ||= CpsContext.new self
53
+ end
54
+
55
55
  ##
56
56
  # Provide a user friendly representation
57
57
  def to_s
@@ -207,6 +207,13 @@ module Twilio
207
207
  BuildInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], )
208
208
  end
209
209
 
210
+ ##
211
+ # Deletes the BuildInstance
212
+ # @return [Boolean] true if delete succeeds, true otherwise
213
+ def delete
214
+ @version.delete('delete', @uri)
215
+ end
216
+
210
217
  ##
211
218
  # Provide a user friendly representation
212
219
  def to_s
@@ -333,6 +340,13 @@ module Twilio
333
340
  context.fetch
334
341
  end
335
342
 
343
+ ##
344
+ # Deletes the BuildInstance
345
+ # @return [Boolean] true if delete succeeds, true otherwise
346
+ def delete
347
+ context.delete
348
+ end
349
+
336
350
  ##
337
351
  # Provide a user friendly representation
338
352
  def to_s
@@ -189,6 +189,7 @@ module Twilio
189
189
  # Dependents
190
190
  @variables = nil
191
191
  @deployments = nil
192
+ @logs = nil
192
193
  end
193
194
 
194
195
  ##
@@ -262,6 +263,28 @@ module Twilio
262
263
  @deployments
263
264
  end
264
265
 
266
+ ##
267
+ # Access the logs
268
+ # @return [LogList]
269
+ # @return [LogContext] if sid was passed.
270
+ def logs(sid=:unset)
271
+ raise ArgumentError, 'sid cannot be nil' if sid.nil?
272
+
273
+ if sid != :unset
274
+ return LogContext.new(@version, @solution[:service_sid], @solution[:sid], sid, )
275
+ end
276
+
277
+ unless @logs
278
+ @logs = LogList.new(
279
+ @version,
280
+ service_sid: @solution[:service_sid],
281
+ environment_sid: @solution[:sid],
282
+ )
283
+ end
284
+
285
+ @logs
286
+ end
287
+
265
288
  ##
266
289
  # Provide a user friendly representation
267
290
  def to_s
@@ -416,6 +439,13 @@ module Twilio
416
439
  context.deployments
417
440
  end
418
441
 
442
+ ##
443
+ # Access the logs
444
+ # @return [logs] logs
445
+ def logs
446
+ context.logs
447
+ end
448
+
419
449
  ##
420
450
  # Provide a user friendly representation
421
451
  def to_s
@@ -0,0 +1,370 @@
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 Serverless < Domain
12
+ class V1 < Version
13
+ class ServiceContext < InstanceContext
14
+ class EnvironmentContext < InstanceContext
15
+ ##
16
+ # 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.
17
+ class LogList < ListResource
18
+ ##
19
+ # Initialize the LogList
20
+ # @param [Version] version Version that contains the resource
21
+ # @param [String] service_sid The unique SID identifier of the Service for this
22
+ # Log.
23
+ # @param [String] environment_sid The unique SID identifier of the Environment in
24
+ # which this Log occurred.
25
+ # @return [LogList] LogList
26
+ def initialize(version, service_sid: nil, environment_sid: nil)
27
+ super(version)
28
+
29
+ # Path Solution
30
+ @solution = {service_sid: service_sid, environment_sid: environment_sid}
31
+ @uri = "/Services/#{@solution[:service_sid]}/Environments/#{@solution[:environment_sid]}/Logs"
32
+ end
33
+
34
+ ##
35
+ # Lists LogInstance records from the API as a list.
36
+ # Unlike stream(), this operation is eager and will load `limit` records into
37
+ # memory before returning.
38
+ # @param [String] function_sid The unique SID identifier of the Function whose
39
+ # invocation produced this Log.
40
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
41
+ # guarantees to never return more than limit. Default is no limit
42
+ # @param [Integer] page_size Number of records to fetch per request, when
43
+ # not set will use the default value of 50 records. If no page_size is defined
44
+ # but a limit is defined, stream() will attempt to read the limit with the most
45
+ # efficient page size, i.e. min(limit, 1000)
46
+ # @return [Array] Array of up to limit results
47
+ def list(function_sid: :unset, limit: nil, page_size: nil)
48
+ self.stream(function_sid: function_sid, limit: limit, page_size: page_size).entries
49
+ end
50
+
51
+ ##
52
+ # Streams LogInstance records from the API as an Enumerable.
53
+ # This operation lazily loads records as efficiently as possible until the limit
54
+ # is reached.
55
+ # @param [String] function_sid The unique SID identifier of the Function whose
56
+ # invocation produced this Log.
57
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
58
+ # guarantees to never return more than limit. Default is no limit.
59
+ # @param [Integer] page_size Number of records to fetch per request, when
60
+ # not set will use the default value of 50 records. If no page_size is defined
61
+ # but a limit is defined, stream() will attempt to read the limit with the most
62
+ # efficient page size, i.e. min(limit, 1000)
63
+ # @return [Enumerable] Enumerable that will yield up to limit results
64
+ def stream(function_sid: :unset, limit: nil, page_size: nil)
65
+ limits = @version.read_limits(limit, page_size)
66
+
67
+ page = self.page(function_sid: function_sid, page_size: limits[:page_size], )
68
+
69
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
70
+ end
71
+
72
+ ##
73
+ # When passed a block, yields LogInstance records from the API.
74
+ # This operation lazily loads records as efficiently as possible until the limit
75
+ # is reached.
76
+ def each
77
+ limits = @version.read_limits
78
+
79
+ page = self.page(page_size: limits[:page_size], )
80
+
81
+ @version.stream(page,
82
+ limit: limits[:limit],
83
+ page_limit: limits[:page_limit]).each {|x| yield x}
84
+ end
85
+
86
+ ##
87
+ # Retrieve a single page of LogInstance records from the API.
88
+ # Request is executed immediately.
89
+ # @param [String] function_sid The unique SID identifier of the Function whose
90
+ # invocation produced this Log.
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
+ # @return [Page] Page of LogInstance
95
+ def page(function_sid: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
96
+ params = Twilio::Values.of({
97
+ 'FunctionSid' => function_sid,
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
+ LogPage.new(@version, response, @solution)
108
+ end
109
+
110
+ ##
111
+ # Retrieve a single page of LogInstance records from the API.
112
+ # Request is executed immediately.
113
+ # @param [String] target_url API-generated URL for the requested results page
114
+ # @return [Page] Page of LogInstance
115
+ def get_page(target_url)
116
+ response = @version.domain.request(
117
+ 'GET',
118
+ target_url
119
+ )
120
+ LogPage.new(@version, response, @solution)
121
+ end
122
+
123
+ ##
124
+ # Provide a user friendly representation
125
+ def to_s
126
+ '#<Twilio.Serverless.V1.LogList>'
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 LogPage < Page
133
+ ##
134
+ # Initialize the LogPage
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 [LogPage] LogPage
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 LogInstance
148
+ # @param [Hash] payload Payload response from the API
149
+ # @return [LogInstance] LogInstance
150
+ def get_instance(payload)
151
+ LogInstance.new(
152
+ @version,
153
+ payload,
154
+ service_sid: @solution[:service_sid],
155
+ environment_sid: @solution[:environment_sid],
156
+ )
157
+ end
158
+
159
+ ##
160
+ # Provide a user friendly representation
161
+ def to_s
162
+ '<Twilio.Serverless.V1.LogPage>'
163
+ end
164
+ end
165
+
166
+ ##
167
+ # 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.
168
+ class LogContext < InstanceContext
169
+ ##
170
+ # Initialize the LogContext
171
+ # @param [Version] version Version that contains the resource
172
+ # @param [String] service_sid The unique SID identifier of the Service for this
173
+ # Log.
174
+ # @param [String] environment_sid The unique SID identifier of the Environment in
175
+ # which this Log occurred.
176
+ # @param [String] sid The unique SID identifier of this Log.
177
+ # @return [LogContext] LogContext
178
+ def initialize(version, service_sid, environment_sid, sid)
179
+ super(version)
180
+
181
+ # Path Solution
182
+ @solution = {service_sid: service_sid, environment_sid: environment_sid, sid: sid, }
183
+ @uri = "/Services/#{@solution[:service_sid]}/Environments/#{@solution[:environment_sid]}/Logs/#{@solution[:sid]}"
184
+ end
185
+
186
+ ##
187
+ # Fetch a LogInstance
188
+ # @return [LogInstance] Fetched LogInstance
189
+ def fetch
190
+ params = Twilio::Values.of({})
191
+
192
+ payload = @version.fetch(
193
+ 'GET',
194
+ @uri,
195
+ params,
196
+ )
197
+
198
+ LogInstance.new(
199
+ @version,
200
+ payload,
201
+ service_sid: @solution[:service_sid],
202
+ environment_sid: @solution[:environment_sid],
203
+ sid: @solution[:sid],
204
+ )
205
+ end
206
+
207
+ ##
208
+ # Provide a user friendly representation
209
+ def to_s
210
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
211
+ "#<Twilio.Serverless.V1.LogContext #{context}>"
212
+ end
213
+
214
+ ##
215
+ # Provide a detailed, user friendly representation
216
+ def inspect
217
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
218
+ "#<Twilio.Serverless.V1.LogContext #{context}>"
219
+ end
220
+ end
221
+
222
+ ##
223
+ # 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.
224
+ class LogInstance < InstanceResource
225
+ ##
226
+ # Initialize the LogInstance
227
+ # @param [Version] version Version that contains the resource
228
+ # @param [Hash] payload payload that contains response from Twilio
229
+ # @param [String] service_sid The unique SID identifier of the Service for this
230
+ # Log.
231
+ # @param [String] environment_sid The unique SID identifier of the Environment in
232
+ # which this Log occurred.
233
+ # @param [String] sid The unique SID identifier of this Log.
234
+ # @return [LogInstance] LogInstance
235
+ def initialize(version, payload, service_sid: nil, environment_sid: nil, sid: nil)
236
+ super(version)
237
+
238
+ # Marshaled Properties
239
+ @properties = {
240
+ 'sid' => payload['sid'],
241
+ 'account_sid' => payload['account_sid'],
242
+ 'service_sid' => payload['service_sid'],
243
+ 'environment_sid' => payload['environment_sid'],
244
+ 'deployment_sid' => payload['deployment_sid'],
245
+ 'function_sid' => payload['function_sid'],
246
+ 'request_sid' => payload['request_sid'],
247
+ 'level' => payload['level'],
248
+ 'message' => payload['message'],
249
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
250
+ 'url' => payload['url'],
251
+ }
252
+
253
+ # Context
254
+ @instance_context = nil
255
+ @params = {
256
+ 'service_sid' => service_sid,
257
+ 'environment_sid' => environment_sid,
258
+ 'sid' => sid || @properties['sid'],
259
+ }
260
+ end
261
+
262
+ ##
263
+ # Generate an instance context for the instance, the context is capable of
264
+ # performing various actions. All instance actions are proxied to the context
265
+ # @return [LogContext] LogContext for this LogInstance
266
+ def context
267
+ unless @instance_context
268
+ @instance_context = LogContext.new(
269
+ @version,
270
+ @params['service_sid'],
271
+ @params['environment_sid'],
272
+ @params['sid'],
273
+ )
274
+ end
275
+ @instance_context
276
+ end
277
+
278
+ ##
279
+ # @return [String] Log Sid.
280
+ def sid
281
+ @properties['sid']
282
+ end
283
+
284
+ ##
285
+ # @return [String] Account Sid.
286
+ def account_sid
287
+ @properties['account_sid']
288
+ end
289
+
290
+ ##
291
+ # @return [String] Service Sid.
292
+ def service_sid
293
+ @properties['service_sid']
294
+ end
295
+
296
+ ##
297
+ # @return [String] Environment Sid.
298
+ def environment_sid
299
+ @properties['environment_sid']
300
+ end
301
+
302
+ ##
303
+ # @return [String] Deployment Sid.
304
+ def deployment_sid
305
+ @properties['deployment_sid']
306
+ end
307
+
308
+ ##
309
+ # @return [String] Function Sid.
310
+ def function_sid
311
+ @properties['function_sid']
312
+ end
313
+
314
+ ##
315
+ # @return [String] The request_sid
316
+ def request_sid
317
+ @properties['request_sid']
318
+ end
319
+
320
+ ##
321
+ # @return [log.Level] The level
322
+ def level
323
+ @properties['level']
324
+ end
325
+
326
+ ##
327
+ # @return [String] The message
328
+ def message
329
+ @properties['message']
330
+ end
331
+
332
+ ##
333
+ # @return [Time] The date that this Log was created.
334
+ def date_created
335
+ @properties['date_created']
336
+ end
337
+
338
+ ##
339
+ # @return [String] The URL of this Log.
340
+ def url
341
+ @properties['url']
342
+ end
343
+
344
+ ##
345
+ # Fetch a LogInstance
346
+ # @return [LogInstance] Fetched LogInstance
347
+ def fetch
348
+ context.fetch
349
+ end
350
+
351
+ ##
352
+ # Provide a user friendly representation
353
+ def to_s
354
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
355
+ "<Twilio.Serverless.V1.LogInstance #{values}>"
356
+ end
357
+
358
+ ##
359
+ # Provide a detailed, user friendly representation
360
+ def inspect
361
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
362
+ "<Twilio.Serverless.V1.LogInstance #{values}>"
363
+ end
364
+ end
365
+ end
366
+ end
367
+ end
368
+ end
369
+ end
370
+ end