twilio-ruby 5.47.0 → 5.48.0

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 (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +17 -0
  3. data/README.md +2 -2
  4. data/lib/twilio-ruby/rest/client.rb +7 -0
  5. data/lib/twilio-ruby/rest/events/v1/subscription.rb +2 -2
  6. data/lib/twilio-ruby/rest/messaging.rb +0 -14
  7. data/lib/twilio-ruby/rest/messaging/v1.rb +0 -22
  8. data/lib/twilio-ruby/rest/trusthub.rb +100 -0
  9. data/lib/twilio-ruby/rest/trusthub/v1.rb +139 -0
  10. data/lib/twilio-ruby/rest/trusthub/v1/customer_profiles.rb +523 -0
  11. data/lib/twilio-ruby/rest/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment.rb +359 -0
  12. data/lib/twilio-ruby/rest/trusthub/v1/customer_profiles/customer_profiles_entity_assignments.rb +330 -0
  13. data/lib/twilio-ruby/rest/trusthub/v1/customer_profiles/customer_profiles_evaluations.rb +328 -0
  14. data/lib/twilio-ruby/rest/trusthub/v1/end_user.rb +356 -0
  15. data/lib/twilio-ruby/rest/trusthub/v1/end_user_type.rb +271 -0
  16. data/lib/twilio-ruby/rest/{messaging/v1/use_case.rb → trusthub/v1/policies.rb} +110 -46
  17. data/lib/twilio-ruby/rest/{messaging/v1/campaign.rb → trusthub/v1/supporting_document.rb} +125 -143
  18. data/lib/twilio-ruby/rest/trusthub/v1/supporting_document_type.rb +271 -0
  19. data/lib/twilio-ruby/rest/trusthub/v1/trust_products.rb +523 -0
  20. data/lib/twilio-ruby/rest/trusthub/v1/trust_products/trust_products_channel_endpoint_assignment.rb +359 -0
  21. data/lib/twilio-ruby/rest/trusthub/v1/trust_products/trust_products_entity_assignments.rb +330 -0
  22. data/lib/twilio-ruby/rest/trusthub/v1/trust_products/trust_products_evaluations.rb +328 -0
  23. data/lib/twilio-ruby/rest/verify.rb +9 -0
  24. data/lib/twilio-ruby/rest/verify/v2.rb +15 -0
  25. data/lib/twilio-ruby/rest/verify/v2/verification_attempt.rb +329 -0
  26. data/lib/twilio-ruby/version.rb +1 -1
  27. data/spec/integration/api/v2010/account/incoming_phone_number_spec.rb +4 -16
  28. data/spec/integration/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment_spec.rb +192 -0
  29. data/spec/integration/trusthub/v1/customer_profiles/customer_profiles_entity_assignments_spec.rb +186 -0
  30. data/spec/integration/trusthub/v1/customer_profiles/customer_profiles_evaluations_spec.rb +615 -0
  31. data/spec/integration/trusthub/v1/customer_profiles_spec.rb +255 -0
  32. data/spec/integration/trusthub/v1/end_user_spec.rb +247 -0
  33. data/spec/integration/trusthub/v1/end_user_type_spec.rb +176 -0
  34. data/spec/integration/trusthub/v1/policies_spec.rb +252 -0
  35. data/spec/integration/trusthub/v1/supporting_document_spec.rb +235 -0
  36. data/spec/integration/trusthub/v1/supporting_document_type_spec.rb +159 -0
  37. data/spec/integration/trusthub/v1/trust_products/trust_products_channel_endpoint_assignment_spec.rb +192 -0
  38. data/spec/integration/trusthub/v1/trust_products/trust_products_entity_assignments_spec.rb +186 -0
  39. data/spec/integration/trusthub/v1/trust_products/trust_products_evaluations_spec.rb +615 -0
  40. data/spec/integration/trusthub/v1/trust_products_spec.rb +255 -0
  41. data/spec/integration/verify/v2/verification_attempt_spec.rb +146 -0
  42. metadata +46 -8
  43. data/spec/integration/messaging/v1/campaign_spec.rb +0 -194
  44. data/spec/integration/messaging/v1/use_case_spec.rb +0 -55
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6700c468ebeba0a532743b8fda07b0611eba016340131154d55d96066e7b2dd8
4
- data.tar.gz: ffc4dcf43f721f14576d2088c86c224d5b62a46cc78d61858010a0f0e89f1208
3
+ metadata.gz: 7ff540a9fa947040666a3768f2c5fe1e7be8809c6ab36d0367b8046f808495d9
4
+ data.tar.gz: 9b7d6b438eb9fa1453b914dd74f0cf26484bdeaa5c0276116a421c323d8c5093
5
5
  SHA512:
6
- metadata.gz: 2ded7f1d5f29833cda6ccd65c7d732a4c21f747cee61564898ec73ca3bce24d866046010ca7665f504537dcaf59e4c1b56f18719bc0ead92ed6185ef6646d6ad
7
- data.tar.gz: 9636e0a2664beb12524698215bdb20104d6415d0be295cb363886ead20e43febd4797edd9b159239ee58607a3ac0adaf5fa3f10129a6d18382d0a4c8e6a48240
6
+ metadata.gz: 5e894f9eb7afc39ff72071668b2eb8f4f76c14937867d691762489e7dc4835e7deaa5690f9ed26b923c9cdac838c97c7b55a47eea374ede8b5ebc372ebfc1377
7
+ data.tar.gz: e6b8846bc652433306f33f6419779d75ae0cd870fb1ef7032c65c8abbcfea042ada5fcc326f73c7ffe66af603147be8f6832e3d95e72d0fdcec9e08b6e7d6e4c
data/CHANGES.md CHANGED
@@ -1,6 +1,23 @@
1
1
  twilio-ruby changelog
2
2
  =====================
3
3
 
4
+ [2021-02-24] Version 5.48.0
5
+ ---------------------------
6
+ **Events**
7
+ - Update description of types in the create sink resource
8
+
9
+ **Messaging**
10
+ - Add WA template header and footer
11
+ - Remove A2P campaign and use cases API **(breaking change)**
12
+ - Add number_registration_status field to read and fetch campaign responses
13
+
14
+ **Trusthub**
15
+ - Make all resources public
16
+
17
+ **Verify**
18
+ - Verify List Attempts API endpoints added.
19
+
20
+
4
21
  [2021-02-10] Version 5.47.0
5
22
  ---------------------------
6
23
  **Library - Fix**
data/README.md CHANGED
@@ -34,13 +34,13 @@ This library supports the following Ruby implementations:
34
34
  To install using [Bundler][bundler] grab the latest stable version:
35
35
 
36
36
  ```ruby
37
- gem 'twilio-ruby', '~> 5.47.0'
37
+ gem 'twilio-ruby', '~> 5.48.0'
38
38
  ```
39
39
 
40
40
  To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:
41
41
 
42
42
  ```bash
43
- gem install twilio-ruby -v 5.47.0
43
+ gem install twilio-ruby -v 5.48.0
44
44
  ```
45
45
 
46
46
  To build and install the development branch yourself from the latest source:
@@ -52,6 +52,7 @@ module Twilio
52
52
  @sync = nil
53
53
  @taskrouter = nil
54
54
  @trunking = nil
55
+ @trusthub = nil
55
56
  @verify = nil
56
57
  @video = nil
57
58
  @voice = nil
@@ -295,6 +296,12 @@ module Twilio
295
296
  @trunking ||= Trunking.new self
296
297
  end
297
298
 
299
+ ##
300
+ # Access the Trusthub Twilio Domain
301
+ def trusthub
302
+ @trusthub ||= Trusthub.new self
303
+ end
304
+
298
305
  ##
299
306
  # Access the Verify Twilio Domain
300
307
  def verify
@@ -119,8 +119,8 @@ module Twilio
119
119
  # @param [String] sink_sid The SID of the sink that events selected by this
120
120
  # subscription should be sent to. Sink must be active for the subscription to be
121
121
  # created.
122
- # @param [Array[Hash]] types Contains a dictionary of URL links to nested
123
- # resources of this Subscription.
122
+ # @param [Array[Hash]] types An array of objects containing the subscribed Event
123
+ # Types
124
124
  # @return [SubscriptionInstance] Created SubscriptionInstance
125
125
  def create(description: nil, sink_sid: nil, types: nil)
126
126
  data = Twilio::Values.of({
@@ -36,14 +36,6 @@ module Twilio
36
36
  self.v1.brand_registrations(sid)
37
37
  end
38
38
 
39
- ##
40
- # @param [String] sid The unique string that we created to identify the campaign.
41
- # @return [Twilio::REST::Messaging::V1::CampaignInstance] if sid was passed.
42
- # @return [Twilio::REST::Messaging::V1::CampaignList]
43
- def campaigns(sid=:unset)
44
- self.v1.campaigns(sid)
45
- end
46
-
47
39
  ##
48
40
  # @return [Twilio::REST::Messaging::V1::DeactivationsInstance]
49
41
  def deactivations
@@ -59,12 +51,6 @@ module Twilio
59
51
  self.v1.services(sid)
60
52
  end
61
53
 
62
- ##
63
- # @return [Twilio::REST::Messaging::V1::UseCaseInstance]
64
- def use_cases
65
- self.v1.use_cases()
66
- end
67
-
68
54
  ##
69
55
  # Provide a user friendly representation
70
56
  def to_s
@@ -16,10 +16,8 @@ module Twilio
16
16
  super
17
17
  @version = 'v1'
18
18
  @brand_registrations = nil
19
- @campaigns = nil
20
19
  @deactivations = nil
21
20
  @services = nil
22
- @use_cases = nil
23
21
  end
24
22
 
25
23
  ##
@@ -36,20 +34,6 @@ module Twilio
36
34
  end
37
35
  end
38
36
 
39
- ##
40
- # @param [String] sid The SID of the Campaign resource to fetch.
41
- # @return [Twilio::REST::Messaging::V1::CampaignContext] if sid was passed.
42
- # @return [Twilio::REST::Messaging::V1::CampaignList]
43
- def campaigns(sid=:unset)
44
- if sid.nil?
45
- raise ArgumentError, 'sid cannot be nil'
46
- elsif sid == :unset
47
- @campaigns ||= CampaignList.new self
48
- else
49
- CampaignContext.new(self, sid)
50
- end
51
- end
52
-
53
37
  ##
54
38
  # @return [Twilio::REST::Messaging::V1::DeactivationsContext]
55
39
  def deactivations
@@ -70,12 +54,6 @@ module Twilio
70
54
  end
71
55
  end
72
56
 
73
- ##
74
- # @return [Twilio::REST::Messaging::V1::UseCaseContext]
75
- def use_cases
76
- @use_cases ||= UseCaseList.new self
77
- end
78
-
79
57
  ##
80
58
  # Provide a user friendly representation
81
59
  def to_s
@@ -0,0 +1,100 @@
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 Trusthub < Domain
12
+ ##
13
+ # Initialize the Trusthub Domain
14
+ def initialize(twilio)
15
+ super
16
+
17
+ @base_url = 'https://trusthub.twilio.com'
18
+ @host = 'trusthub.twilio.com'
19
+ @port = 443
20
+
21
+ # Versions
22
+ @v1 = nil
23
+ end
24
+
25
+ ##
26
+ # Version v1 of trusthub
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
33
+ # Customer-Profile resource.
34
+ # @return [Twilio::REST::Trusthub::V1::CustomerProfilesInstance] if sid was passed.
35
+ # @return [Twilio::REST::Trusthub::V1::CustomerProfilesList]
36
+ def customer_profiles(sid=:unset)
37
+ self.v1.customer_profiles(sid)
38
+ end
39
+
40
+ ##
41
+ # @param [String] sid The unique string created by Twilio to identify the End User
42
+ # resource.
43
+ # @return [Twilio::REST::Trusthub::V1::EndUserInstance] if sid was passed.
44
+ # @return [Twilio::REST::Trusthub::V1::EndUserList]
45
+ def end_users(sid=:unset)
46
+ self.v1.end_users(sid)
47
+ end
48
+
49
+ ##
50
+ # @param [String] sid The unique string that identifies the End-User Type
51
+ # resource.
52
+ # @return [Twilio::REST::Trusthub::V1::EndUserTypeInstance] if sid was passed.
53
+ # @return [Twilio::REST::Trusthub::V1::EndUserTypeList]
54
+ def end_user_types(sid=:unset)
55
+ self.v1.end_user_types(sid)
56
+ end
57
+
58
+ ##
59
+ # @param [String] sid The unique string that identifies the Policy resource.
60
+ # @return [Twilio::REST::Trusthub::V1::PoliciesInstance] if sid was passed.
61
+ # @return [Twilio::REST::Trusthub::V1::PoliciesList]
62
+ def policies(sid=:unset)
63
+ self.v1.policies(sid)
64
+ end
65
+
66
+ ##
67
+ # @param [String] sid The unique string created by Twilio to identify the
68
+ # Supporting Document resource.
69
+ # @return [Twilio::REST::Trusthub::V1::SupportingDocumentInstance] if sid was passed.
70
+ # @return [Twilio::REST::Trusthub::V1::SupportingDocumentList]
71
+ def supporting_documents(sid=:unset)
72
+ self.v1.supporting_documents(sid)
73
+ end
74
+
75
+ ##
76
+ # @param [String] sid The unique string that identifies the Supporting Document
77
+ # Type resource.
78
+ # @return [Twilio::REST::Trusthub::V1::SupportingDocumentTypeInstance] if sid was passed.
79
+ # @return [Twilio::REST::Trusthub::V1::SupportingDocumentTypeList]
80
+ def supporting_document_types(sid=:unset)
81
+ self.v1.supporting_document_types(sid)
82
+ end
83
+
84
+ ##
85
+ # @param [String] sid The unique string that we created to identify the
86
+ # Customer-Profile resource.
87
+ # @return [Twilio::REST::Trusthub::V1::TrustProductsInstance] if sid was passed.
88
+ # @return [Twilio::REST::Trusthub::V1::TrustProductsList]
89
+ def trust_products(sid=:unset)
90
+ self.v1.trust_products(sid)
91
+ end
92
+
93
+ ##
94
+ # Provide a user friendly representation
95
+ def to_s
96
+ '#<Twilio::REST::Trusthub>'
97
+ end
98
+ end
99
+ end
100
+ end
@@ -0,0 +1,139 @@
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 Trusthub
12
+ class V1 < Version
13
+ ##
14
+ # Initialize the V1 version of Trusthub
15
+ def initialize(domain)
16
+ super
17
+ @version = 'v1'
18
+ @customer_profiles = nil
19
+ @end_users = nil
20
+ @end_user_types = nil
21
+ @policies = nil
22
+ @supporting_documents = nil
23
+ @supporting_document_types = nil
24
+ @trust_products = nil
25
+ end
26
+
27
+ ##
28
+ # @param [String] sid The unique string that we created to identify the
29
+ # Customer-Profile resource.
30
+ # @return [Twilio::REST::Trusthub::V1::CustomerProfilesContext] if sid was passed.
31
+ # @return [Twilio::REST::Trusthub::V1::CustomerProfilesList]
32
+ def customer_profiles(sid=:unset)
33
+ if sid.nil?
34
+ raise ArgumentError, 'sid cannot be nil'
35
+ elsif sid == :unset
36
+ @customer_profiles ||= CustomerProfilesList.new self
37
+ else
38
+ CustomerProfilesContext.new(self, sid)
39
+ end
40
+ end
41
+
42
+ ##
43
+ # @param [String] sid The unique string created by Twilio to identify the End User
44
+ # resource.
45
+ # @return [Twilio::REST::Trusthub::V1::EndUserContext] if sid was passed.
46
+ # @return [Twilio::REST::Trusthub::V1::EndUserList]
47
+ def end_users(sid=:unset)
48
+ if sid.nil?
49
+ raise ArgumentError, 'sid cannot be nil'
50
+ elsif sid == :unset
51
+ @end_users ||= EndUserList.new self
52
+ else
53
+ EndUserContext.new(self, sid)
54
+ end
55
+ end
56
+
57
+ ##
58
+ # @param [String] sid The unique string that identifies the End-User Type
59
+ # resource.
60
+ # @return [Twilio::REST::Trusthub::V1::EndUserTypeContext] if sid was passed.
61
+ # @return [Twilio::REST::Trusthub::V1::EndUserTypeList]
62
+ def end_user_types(sid=:unset)
63
+ if sid.nil?
64
+ raise ArgumentError, 'sid cannot be nil'
65
+ elsif sid == :unset
66
+ @end_user_types ||= EndUserTypeList.new self
67
+ else
68
+ EndUserTypeContext.new(self, sid)
69
+ end
70
+ end
71
+
72
+ ##
73
+ # @param [String] sid The unique string that identifies the Policy resource.
74
+ # @return [Twilio::REST::Trusthub::V1::PoliciesContext] if sid was passed.
75
+ # @return [Twilio::REST::Trusthub::V1::PoliciesList]
76
+ def policies(sid=:unset)
77
+ if sid.nil?
78
+ raise ArgumentError, 'sid cannot be nil'
79
+ elsif sid == :unset
80
+ @policies ||= PoliciesList.new self
81
+ else
82
+ PoliciesContext.new(self, sid)
83
+ end
84
+ end
85
+
86
+ ##
87
+ # @param [String] sid The unique string created by Twilio to identify the
88
+ # Supporting Document resource.
89
+ # @return [Twilio::REST::Trusthub::V1::SupportingDocumentContext] if sid was passed.
90
+ # @return [Twilio::REST::Trusthub::V1::SupportingDocumentList]
91
+ def supporting_documents(sid=:unset)
92
+ if sid.nil?
93
+ raise ArgumentError, 'sid cannot be nil'
94
+ elsif sid == :unset
95
+ @supporting_documents ||= SupportingDocumentList.new self
96
+ else
97
+ SupportingDocumentContext.new(self, sid)
98
+ end
99
+ end
100
+
101
+ ##
102
+ # @param [String] sid The unique string that identifies the Supporting Document
103
+ # Type resource.
104
+ # @return [Twilio::REST::Trusthub::V1::SupportingDocumentTypeContext] if sid was passed.
105
+ # @return [Twilio::REST::Trusthub::V1::SupportingDocumentTypeList]
106
+ def supporting_document_types(sid=:unset)
107
+ if sid.nil?
108
+ raise ArgumentError, 'sid cannot be nil'
109
+ elsif sid == :unset
110
+ @supporting_document_types ||= SupportingDocumentTypeList.new self
111
+ else
112
+ SupportingDocumentTypeContext.new(self, sid)
113
+ end
114
+ end
115
+
116
+ ##
117
+ # @param [String] sid The unique string that we created to identify the
118
+ # Customer-Profile resource.
119
+ # @return [Twilio::REST::Trusthub::V1::TrustProductsContext] if sid was passed.
120
+ # @return [Twilio::REST::Trusthub::V1::TrustProductsList]
121
+ def trust_products(sid=:unset)
122
+ if sid.nil?
123
+ raise ArgumentError, 'sid cannot be nil'
124
+ elsif sid == :unset
125
+ @trust_products ||= TrustProductsList.new self
126
+ else
127
+ TrustProductsContext.new(self, sid)
128
+ end
129
+ end
130
+
131
+ ##
132
+ # Provide a user friendly representation
133
+ def to_s
134
+ '<Twilio::REST::Trusthub::V1>'
135
+ end
136
+ end
137
+ end
138
+ end
139
+ end
@@ -0,0 +1,523 @@
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 Trusthub < Domain
12
+ class V1 < Version
13
+ class CustomerProfilesList < ListResource
14
+ ##
15
+ # Initialize the CustomerProfilesList
16
+ # @param [Version] version Version that contains the resource
17
+ # @return [CustomerProfilesList] CustomerProfilesList
18
+ def initialize(version)
19
+ super(version)
20
+
21
+ # Path Solution
22
+ @solution = {}
23
+ @uri = "/CustomerProfiles"
24
+ end
25
+
26
+ ##
27
+ # Create the CustomerProfilesInstance
28
+ # @param [String] friendly_name The string that you assigned to describe the
29
+ # resource.
30
+ # @param [String] email The email address that will receive updates when the
31
+ # Customer-Profile resource changes status.
32
+ # @param [String] policy_sid The unique string of a policy that is associated to
33
+ # the Customer-Profile resource.
34
+ # @param [String] status_callback The URL we call to inform your application of
35
+ # status changes.
36
+ # @return [CustomerProfilesInstance] Created CustomerProfilesInstance
37
+ def create(friendly_name: nil, email: nil, policy_sid: nil, status_callback: :unset)
38
+ data = Twilio::Values.of({
39
+ 'FriendlyName' => friendly_name,
40
+ 'Email' => email,
41
+ 'PolicySid' => policy_sid,
42
+ 'StatusCallback' => status_callback,
43
+ })
44
+
45
+ payload = @version.create('POST', @uri, data: data)
46
+
47
+ CustomerProfilesInstance.new(@version, payload, )
48
+ end
49
+
50
+ ##
51
+ # Lists CustomerProfilesInstance records from the API as a list.
52
+ # Unlike stream(), this operation is eager and will load `limit` records into
53
+ # memory before returning.
54
+ # @param [customer_profiles.Status] status The verification status of the
55
+ # Customer-Profile resource.
56
+ # @param [String] friendly_name The string that you assigned to describe the
57
+ # resource.
58
+ # @param [String] policy_sid The unique string of a policy that is associated to
59
+ # the Customer-Profile resource.
60
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
61
+ # guarantees to never return more than limit. Default is no limit
62
+ # @param [Integer] page_size Number of records to fetch per request, when
63
+ # not set will use the default value of 50 records. If no page_size is defined
64
+ # but a limit is defined, stream() will attempt to read the limit with the most
65
+ # efficient page size, i.e. min(limit, 1000)
66
+ # @return [Array] Array of up to limit results
67
+ def list(status: :unset, friendly_name: :unset, policy_sid: :unset, limit: nil, page_size: nil)
68
+ self.stream(
69
+ status: status,
70
+ friendly_name: friendly_name,
71
+ policy_sid: policy_sid,
72
+ limit: limit,
73
+ page_size: page_size
74
+ ).entries
75
+ end
76
+
77
+ ##
78
+ # Streams CustomerProfilesInstance records from the API as an Enumerable.
79
+ # This operation lazily loads records as efficiently as possible until the limit
80
+ # is reached.
81
+ # @param [customer_profiles.Status] status The verification status of the
82
+ # Customer-Profile resource.
83
+ # @param [String] friendly_name The string that you assigned to describe the
84
+ # resource.
85
+ # @param [String] policy_sid The unique string of a policy that is associated to
86
+ # the Customer-Profile resource.
87
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
88
+ # guarantees to never return more than limit. Default is no limit.
89
+ # @param [Integer] page_size Number of records to fetch per request, when
90
+ # not set will use the default value of 50 records. If no page_size is defined
91
+ # but a limit is defined, stream() will attempt to read the limit with the most
92
+ # efficient page size, i.e. min(limit, 1000)
93
+ # @return [Enumerable] Enumerable that will yield up to limit results
94
+ def stream(status: :unset, friendly_name: :unset, policy_sid: :unset, limit: nil, page_size: nil)
95
+ limits = @version.read_limits(limit, page_size)
96
+
97
+ page = self.page(
98
+ status: status,
99
+ friendly_name: friendly_name,
100
+ policy_sid: policy_sid,
101
+ page_size: limits[:page_size],
102
+ )
103
+
104
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
105
+ end
106
+
107
+ ##
108
+ # When passed a block, yields CustomerProfilesInstance records from the API.
109
+ # This operation lazily loads records as efficiently as possible until the limit
110
+ # is reached.
111
+ def each
112
+ limits = @version.read_limits
113
+
114
+ page = self.page(page_size: limits[:page_size], )
115
+
116
+ @version.stream(page,
117
+ limit: limits[:limit],
118
+ page_limit: limits[:page_limit]).each {|x| yield x}
119
+ end
120
+
121
+ ##
122
+ # Retrieve a single page of CustomerProfilesInstance records from the API.
123
+ # Request is executed immediately.
124
+ # @param [customer_profiles.Status] status The verification status of the
125
+ # Customer-Profile resource.
126
+ # @param [String] friendly_name The string that you assigned to describe the
127
+ # resource.
128
+ # @param [String] policy_sid The unique string of a policy that is associated to
129
+ # the Customer-Profile resource.
130
+ # @param [String] page_token PageToken provided by the API
131
+ # @param [Integer] page_number Page Number, this value is simply for client state
132
+ # @param [Integer] page_size Number of records to return, defaults to 50
133
+ # @return [Page] Page of CustomerProfilesInstance
134
+ def page(status: :unset, friendly_name: :unset, policy_sid: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
135
+ params = Twilio::Values.of({
136
+ 'Status' => status,
137
+ 'FriendlyName' => friendly_name,
138
+ 'PolicySid' => policy_sid,
139
+ 'PageToken' => page_token,
140
+ 'Page' => page_number,
141
+ 'PageSize' => page_size,
142
+ })
143
+
144
+ response = @version.page('GET', @uri, params: params)
145
+
146
+ CustomerProfilesPage.new(@version, response, @solution)
147
+ end
148
+
149
+ ##
150
+ # Retrieve a single page of CustomerProfilesInstance records from the API.
151
+ # Request is executed immediately.
152
+ # @param [String] target_url API-generated URL for the requested results page
153
+ # @return [Page] Page of CustomerProfilesInstance
154
+ def get_page(target_url)
155
+ response = @version.domain.request(
156
+ 'GET',
157
+ target_url
158
+ )
159
+ CustomerProfilesPage.new(@version, response, @solution)
160
+ end
161
+
162
+ ##
163
+ # Provide a user friendly representation
164
+ def to_s
165
+ '#<Twilio.Trusthub.V1.CustomerProfilesList>'
166
+ end
167
+ end
168
+
169
+ class CustomerProfilesPage < Page
170
+ ##
171
+ # Initialize the CustomerProfilesPage
172
+ # @param [Version] version Version that contains the resource
173
+ # @param [Response] response Response from the API
174
+ # @param [Hash] solution Path solution for the resource
175
+ # @return [CustomerProfilesPage] CustomerProfilesPage
176
+ def initialize(version, response, solution)
177
+ super(version, response)
178
+
179
+ # Path Solution
180
+ @solution = solution
181
+ end
182
+
183
+ ##
184
+ # Build an instance of CustomerProfilesInstance
185
+ # @param [Hash] payload Payload response from the API
186
+ # @return [CustomerProfilesInstance] CustomerProfilesInstance
187
+ def get_instance(payload)
188
+ CustomerProfilesInstance.new(@version, payload, )
189
+ end
190
+
191
+ ##
192
+ # Provide a user friendly representation
193
+ def to_s
194
+ '<Twilio.Trusthub.V1.CustomerProfilesPage>'
195
+ end
196
+ end
197
+
198
+ class CustomerProfilesContext < InstanceContext
199
+ ##
200
+ # Initialize the CustomerProfilesContext
201
+ # @param [Version] version Version that contains the resource
202
+ # @param [String] sid The unique string that we created to identify the
203
+ # Customer-Profile resource.
204
+ # @return [CustomerProfilesContext] CustomerProfilesContext
205
+ def initialize(version, sid)
206
+ super(version)
207
+
208
+ # Path Solution
209
+ @solution = {sid: sid, }
210
+ @uri = "/CustomerProfiles/#{@solution[:sid]}"
211
+
212
+ # Dependents
213
+ @customer_profiles_entity_assignments = nil
214
+ @customer_profiles_evaluations = nil
215
+ @customer_profiles_channel_endpoint_assignment = nil
216
+ end
217
+
218
+ ##
219
+ # Fetch the CustomerProfilesInstance
220
+ # @return [CustomerProfilesInstance] Fetched CustomerProfilesInstance
221
+ def fetch
222
+ payload = @version.fetch('GET', @uri)
223
+
224
+ CustomerProfilesInstance.new(@version, payload, sid: @solution[:sid], )
225
+ end
226
+
227
+ ##
228
+ # Update the CustomerProfilesInstance
229
+ # @param [customer_profiles.Status] status The verification status of the
230
+ # Customer-Profile resource.
231
+ # @param [String] status_callback The URL we call to inform your application of
232
+ # status changes.
233
+ # @param [String] friendly_name The string that you assigned to describe the
234
+ # resource.
235
+ # @param [String] email The email address that will receive updates when the
236
+ # Customer-Profile resource changes status.
237
+ # @return [CustomerProfilesInstance] Updated CustomerProfilesInstance
238
+ def update(status: :unset, status_callback: :unset, friendly_name: :unset, email: :unset)
239
+ data = Twilio::Values.of({
240
+ 'Status' => status,
241
+ 'StatusCallback' => status_callback,
242
+ 'FriendlyName' => friendly_name,
243
+ 'Email' => email,
244
+ })
245
+
246
+ payload = @version.update('POST', @uri, data: data)
247
+
248
+ CustomerProfilesInstance.new(@version, payload, sid: @solution[:sid], )
249
+ end
250
+
251
+ ##
252
+ # Delete the CustomerProfilesInstance
253
+ # @return [Boolean] true if delete succeeds, false otherwise
254
+ def delete
255
+ @version.delete('DELETE', @uri)
256
+ end
257
+
258
+ ##
259
+ # Access the customer_profiles_entity_assignments
260
+ # @return [CustomerProfilesEntityAssignmentsList]
261
+ # @return [CustomerProfilesEntityAssignmentsContext] if sid was passed.
262
+ def customer_profiles_entity_assignments(sid=:unset)
263
+ raise ArgumentError, 'sid cannot be nil' if sid.nil?
264
+
265
+ if sid != :unset
266
+ return CustomerProfilesEntityAssignmentsContext.new(@version, @solution[:sid], sid, )
267
+ end
268
+
269
+ unless @customer_profiles_entity_assignments
270
+ @customer_profiles_entity_assignments = CustomerProfilesEntityAssignmentsList.new(
271
+ @version,
272
+ customer_profile_sid: @solution[:sid],
273
+ )
274
+ end
275
+
276
+ @customer_profiles_entity_assignments
277
+ end
278
+
279
+ ##
280
+ # Access the customer_profiles_evaluations
281
+ # @return [CustomerProfilesEvaluationsList]
282
+ # @return [CustomerProfilesEvaluationsContext] if sid was passed.
283
+ def customer_profiles_evaluations(sid=:unset)
284
+ raise ArgumentError, 'sid cannot be nil' if sid.nil?
285
+
286
+ if sid != :unset
287
+ return CustomerProfilesEvaluationsContext.new(@version, @solution[:sid], sid, )
288
+ end
289
+
290
+ unless @customer_profiles_evaluations
291
+ @customer_profiles_evaluations = CustomerProfilesEvaluationsList.new(
292
+ @version,
293
+ customer_profile_sid: @solution[:sid],
294
+ )
295
+ end
296
+
297
+ @customer_profiles_evaluations
298
+ end
299
+
300
+ ##
301
+ # Access the customer_profiles_channel_endpoint_assignment
302
+ # @return [CustomerProfilesChannelEndpointAssignmentList]
303
+ # @return [CustomerProfilesChannelEndpointAssignmentContext] if sid was passed.
304
+ def customer_profiles_channel_endpoint_assignment(sid=:unset)
305
+ raise ArgumentError, 'sid cannot be nil' if sid.nil?
306
+
307
+ if sid != :unset
308
+ return CustomerProfilesChannelEndpointAssignmentContext.new(@version, @solution[:sid], sid, )
309
+ end
310
+
311
+ unless @customer_profiles_channel_endpoint_assignment
312
+ @customer_profiles_channel_endpoint_assignment = CustomerProfilesChannelEndpointAssignmentList.new(
313
+ @version,
314
+ customer_profile_sid: @solution[:sid],
315
+ )
316
+ end
317
+
318
+ @customer_profiles_channel_endpoint_assignment
319
+ end
320
+
321
+ ##
322
+ # Provide a user friendly representation
323
+ def to_s
324
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
325
+ "#<Twilio.Trusthub.V1.CustomerProfilesContext #{context}>"
326
+ end
327
+
328
+ ##
329
+ # Provide a detailed, user friendly representation
330
+ def inspect
331
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
332
+ "#<Twilio.Trusthub.V1.CustomerProfilesContext #{context}>"
333
+ end
334
+ end
335
+
336
+ class CustomerProfilesInstance < InstanceResource
337
+ ##
338
+ # Initialize the CustomerProfilesInstance
339
+ # @param [Version] version Version that contains the resource
340
+ # @param [Hash] payload payload that contains response from Twilio
341
+ # @param [String] sid The unique string that we created to identify the
342
+ # Customer-Profile resource.
343
+ # @return [CustomerProfilesInstance] CustomerProfilesInstance
344
+ def initialize(version, payload, sid: nil)
345
+ super(version)
346
+
347
+ # Marshaled Properties
348
+ @properties = {
349
+ 'sid' => payload['sid'],
350
+ 'account_sid' => payload['account_sid'],
351
+ 'policy_sid' => payload['policy_sid'],
352
+ 'friendly_name' => payload['friendly_name'],
353
+ 'status' => payload['status'],
354
+ 'valid_until' => Twilio.deserialize_iso8601_datetime(payload['valid_until']),
355
+ 'email' => payload['email'],
356
+ 'status_callback' => payload['status_callback'],
357
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
358
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
359
+ 'url' => payload['url'],
360
+ 'links' => payload['links'],
361
+ }
362
+
363
+ # Context
364
+ @instance_context = nil
365
+ @params = {'sid' => sid || @properties['sid'], }
366
+ end
367
+
368
+ ##
369
+ # Generate an instance context for the instance, the context is capable of
370
+ # performing various actions. All instance actions are proxied to the context
371
+ # @return [CustomerProfilesContext] CustomerProfilesContext for this CustomerProfilesInstance
372
+ def context
373
+ unless @instance_context
374
+ @instance_context = CustomerProfilesContext.new(@version, @params['sid'], )
375
+ end
376
+ @instance_context
377
+ end
378
+
379
+ ##
380
+ # @return [String] The unique string that identifies the resource.
381
+ def sid
382
+ @properties['sid']
383
+ end
384
+
385
+ ##
386
+ # @return [String] The SID of the Account that created the resource
387
+ def account_sid
388
+ @properties['account_sid']
389
+ end
390
+
391
+ ##
392
+ # @return [String] The unique string of a policy.
393
+ def policy_sid
394
+ @properties['policy_sid']
395
+ end
396
+
397
+ ##
398
+ # @return [String] The string that you assigned to describe the resource
399
+ def friendly_name
400
+ @properties['friendly_name']
401
+ end
402
+
403
+ ##
404
+ # @return [customer_profiles.Status] The verification status of the Customer-Profile resource
405
+ def status
406
+ @properties['status']
407
+ end
408
+
409
+ ##
410
+ # @return [Time] The ISO 8601 date and time in GMT when the resource will be valid until.
411
+ def valid_until
412
+ @properties['valid_until']
413
+ end
414
+
415
+ ##
416
+ # @return [String] The email address
417
+ def email
418
+ @properties['email']
419
+ end
420
+
421
+ ##
422
+ # @return [String] The URL we call to inform your application of status changes.
423
+ def status_callback
424
+ @properties['status_callback']
425
+ end
426
+
427
+ ##
428
+ # @return [Time] The ISO 8601 date and time in GMT when the resource was created
429
+ def date_created
430
+ @properties['date_created']
431
+ end
432
+
433
+ ##
434
+ # @return [Time] The ISO 8601 date and time in GMT when the resource was last updated
435
+ def date_updated
436
+ @properties['date_updated']
437
+ end
438
+
439
+ ##
440
+ # @return [String] The absolute URL of the Customer-Profile resource
441
+ def url
442
+ @properties['url']
443
+ end
444
+
445
+ ##
446
+ # @return [String] The URLs of the Assigned Items of the Customer-Profile resource
447
+ def links
448
+ @properties['links']
449
+ end
450
+
451
+ ##
452
+ # Fetch the CustomerProfilesInstance
453
+ # @return [CustomerProfilesInstance] Fetched CustomerProfilesInstance
454
+ def fetch
455
+ context.fetch
456
+ end
457
+
458
+ ##
459
+ # Update the CustomerProfilesInstance
460
+ # @param [customer_profiles.Status] status The verification status of the
461
+ # Customer-Profile resource.
462
+ # @param [String] status_callback The URL we call to inform your application of
463
+ # status changes.
464
+ # @param [String] friendly_name The string that you assigned to describe the
465
+ # resource.
466
+ # @param [String] email The email address that will receive updates when the
467
+ # Customer-Profile resource changes status.
468
+ # @return [CustomerProfilesInstance] Updated CustomerProfilesInstance
469
+ def update(status: :unset, status_callback: :unset, friendly_name: :unset, email: :unset)
470
+ context.update(
471
+ status: status,
472
+ status_callback: status_callback,
473
+ friendly_name: friendly_name,
474
+ email: email,
475
+ )
476
+ end
477
+
478
+ ##
479
+ # Delete the CustomerProfilesInstance
480
+ # @return [Boolean] true if delete succeeds, false otherwise
481
+ def delete
482
+ context.delete
483
+ end
484
+
485
+ ##
486
+ # Access the customer_profiles_entity_assignments
487
+ # @return [customer_profiles_entity_assignments] customer_profiles_entity_assignments
488
+ def customer_profiles_entity_assignments
489
+ context.customer_profiles_entity_assignments
490
+ end
491
+
492
+ ##
493
+ # Access the customer_profiles_evaluations
494
+ # @return [customer_profiles_evaluations] customer_profiles_evaluations
495
+ def customer_profiles_evaluations
496
+ context.customer_profiles_evaluations
497
+ end
498
+
499
+ ##
500
+ # Access the customer_profiles_channel_endpoint_assignment
501
+ # @return [customer_profiles_channel_endpoint_assignment] customer_profiles_channel_endpoint_assignment
502
+ def customer_profiles_channel_endpoint_assignment
503
+ context.customer_profiles_channel_endpoint_assignment
504
+ end
505
+
506
+ ##
507
+ # Provide a user friendly representation
508
+ def to_s
509
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
510
+ "<Twilio.Trusthub.V1.CustomerProfilesInstance #{values}>"
511
+ end
512
+
513
+ ##
514
+ # Provide a detailed, user friendly representation
515
+ def inspect
516
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
517
+ "<Twilio.Trusthub.V1.CustomerProfilesInstance #{values}>"
518
+ end
519
+ end
520
+ end
521
+ end
522
+ end
523
+ end