twilio-ruby 5.33.0 → 5.36.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +8 -0
  3. data/.rubocop_todo.yml +5 -26
  4. data/.travis.yml +9 -1
  5. data/CHANGES.md +110 -0
  6. data/README.md +17 -2
  7. data/lib/twilio-ruby.rb +4 -12
  8. data/lib/twilio-ruby/framework/error.rb +3 -3
  9. data/lib/twilio-ruby/jwt/jwt.rb +6 -0
  10. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +90 -90
  11. data/lib/twilio-ruby/rest/api/v2010/account/conference.rb +14 -0
  12. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +75 -72
  13. data/lib/twilio-ruby/rest/api/v2010/account/queue.rb +29 -29
  14. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb +38 -3
  15. data/lib/twilio-ruby/rest/autopilot.rb +6 -0
  16. data/lib/twilio-ruby/rest/autopilot/v1.rb +7 -0
  17. data/lib/twilio-ruby/rest/autopilot/v1/restore_assistant.rb +198 -0
  18. data/lib/twilio-ruby/rest/client.rb +35 -8
  19. data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +19 -3
  20. data/lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb +27 -4
  21. data/lib/twilio-ruby/rest/flex_api/v1/channel.rb +2 -1
  22. data/lib/twilio-ruby/rest/flex_api/v1/configuration.rb +7 -0
  23. data/lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb +20 -11
  24. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb +26 -0
  25. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/evaluation.rb +324 -0
  26. data/lib/twilio-ruby/rest/preview/trusted_comms/business.rb +26 -0
  27. data/lib/twilio-ruby/rest/preview/trusted_comms/business/brand.rb +239 -0
  28. data/lib/twilio-ruby/rest/preview/trusted_comms/business/brand/branded_channel.rb +266 -0
  29. data/lib/twilio-ruby/rest/preview/trusted_comms/business/brand/branded_channel/channel.rb +197 -0
  30. data/lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb +7 -0
  31. data/lib/twilio-ruby/rest/studio.rb +2 -2
  32. data/lib/twilio-ruby/rest/studio/v1/flow/execution.rb +26 -0
  33. data/lib/twilio-ruby/rest/studio/v2.rb +3 -3
  34. data/lib/twilio-ruby/rest/studio/v2/flow.rb +7 -0
  35. data/lib/twilio-ruby/rest/studio/v2/flow/execution.rb +71 -24
  36. data/lib/twilio-ruby/rest/studio/v2/flow/execution/execution_context.rb +12 -11
  37. data/lib/twilio-ruby/rest/studio/v2/flow/execution/execution_step.rb +21 -20
  38. data/lib/twilio-ruby/rest/studio/v2/flow/execution/execution_step/execution_step_context.rb +18 -15
  39. data/lib/twilio-ruby/rest/supersim.rb +18 -0
  40. data/lib/twilio-ruby/rest/supersim/v1.rb +30 -0
  41. data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +53 -10
  42. data/lib/twilio-ruby/rest/supersim/v1/network.rb +315 -0
  43. data/lib/twilio-ruby/rest/supersim/v1/network_access_profile.rb +378 -0
  44. data/lib/twilio-ruby/rest/supersim/v1/network_access_profile/network_access_profile_network.rb +352 -0
  45. data/lib/twilio-ruby/rest/verify.rb +9 -0
  46. data/lib/twilio-ruby/rest/verify/v2.rb +16 -0
  47. data/lib/twilio-ruby/rest/verify/v2/form.rb +197 -0
  48. data/lib/twilio-ruby/rest/verify/v2/service.rb +48 -3
  49. data/lib/twilio-ruby/rest/verify/v2/service/entity.rb +379 -0
  50. data/lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb +500 -0
  51. data/lib/twilio-ruby/rest/verify/v2/service/entity/factor/challenge.rb +494 -0
  52. data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +3 -3
  53. data/lib/twilio-ruby/rest/video/v1/composition_settings.rb +8 -12
  54. data/lib/twilio-ruby/rest/video/v1/recording_settings.rb +8 -12
  55. data/lib/twilio-ruby/rest/voice.rb +36 -0
  56. data/lib/twilio-ruby/rest/voice/v1.rb +64 -0
  57. data/lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb +513 -0
  58. data/lib/twilio-ruby/rest/voice/v1/connection_policy.rb +379 -0
  59. data/lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb +458 -0
  60. data/lib/twilio-ruby/rest/voice/v1/ip_record.rb +366 -0
  61. data/lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb +346 -0
  62. data/lib/twilio-ruby/twiml/twiml.rb +4 -0
  63. data/lib/twilio-ruby/twiml/voice_response.rb +3 -2
  64. data/lib/twilio-ruby/util/configuration.rb +9 -1
  65. data/lib/twilio-ruby/version.rb +1 -1
  66. data/spec/integration/api/v2010/account/call_spec.rb +5 -5
  67. data/spec/integration/api/v2010/account/conference_spec.rb +42 -14
  68. data/spec/integration/api/v2010/account/sip/domain_spec.rb +12 -4
  69. data/spec/integration/api/v2010/account/token_spec.rb +23 -11
  70. data/spec/integration/autopilot/v1/restore_assistant_spec.rb +53 -0
  71. data/spec/integration/bulkexports/v1/export/day_spec.rb +1 -1
  72. data/spec/integration/conversations/v1/conversation/participant_spec.rb +7 -0
  73. data/spec/integration/conversations/v1/conversation_spec.rb +4 -0
  74. data/spec/integration/flex_api/v1/configuration_spec.rb +3 -0
  75. data/spec/integration/numbers/v2/regulatory_compliance/bundle/evaluation_spec.rb +623 -0
  76. data/spec/integration/numbers/v2/regulatory_compliance/bundle_spec.rb +4 -0
  77. data/spec/integration/preview/bulk_exports/export/day_spec.rb +1 -1
  78. data/spec/integration/preview/trusted_comms/business/brand/branded_channel/channel_spec.rb +54 -0
  79. data/spec/integration/preview/trusted_comms/business/brand/branded_channel_spec.rb +52 -0
  80. data/spec/integration/preview/trusted_comms/business/brand_spec.rb +49 -0
  81. data/spec/integration/preview/trusted_comms/business_spec.rb +1 -0
  82. data/spec/integration/serverless/v1/service/asset/asset_version_spec.rb +1 -1
  83. data/spec/integration/serverless/v1/service/build_spec.rb +4 -4
  84. data/spec/integration/serverless/v1/service/environment/log_spec.rb +1 -0
  85. data/spec/integration/serverless/v1/service/function/function_version_spec.rb +1 -1
  86. data/spec/integration/studio/v1/flow/execution_spec.rb +46 -0
  87. data/spec/integration/studio/v2/flow/execution_spec.rb +45 -0
  88. data/spec/integration/studio/v2/flow_spec.rb +4 -0
  89. data/spec/integration/studio/v2/flow_validate_spec.rb +2 -2
  90. data/spec/integration/supersim/v1/fleet_spec.rb +12 -4
  91. data/spec/integration/supersim/v1/network_access_profile/network_access_profile_network_spec.rb +179 -0
  92. data/spec/integration/supersim/v1/network_access_profile_spec.rb +223 -0
  93. data/spec/integration/supersim/v1/network_spec.rb +139 -0
  94. data/spec/integration/trunking/v1/trunk/credential_list_spec.rb +13 -13
  95. data/spec/integration/trunking/v1/trunk/ip_access_control_list_spec.rb +23 -23
  96. data/spec/integration/trunking/v1/trunk/origination_url_spec.rb +28 -28
  97. data/spec/integration/trunking/v1/trunk/phone_number_spec.rb +17 -17
  98. data/spec/integration/trunking/v1/trunk_spec.rb +33 -33
  99. data/spec/integration/verify/v2/form_spec.rb +48 -0
  100. data/spec/integration/verify/v2/service/entity/factor/challenge_spec.rb +353 -0
  101. data/spec/integration/verify/v2/service/entity/factor_spec.rb +298 -0
  102. data/spec/integration/verify/v2/service/entity_spec.rb +201 -0
  103. data/spec/integration/verify/v2/service_spec.rb +28 -4
  104. data/spec/integration/video/v1/composition_settings_spec.rb +2 -2
  105. data/spec/integration/video/v1/recording_settings_spec.rb +2 -2
  106. data/spec/integration/video/v1/recording_spec.rb +2 -2
  107. data/spec/integration/video/v1/room/recording_spec.rb +2 -2
  108. data/spec/integration/voice/v1/byoc_trunk_spec.rb +250 -0
  109. data/spec/integration/voice/v1/connection_policy/connection_policy_target_spec.rb +246 -0
  110. data/spec/integration/voice/v1/connection_policy_spec.rb +226 -0
  111. data/spec/integration/voice/v1/ip_record_spec.rb +223 -0
  112. data/spec/integration/voice/v1/source_ip_mapping_spec.rb +219 -0
  113. data/spec/rest/client_spec.rb +173 -23
  114. data/spec/util/configuration_spec.rb +12 -0
  115. data/twilio-ruby.gemspec +4 -4
  116. metadata +67 -10
@@ -117,7 +117,8 @@ module Twilio
117
117
  # of an SMS.
118
118
  # @param [String] chat_unique_name The chat channel's unique name.
119
119
  # @param [String] pre_engagement_data The pre-engagement data.
120
- # @param [String] task_sid The SID of the TaskRouter task.
120
+ # @param [String] task_sid The SID of the TaskRouter task. Only valid when
121
+ # integration type is `task`. `null` for integration types `studio` & `external`
121
122
  # @param [String] task_attributes The task attributes to be added for the
122
123
  # TaskRouter Task.
123
124
  # @param [Boolean] long_lived Whether to create the channel as long-lived.
@@ -161,6 +161,7 @@ module Twilio
161
161
  'runtime_domain' => payload['runtime_domain'],
162
162
  'messaging_service_instance_sid' => payload['messaging_service_instance_sid'],
163
163
  'chat_service_instance_sid' => payload['chat_service_instance_sid'],
164
+ 'flex_service_instance_sid' => payload['flex_service_instance_sid'],
164
165
  'ui_language' => payload['ui_language'],
165
166
  'ui_attributes' => payload['ui_attributes'],
166
167
  'ui_dependencies' => payload['ui_dependencies'],
@@ -296,6 +297,12 @@ module Twilio
296
297
  @properties['chat_service_instance_sid']
297
298
  end
298
299
 
300
+ ##
301
+ # @return [String] The SID of the Flex service instance
302
+ def flex_service_instance_sid
303
+ @properties['flex_service_instance_sid']
304
+ end
305
+
299
306
  ##
300
307
  # @return [String] The primary language of the Flex UI
301
308
  def ui_language
@@ -143,9 +143,12 @@ module Twilio
143
143
  # task is created with the channel. **Note** that does not apply when channel type
144
144
  # is `web`. Setting the value to `true` for channel type `web` will result in
145
145
  # misconfigured Flex Flow and no tasks will be created.
146
- # @param [Boolean] long_lived Whether new channels are long-lived.
147
- # @param [Boolean] janitor_enabled Boolean flag for enabling or disabling the
148
- # Janitor.
146
+ # @param [Boolean] long_lived When enabled, Flex will keep the chat channel active
147
+ # so that it may be used for subsequent interactions with a contact identity.
148
+ # Defaults to `false`.
149
+ # @param [Boolean] janitor_enabled When enabled, the Messaging Channel Janitor
150
+ # will remove active Proxy sessions if the associated Task is deleted outside of
151
+ # the Flex UI. Defaults to `false`.
149
152
  # @param [String] integration_retry_count The number of times to retry the webhook
150
153
  # if the first attempt fails. Can be an integer between 0 and 3, inclusive, and
151
154
  # the default is 0.
@@ -275,9 +278,12 @@ module Twilio
275
278
  # task is created with the channel. **Note** that does not apply when channel type
276
279
  # is `web`. Setting the value to `true` for channel type `web` will result in
277
280
  # misconfigured Flex Flow and no tasks will be created.
278
- # @param [Boolean] long_lived Whether new channels created are long-lived.
279
- # @param [Boolean] janitor_enabled Boolean flag for enabling or disabling the
280
- # Janitor.
281
+ # @param [Boolean] long_lived When enabled, Flex will keep the chat channel active
282
+ # so that it may be used for subsequent interactions with a contact identity.
283
+ # Defaults to `false`.
284
+ # @param [Boolean] janitor_enabled When enabled, the Messaging Channel Janitor
285
+ # will remove active Proxy sessions if the associated Task is deleted outside of
286
+ # the Flex UI. Defaults to `false`.
281
287
  # @param [String] integration_retry_count The number of times to retry the webhook
282
288
  # if the first attempt fails. Can be an integer between 0 and 3, inclusive, and
283
289
  # the default is 0.
@@ -445,13 +451,13 @@ module Twilio
445
451
  end
446
452
 
447
453
  ##
448
- # @return [Boolean] Whether new channels are long-lived
454
+ # @return [Boolean] Re-use this chat channel for future interactions with a contact
449
455
  def long_lived
450
456
  @properties['long_lived']
451
457
  end
452
458
 
453
459
  ##
454
- # @return [Boolean] Boolean flag for enabling or disabling the Janitor
460
+ # @return [Boolean] Remove active Proxy sessions if the corresponding Task is deleted.
455
461
  def janitor_enabled
456
462
  @properties['janitor_enabled']
457
463
  end
@@ -499,9 +505,12 @@ module Twilio
499
505
  # task is created with the channel. **Note** that does not apply when channel type
500
506
  # is `web`. Setting the value to `true` for channel type `web` will result in
501
507
  # misconfigured Flex Flow and no tasks will be created.
502
- # @param [Boolean] long_lived Whether new channels created are long-lived.
503
- # @param [Boolean] janitor_enabled Boolean flag for enabling or disabling the
504
- # Janitor.
508
+ # @param [Boolean] long_lived When enabled, Flex will keep the chat channel active
509
+ # so that it may be used for subsequent interactions with a contact identity.
510
+ # Defaults to `false`.
511
+ # @param [Boolean] janitor_enabled When enabled, the Messaging Channel Janitor
512
+ # will remove active Proxy sessions if the associated Task is deleted outside of
513
+ # the Flex UI. Defaults to `false`.
505
514
  # @param [String] integration_retry_count The number of times to retry the webhook
506
515
  # if the first attempt fails. Can be an integer between 0 and 3, inclusive, and
507
516
  # the default is 0.
@@ -242,6 +242,7 @@ module Twilio
242
242
  @uri = "/RegulatoryCompliance/Bundles/#{@solution[:sid]}"
243
243
 
244
244
  # Dependents
245
+ @evaluations = nil
245
246
  @item_assignments = nil
246
247
  end
247
248
 
@@ -287,6 +288,24 @@ module Twilio
287
288
  BundleInstance.new(@version, payload, sid: @solution[:sid], )
288
289
  end
289
290
 
291
+ ##
292
+ # Access the evaluations
293
+ # @return [EvaluationList]
294
+ # @return [EvaluationContext] if sid was passed.
295
+ def evaluations(sid=:unset)
296
+ raise ArgumentError, 'sid cannot be nil' if sid.nil?
297
+
298
+ if sid != :unset
299
+ return EvaluationContext.new(@version, @solution[:sid], sid, )
300
+ end
301
+
302
+ unless @evaluations
303
+ @evaluations = EvaluationList.new(@version, bundle_sid: @solution[:sid], )
304
+ end
305
+
306
+ @evaluations
307
+ end
308
+
290
309
  ##
291
310
  # Access the item_assignments
292
311
  # @return [ItemAssignmentList]
@@ -454,6 +473,13 @@ module Twilio
454
473
  )
455
474
  end
456
475
 
476
+ ##
477
+ # Access the evaluations
478
+ # @return [evaluations] evaluations
479
+ def evaluations
480
+ context.evaluations
481
+ end
482
+
457
483
  ##
458
484
  # Access the item_assignments
459
485
  # @return [item_assignments] item_assignments
@@ -0,0 +1,324 @@
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 Numbers < Domain
12
+ class V2 < Version
13
+ class RegulatoryComplianceList < ListResource
14
+ class BundleContext < InstanceContext
15
+ class EvaluationList < ListResource
16
+ ##
17
+ # Initialize the EvaluationList
18
+ # @param [Version] version Version that contains the resource
19
+ # @param [String] bundle_sid The unique string that we created to identify the
20
+ # Bundle resource.
21
+ # @return [EvaluationList] EvaluationList
22
+ def initialize(version, bundle_sid: nil)
23
+ super(version)
24
+
25
+ # Path Solution
26
+ @solution = {bundle_sid: bundle_sid}
27
+ @uri = "/RegulatoryCompliance/Bundles/#{@solution[:bundle_sid]}/Evaluations"
28
+ end
29
+
30
+ ##
31
+ # Retrieve a single page of EvaluationInstance records from the API.
32
+ # Request is executed immediately.
33
+ # @return [EvaluationInstance] Newly created EvaluationInstance
34
+ def create
35
+ data = Twilio::Values.of({})
36
+
37
+ payload = @version.create(
38
+ 'POST',
39
+ @uri,
40
+ data: data
41
+ )
42
+
43
+ EvaluationInstance.new(@version, payload, bundle_sid: @solution[:bundle_sid], )
44
+ end
45
+
46
+ ##
47
+ # Lists EvaluationInstance records from the API as a list.
48
+ # Unlike stream(), this operation is eager and will load `limit` records into
49
+ # memory before returning.
50
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
51
+ # guarantees to never return more than limit. Default is no limit
52
+ # @param [Integer] page_size Number of records to fetch per request, when
53
+ # not set will use the default value of 50 records. If no page_size is defined
54
+ # but a limit is defined, stream() will attempt to read the limit with the most
55
+ # efficient page size, i.e. min(limit, 1000)
56
+ # @return [Array] Array of up to limit results
57
+ def list(limit: nil, page_size: nil)
58
+ self.stream(limit: limit, page_size: page_size).entries
59
+ end
60
+
61
+ ##
62
+ # Streams EvaluationInstance records from the API as an Enumerable.
63
+ # This operation lazily loads records as efficiently as possible until the limit
64
+ # is reached.
65
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
66
+ # guarantees to never return more than limit. Default is no limit.
67
+ # @param [Integer] page_size Number of records to fetch per request, when
68
+ # not set will use the default value of 50 records. If no page_size is defined
69
+ # but a limit is defined, stream() will attempt to read the limit with the most
70
+ # efficient page size, i.e. min(limit, 1000)
71
+ # @return [Enumerable] Enumerable that will yield up to limit results
72
+ def stream(limit: nil, page_size: nil)
73
+ limits = @version.read_limits(limit, page_size)
74
+
75
+ page = self.page(page_size: limits[:page_size], )
76
+
77
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
78
+ end
79
+
80
+ ##
81
+ # When passed a block, yields EvaluationInstance records from the API.
82
+ # This operation lazily loads records as efficiently as possible until the limit
83
+ # is reached.
84
+ def each
85
+ limits = @version.read_limits
86
+
87
+ page = self.page(page_size: limits[:page_size], )
88
+
89
+ @version.stream(page,
90
+ limit: limits[:limit],
91
+ page_limit: limits[:page_limit]).each {|x| yield x}
92
+ end
93
+
94
+ ##
95
+ # Retrieve a single page of EvaluationInstance records from the API.
96
+ # Request is executed immediately.
97
+ # @param [String] page_token PageToken provided by the API
98
+ # @param [Integer] page_number Page Number, this value is simply for client state
99
+ # @param [Integer] page_size Number of records to return, defaults to 50
100
+ # @return [Page] Page of EvaluationInstance
101
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
102
+ params = Twilio::Values.of({
103
+ 'PageToken' => page_token,
104
+ 'Page' => page_number,
105
+ 'PageSize' => page_size,
106
+ })
107
+ response = @version.page(
108
+ 'GET',
109
+ @uri,
110
+ params
111
+ )
112
+ EvaluationPage.new(@version, response, @solution)
113
+ end
114
+
115
+ ##
116
+ # Retrieve a single page of EvaluationInstance records from the API.
117
+ # Request is executed immediately.
118
+ # @param [String] target_url API-generated URL for the requested results page
119
+ # @return [Page] Page of EvaluationInstance
120
+ def get_page(target_url)
121
+ response = @version.domain.request(
122
+ 'GET',
123
+ target_url
124
+ )
125
+ EvaluationPage.new(@version, response, @solution)
126
+ end
127
+
128
+ ##
129
+ # Provide a user friendly representation
130
+ def to_s
131
+ '#<Twilio.Numbers.V2.EvaluationList>'
132
+ end
133
+ end
134
+
135
+ class EvaluationPage < Page
136
+ ##
137
+ # Initialize the EvaluationPage
138
+ # @param [Version] version Version that contains the resource
139
+ # @param [Response] response Response from the API
140
+ # @param [Hash] solution Path solution for the resource
141
+ # @return [EvaluationPage] EvaluationPage
142
+ def initialize(version, response, solution)
143
+ super(version, response)
144
+
145
+ # Path Solution
146
+ @solution = solution
147
+ end
148
+
149
+ ##
150
+ # Build an instance of EvaluationInstance
151
+ # @param [Hash] payload Payload response from the API
152
+ # @return [EvaluationInstance] EvaluationInstance
153
+ def get_instance(payload)
154
+ EvaluationInstance.new(@version, payload, bundle_sid: @solution[:bundle_sid], )
155
+ end
156
+
157
+ ##
158
+ # Provide a user friendly representation
159
+ def to_s
160
+ '<Twilio.Numbers.V2.EvaluationPage>'
161
+ end
162
+ end
163
+
164
+ class EvaluationContext < InstanceContext
165
+ ##
166
+ # Initialize the EvaluationContext
167
+ # @param [Version] version Version that contains the resource
168
+ # @param [String] bundle_sid The unique string that we created to identify the
169
+ # Bundle resource.
170
+ # @param [String] sid The unique string that identifies the Evaluation resource.
171
+ # @return [EvaluationContext] EvaluationContext
172
+ def initialize(version, bundle_sid, sid)
173
+ super(version)
174
+
175
+ # Path Solution
176
+ @solution = {bundle_sid: bundle_sid, sid: sid, }
177
+ @uri = "/RegulatoryCompliance/Bundles/#{@solution[:bundle_sid]}/Evaluations/#{@solution[:sid]}"
178
+ end
179
+
180
+ ##
181
+ # Fetch a EvaluationInstance
182
+ # @return [EvaluationInstance] Fetched EvaluationInstance
183
+ def fetch
184
+ params = Twilio::Values.of({})
185
+
186
+ payload = @version.fetch(
187
+ 'GET',
188
+ @uri,
189
+ params,
190
+ )
191
+
192
+ EvaluationInstance.new(@version, payload, bundle_sid: @solution[:bundle_sid], sid: @solution[:sid], )
193
+ end
194
+
195
+ ##
196
+ # Provide a user friendly representation
197
+ def to_s
198
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
199
+ "#<Twilio.Numbers.V2.EvaluationContext #{context}>"
200
+ end
201
+
202
+ ##
203
+ # Provide a detailed, user friendly representation
204
+ def inspect
205
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
206
+ "#<Twilio.Numbers.V2.EvaluationContext #{context}>"
207
+ end
208
+ end
209
+
210
+ class EvaluationInstance < InstanceResource
211
+ ##
212
+ # Initialize the EvaluationInstance
213
+ # @param [Version] version Version that contains the resource
214
+ # @param [Hash] payload payload that contains response from Twilio
215
+ # @param [String] bundle_sid The unique string that we created to identify the
216
+ # Bundle resource.
217
+ # @param [String] sid The unique string that identifies the Evaluation resource.
218
+ # @return [EvaluationInstance] EvaluationInstance
219
+ def initialize(version, payload, bundle_sid: nil, sid: nil)
220
+ super(version)
221
+
222
+ # Marshaled Properties
223
+ @properties = {
224
+ 'sid' => payload['sid'],
225
+ 'account_sid' => payload['account_sid'],
226
+ 'regulation_sid' => payload['regulation_sid'],
227
+ 'bundle_sid' => payload['bundle_sid'],
228
+ 'status' => payload['status'],
229
+ 'results' => payload['results'],
230
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
231
+ 'url' => payload['url'],
232
+ }
233
+
234
+ # Context
235
+ @instance_context = nil
236
+ @params = {'bundle_sid' => bundle_sid, 'sid' => sid || @properties['sid'], }
237
+ end
238
+
239
+ ##
240
+ # Generate an instance context for the instance, the context is capable of
241
+ # performing various actions. All instance actions are proxied to the context
242
+ # @return [EvaluationContext] EvaluationContext for this EvaluationInstance
243
+ def context
244
+ unless @instance_context
245
+ @instance_context = EvaluationContext.new(@version, @params['bundle_sid'], @params['sid'], )
246
+ end
247
+ @instance_context
248
+ end
249
+
250
+ ##
251
+ # @return [String] The unique string that identifies the Evaluation resource
252
+ def sid
253
+ @properties['sid']
254
+ end
255
+
256
+ ##
257
+ # @return [String] The SID of the Account that created the resource
258
+ def account_sid
259
+ @properties['account_sid']
260
+ end
261
+
262
+ ##
263
+ # @return [String] The unique string of a regulation
264
+ def regulation_sid
265
+ @properties['regulation_sid']
266
+ end
267
+
268
+ ##
269
+ # @return [String] The unique string that identifies the resource
270
+ def bundle_sid
271
+ @properties['bundle_sid']
272
+ end
273
+
274
+ ##
275
+ # @return [evaluation.Status] The compliance status of the Evaluation resource
276
+ def status
277
+ @properties['status']
278
+ end
279
+
280
+ ##
281
+ # @return [Hash] The results of the Evaluation resource
282
+ def results
283
+ @properties['results']
284
+ end
285
+
286
+ ##
287
+ # @return [Time] The date_created
288
+ def date_created
289
+ @properties['date_created']
290
+ end
291
+
292
+ ##
293
+ # @return [String] The url
294
+ def url
295
+ @properties['url']
296
+ end
297
+
298
+ ##
299
+ # Fetch a EvaluationInstance
300
+ # @return [EvaluationInstance] Fetched EvaluationInstance
301
+ def fetch
302
+ context.fetch
303
+ end
304
+
305
+ ##
306
+ # Provide a user friendly representation
307
+ def to_s
308
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
309
+ "<Twilio.Numbers.V2.EvaluationInstance #{values}>"
310
+ end
311
+
312
+ ##
313
+ # Provide a detailed, user friendly representation
314
+ def inspect
315
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
316
+ "<Twilio.Numbers.V2.EvaluationInstance #{values}>"
317
+ end
318
+ end
319
+ end
320
+ end
321
+ end
322
+ end
323
+ end
324
+ end