twilio-ruby 7.12.0 → 7.13.1

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/.github/workflows/test-and-deploy.yml +6 -6
  3. data/CHANGES.md +319 -0
  4. data/Gemfile.lock +2 -2
  5. data/README.md +2 -2
  6. data/examples/WebhookSignatureValidation.md +61 -0
  7. data/lib/rack/twilio_webhook_authentication.rb +30 -5
  8. data/lib/twilio-ruby/rest/accounts/v1/compliance_signals_check.rb +254 -0
  9. data/lib/twilio-ruby/rest/accounts/v1.rb +6 -0
  10. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +7 -0
  11. data/lib/twilio-ruby/rest/client.rb +5 -0
  12. data/lib/twilio-ruby/rest/content/v1/content/approval_create.rb +108 -1
  13. data/lib/twilio-ruby/rest/content/v1/content.rb +8 -2
  14. data/lib/twilio-ruby/rest/conversations/v2/configuration.rb +7 -0
  15. data/lib/twilio-ruby/rest/conversations/v2/conversation.rb +194 -7
  16. data/lib/twilio-ruby/rest/memory/v1/bulk.rb +22 -1
  17. data/lib/twilio-ruby/rest/memory/v1/import.rb +21 -7
  18. data/lib/twilio-ruby/rest/memory/v1/store.rb +7 -0
  19. data/lib/twilio-ruby/rest/memory/v1/trait.rb +7 -0
  20. data/lib/twilio-ruby/rest/messaging/v3/message_cost_estimate.rb +204 -0
  21. data/lib/twilio-ruby/rest/messaging/v3.rb +6 -0
  22. data/lib/twilio-ruby/rest/numbers_base.rb +0 -5
  23. data/lib/twilio-ruby/rest/trusthub/v1/a2p_brand_registration.rb +5 -5
  24. data/lib/twilio-ruby/rest/trusthub/v1/a2p_campaign_registration.rb +4 -4
  25. data/lib/twilio-ruby/rest/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment.rb +28 -0
  26. data/lib/twilio-ruby/rest/trusthub/v1/trust_products/trust_products_channel_endpoint_assignment.rb +28 -0
  27. data/lib/twilio-ruby/rest/trusthub/v1.rb +2 -2
  28. data/lib/twilio-ruby/rest/webhooks/v1/auth_profile.rb +825 -0
  29. data/lib/twilio-ruby/rest/webhooks/v1/edge_zone.rb +320 -0
  30. data/lib/twilio-ruby/rest/webhooks/v1/operation.rb +513 -0
  31. data/lib/twilio-ruby/rest/webhooks/v1/rule.rb +818 -0
  32. data/lib/twilio-ruby/rest/webhooks/v1/setting.rb +1028 -0
  33. data/lib/twilio-ruby/rest/webhooks/v1/shared_key.rb +722 -0
  34. data/lib/twilio-ruby/rest/webhooks/v1/test.rb +228 -0
  35. data/lib/twilio-ruby/rest/webhooks/v1.rb +126 -0
  36. data/lib/twilio-ruby/rest/webhooks.rb +6 -0
  37. data/lib/twilio-ruby/rest/webhooks_base.rb +38 -0
  38. data/lib/twilio-ruby/security/request_validator.rb +54 -8
  39. data/lib/twilio-ruby/twiml/voice_response.rb +89 -20
  40. data/lib/twilio-ruby/version.rb +1 -1
  41. metadata +15 -5
  42. data/lib/twilio-ruby/rest/numbers/v3/hosted_number_order.rb +0 -425
  43. data/lib/twilio-ruby/rest/numbers/v3.rb +0 -40
  44. data/lib/twilio-ruby/rest/oauth/v2/oauth_authorization_server.rb +0 -200
@@ -0,0 +1,204 @@
1
+ ##
2
+ # This code was generated by
3
+ # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
4
+ # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
5
+ # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
6
+ #
7
+ # Twilio - Messaging
8
+ # This is the public Twilio REST API.
9
+ #
10
+ # NOTE: This class is auto generated by OpenAPI Generator.
11
+ # https://openapi-generator.tech
12
+ # Do not edit the class manually.
13
+ #
14
+
15
+
16
+ module Twilio
17
+ module REST
18
+ class Messaging < MessagingBase
19
+ class V3 < Version
20
+ class MessageCostEstimateList < ListResource
21
+
22
+ ##
23
+ # Initialize the MessageCostEstimateList
24
+ # @param [Version] version Version that contains the resource
25
+ # @return [MessageCostEstimateList] MessageCostEstimateList
26
+ def initialize(version)
27
+ super(version)
28
+
29
+ # Path Solution
30
+ @solution = { }
31
+ @uri = "/MessageCostEstimate"
32
+
33
+ end
34
+ ##
35
+ # Fetch the MessageCostEstimateInstance
36
+ # @param [String] country The ISO-3166-1 alpha-2 country code to estimate for. Exactly one country is accepted.
37
+ # @param [String] lookback_window The historical lookback window used to compute the estimate.
38
+ # @return [MessageCostEstimateInstance] Fetched MessageCostEstimateInstance
39
+ def fetch(
40
+ country: nil,
41
+ lookback_window: nil
42
+ )
43
+
44
+ params = Twilio::Values.of({
45
+ 'country' => country,
46
+ 'lookbackWindow' => lookback_window,
47
+ })
48
+ headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
49
+
50
+
51
+
52
+
53
+
54
+ payload = @version.fetch('GET', @uri, params: params, headers: headers)
55
+ MessageCostEstimateInstance.new(
56
+ @version,
57
+ payload,
58
+ )
59
+ end
60
+
61
+ ##
62
+ # Fetch the MessageCostEstimateInstanceMetadata
63
+ # @param [String] country The ISO-3166-1 alpha-2 country code to estimate for. Exactly one country is accepted.
64
+ # @param [String] lookback_window The historical lookback window used to compute the estimate.
65
+ # @return [MessageCostEstimateInstance] Fetched MessageCostEstimateInstance
66
+ def fetch_with_metadata(
67
+ country: nil,
68
+ lookback_window: nil
69
+ )
70
+
71
+ params = Twilio::Values.of({
72
+ 'country' => country,
73
+ 'lookbackWindow' => lookback_window,
74
+ })
75
+ headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
76
+
77
+
78
+
79
+
80
+
81
+ response = @version.fetch_with_metadata('GET', @uri, params: params, headers: headers)
82
+ message_cost_estimate_instance = MessageCostEstimateInstance.new(
83
+ @version,
84
+ response.body,
85
+ )
86
+ MessageCostEstimateInstanceMetadata.new(
87
+ @version,
88
+ message_cost_estimate_instance,
89
+ response.headers,
90
+ response.status_code
91
+ )
92
+ end
93
+
94
+
95
+
96
+
97
+ # Provide a user friendly representation
98
+ def to_s
99
+ '#<Twilio.Messaging.V3.MessageCostEstimateList>'
100
+ end
101
+ end
102
+
103
+ class MessageCostEstimatePage < Page
104
+ ##
105
+ # Initialize the MessageCostEstimatePage
106
+ # @param [Version] version Version that contains the resource
107
+ # @param [Response] response Response from the API
108
+ # @param [Hash] solution Path solution for the resource
109
+ # @return [MessageCostEstimatePage] MessageCostEstimatePage
110
+ def initialize(version, response, solution)
111
+ super(version, response)
112
+
113
+
114
+ # Path Solution
115
+ @solution = solution
116
+ end
117
+
118
+ ##
119
+ # Build an instance of MessageCostEstimateInstance
120
+ # @param [Hash] payload Payload response from the API
121
+ # @return [MessageCostEstimateInstance] MessageCostEstimateInstance
122
+ def get_instance(payload)
123
+ MessageCostEstimateInstance.new(@version, payload)
124
+ end
125
+
126
+ ##
127
+ # Provide a user friendly representation
128
+ def to_s
129
+ '<Twilio.Messaging.V3.MessageCostEstimatePage>'
130
+ end
131
+ end
132
+
133
+ class MessageCostEstimateInstance < InstanceResource
134
+ ##
135
+ # Initialize the MessageCostEstimateInstance
136
+ # @param [Version] version Version that contains the resource
137
+ # @param [Hash] payload payload that contains response from Twilio
138
+ # @param [String] account_sid The SID of the
139
+ # {Account}[https://www.twilio.com/docs/iam/api/account] that created this MessageCostEstimate
140
+ # resource.
141
+ # @param [String] sid The SID of the Call resource to fetch.
142
+ # @return [MessageCostEstimateInstance] MessageCostEstimateInstance
143
+ def initialize(version, payload )
144
+ super(version)
145
+
146
+
147
+ # Marshaled Properties
148
+ @properties = {
149
+ 'currency' => payload['currency'],
150
+ 'country' => payload['country'],
151
+ 'lookback_window' => payload['lookback_window'],
152
+ 'estimates' => payload['estimates'],
153
+ 'disclaimer' => payload['disclaimer'],
154
+ }
155
+ end
156
+
157
+
158
+ ##
159
+ # @return [String] The WhatsApp Business Account's currency (e.g. `USD`). `bidAmount` and cost bounds are in this currency's smallest unit.
160
+ def currency
161
+ @properties['currency']
162
+ end
163
+
164
+ ##
165
+ # @return [String] The ISO-3166-1 alpha-2 country code the estimate was computed for.
166
+ def country
167
+ @properties['country']
168
+ end
169
+
170
+ ##
171
+ # @return [String] The historical lookback window used to compute the estimate.
172
+ def lookback_window
173
+ @properties['lookback_window']
174
+ end
175
+
176
+ ##
177
+ # @return [Array<MessageCostEstimateBidLevel>] One entry per bid level.
178
+ def estimates
179
+ @properties['estimates']
180
+ end
181
+
182
+ ##
183
+ # @return [String] Estimates are historical and informational only; actual delivery and cost may vary.
184
+ def disclaimer
185
+ @properties['disclaimer']
186
+ end
187
+
188
+ ##
189
+ # Provide a user friendly representation
190
+ def to_s
191
+ "<Twilio.Messaging.V3.MessageCostEstimateInstance>"
192
+ end
193
+
194
+ ##
195
+ # Provide a detailed, user friendly representation
196
+ def inspect
197
+ "<Twilio.Messaging.V3.MessageCostEstimateInstance>"
198
+ end
199
+ end
200
+
201
+ end
202
+ end
203
+ end
204
+ end
@@ -21,9 +21,15 @@ module Twilio
21
21
  def initialize(domain)
22
22
  super
23
23
  @version = 'v3'
24
+ @message_cost_estimate = nil
24
25
  @typing_indicator = nil
25
26
  end
26
27
 
28
+ ##
29
+ # @return [Twilio::REST::Messaging::V3::MessageCostEstimateList]
30
+ def message_cost_estimate
31
+ @message_cost_estimate ||= MessageCostEstimateList.new self
32
+ end
27
33
  ##
28
34
  # @return [Twilio::REST::Messaging::V3::TypingIndicatorList]
29
35
  def typing_indicator
@@ -23,7 +23,6 @@ module Twilio
23
23
  @port = 443
24
24
  @v1 = nil
25
25
  @v2 = nil
26
- @v3 = nil
27
26
  end
28
27
 
29
28
  def v1
@@ -34,10 +33,6 @@ module Twilio
34
33
  @v2 ||= Numbers::V2.new self
35
34
  end
36
35
 
37
- def v3
38
- @v3 ||= Numbers::V3.new self
39
- end
40
-
41
36
  ##
42
37
  # Provide a user friendly representation
43
38
  def to_s
@@ -25,14 +25,14 @@ module Twilio
25
25
  # @param [friendly_name]: [String] A human-readable name for the brand registration.
26
26
  # @param [notification_email]: [String] The email address to receive notifications about the registration.
27
27
  # @param [business_name]: [String] The legal name of the business.
28
- # @param [business_registration_authority]: [String] The authority with which the business is registered.
28
+ # @param [business_registration_authority]: [String] The authority with which the business is registered. The value is validated by the service; see the Twilio docs for accepted values.
29
29
  # @param [business_registration_number]: [String] The business registration number (e.g., EIN, CBN, ACN). Maximum 21 characters.
30
- # @param [business_industry]: [String] The industry of the business.
30
+ # @param [business_industry]: [String] The industry of the business. The value is validated by the service; see the Twilio docs for accepted values.
31
31
  # @param [business_website]: [String] The business website URL (must use https://).
32
- # @param [business_type]: [String] The type of business entity.
32
+ # @param [business_type]: [String] The type of business entity. The value is validated by the service; see the Twilio docs for accepted values.
33
33
  # @param [business_stock_symbol]: [String] The stock symbol for publicly traded companies.
34
- # @param [business_stock_exchange]: [String] The stock exchange where the business is listed.
35
- # @param [business_tax_exempt_status]: [String] Nonprofit/political organization tax-exempt status per the U.S. tax code (e.g. 501c3, 501c1, 527). A value of 527 (political organization) requires a Campaign Verify token in brandExternalVettingToken.
34
+ # @param [business_stock_exchange]: [String] The stock exchange where the business is listed. The value is validated by the service; see the Twilio docs for accepted values.
35
+ # @param [business_tax_exempt_status]: [String] Nonprofit/political organization tax-exempt status per the U.S. tax code (e.g. 501c3, 501c1, 527). A value of 527 (political organization) requires a Campaign Verify token in brandExternalVettingToken. The value is validated by the service; see the Twilio docs for accepted values.
36
36
  # @param [brand_external_vetting_token]: [String] Campaign Verify token for externally vetted brands.
37
37
  # @param [business_street_address]: [String] The street address of the business.
38
38
  # @param [business_street_address2]: [String] Additional street address information.
@@ -20,17 +20,17 @@ module Twilio
20
20
  class A2PCampaignRegistrationList < ListResource
21
21
 
22
22
  class TrusthubV1A2pCampaignRegistrationRequest
23
- # @param [a2p_brand_registration_sid]: [String] The legacy Twilio A2P Brand SID (BN-prefixed) for the brand this campaign is registered under. This is a different identifier from the `id` returned by the Initialize Brand endpoint (which is formatted as `tri1.us1.account.AC.../registration.BU...`). Retrieve the BN brand SID via [GET /v1/a2p/BrandRegistrations/{Sid}](https://www.twilio.com/docs/messaging/api/brand-registration-resource) on `messaging.twilio.com`.
24
- # @param [messaging_service_sid]: [String] The SID of the Messaging Service.
23
+ # @param [a2p_brand_registration_sid]: [String] The legacy Twilio A2P Brand SID (BN-prefixed) for the brand this campaign is registered under. This is a different identifier from the `id` returned by the Initialize Brand endpoint (which is formatted as `tri1.us1.account.AC.../registration.BU...`). Retrieve the BN brand SID via [GET /v1/a2p/BrandRegistrations/{Sid}](https://www.twilio.com/docs/messaging/api/brand-registration-resource) on `messaging.twilio.com`. This field keeps the legacy Sid name because it carries a legacy Twilio SID (BN prefix) from messaging.twilio.com.
24
+ # @param [messaging_service_sid]: [String] The SID of the Messaging Service. This field keeps the legacy Sid name because it carries a legacy Twilio SID (MG prefix) from messaging.twilio.com.
25
25
  # @param [theme_set_id]: [String] Theme ID for styling the inquiry form.
26
- # @param [use_case_categories]: [Array<String>] The categories of the messaging use case.
26
+ # @param [use_case_categories]: [Array<String>] The categories of the messaging use case. The value is validated by the service; see the Twilio docs for accepted values.
27
27
  # @param [use_case_description]: [String] A description of the messaging use case.
28
28
  # @param [use_case_sample_message1]: [String] A sample message for the use case.
29
29
  # @param [use_case_sample_message2]: [String] A second sample message for the use case.
30
30
  # @param [use_case_sample_message3]: [String] A third sample message for the use case.
31
31
  # @param [use_case_sample_message4]: [String] A fourth sample message for the use case.
32
32
  # @param [use_case_sample_message5]: [String] A fifth sample message for the use case.
33
- # @param [use_case_opt_in_types]: [Array<String>] The opt-in methods for the use case.
33
+ # @param [use_case_opt_in_types]: [Array<String>] The opt-in methods for the use case. The value is validated by the service; see the Twilio docs for accepted values.
34
34
  # @param [use_case_opt_in_description]: [String] A description of the opt-in process.
35
35
  # @param [has_embedded_links]: [Boolean] Whether messages will contain embedded links.
36
36
  # @param [has_embedded_phone]: [Boolean] Whether messages will contain embedded phone numbers.
@@ -510,6 +510,10 @@ module Twilio
510
510
  'channel_endpoint_sid' => payload['channel_endpoint_sid'],
511
511
  'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
512
512
  'url' => payload['url'],
513
+ 'code' => payload['code'],
514
+ 'message' => payload['message'],
515
+ 'more_info' => payload['more_info'],
516
+ 'status' => payload['status'],
513
517
  }
514
518
 
515
519
  # Context
@@ -570,6 +574,30 @@ module Twilio
570
574
  @properties['url']
571
575
  end
572
576
 
577
+ ##
578
+ # @return [String] Twilio-specific error code
579
+ def code
580
+ @properties['code']
581
+ end
582
+
583
+ ##
584
+ # @return [String] Error message
585
+ def message
586
+ @properties['message']
587
+ end
588
+
589
+ ##
590
+ # @return [String] Link to Error Code References
591
+ def more_info
592
+ @properties['more_info']
593
+ end
594
+
595
+ ##
596
+ # @return [String] HTTP response status code
597
+ def status
598
+ @properties['status']
599
+ end
600
+
573
601
  ##
574
602
  # Delete the CustomerProfilesChannelEndpointAssignmentInstance
575
603
  # @return [Boolean] True if delete succeeds, false otherwise
@@ -510,6 +510,10 @@ module Twilio
510
510
  'channel_endpoint_sid' => payload['channel_endpoint_sid'],
511
511
  'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
512
512
  'url' => payload['url'],
513
+ 'code' => payload['code'],
514
+ 'message' => payload['message'],
515
+ 'more_info' => payload['more_info'],
516
+ 'status' => payload['status'],
513
517
  }
514
518
 
515
519
  # Context
@@ -570,6 +574,30 @@ module Twilio
570
574
  @properties['url']
571
575
  end
572
576
 
577
+ ##
578
+ # @return [String] Twilio-specific error code
579
+ def code
580
+ @properties['code']
581
+ end
582
+
583
+ ##
584
+ # @return [String] Error message
585
+ def message
586
+ @properties['message']
587
+ end
588
+
589
+ ##
590
+ # @return [String] Link to Error Code References
591
+ def more_info
592
+ @properties['more_info']
593
+ end
594
+
595
+ ##
596
+ # @return [String] HTTP response status code
597
+ def status
598
+ @properties['status']
599
+ end
600
+
573
601
  ##
574
602
  # Delete the TrustProductsChannelEndpointAssignmentInstance
575
603
  # @return [Boolean] True if delete succeeds, false otherwise
@@ -45,7 +45,7 @@ module Twilio
45
45
  @a2p_brand_registrations ||= A2PBrandRegistrationList.new self
46
46
  end
47
47
  ##
48
- # @param [String] id The unique identifier for the A2P Brand Registration.
48
+ # @param [String] id The unique identifier for the A2P Brand Registration, as returned in the `id` field when the brand registration was created.
49
49
  # @return [Twilio::REST::Trusthub::V1::A2PBrandRegistrationEmbeddedSessionList]
50
50
  def a2p_brand_registration_embedded_sessions(id=:unset)
51
51
  if id.nil?
@@ -64,7 +64,7 @@ module Twilio
64
64
  @a2p_campaign_registrations ||= A2PCampaignRegistrationList.new self
65
65
  end
66
66
  ##
67
- # @param [String] id The unique identifier for the A2P Campaign Registration. This can be either an A2P Campaign Registration ID (formatted `tri1.us1.account.AC.../registration.BU...`) returned from the Initialize Campaign endpoint, or a Messaging Service SID (`MG...`) for campaigns created outside the embeddable.
67
+ # @param [String] id The unique identifier for the A2P Campaign Registration. This is the A2P Campaign Registration ID (formatted `tri1.us1.account.AC.../registration.BU...`) returned in the `id` field when the campaign registration was created. For a campaign in FAILED status, use the Messaging Service SID (`MG...`) of the campaign instead.
68
68
  # @return [Twilio::REST::Trusthub::V1::A2PCampaignRegistrationEmbeddedSessionList]
69
69
  def a2p_campaign_registration_embedded_sessions(id=:unset)
70
70
  if id.nil?