twilio-ruby 6.0.0.pre.rc.3 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +84 -48
  3. data/CONTRIBUTING.md +10 -8
  4. data/README.md +128 -46
  5. data/UPGRADE.md +7 -4
  6. data/advanced-examples/custom-http-client.md +170 -0
  7. data/lib/twilio-ruby/rest/api/v2010/account/address.rb +1 -6
  8. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number_country.rb +7 -42
  9. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +8 -42
  10. data/lib/twilio-ruby/rest/api/v2010/account/conference.rb +2 -10
  11. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/assigned_add_on.rb +1 -6
  12. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb +1 -5
  13. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +2 -11
  14. data/lib/twilio-ruby/rest/api/v2010/account/queue.rb +1 -5
  15. data/lib/twilio-ruby/rest/api/v2010/account/recording/add_on_result.rb +1 -6
  16. data/lib/twilio-ruby/rest/api/v2010/account/recording.rb +2 -10
  17. data/lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb +1 -5
  18. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb +3 -16
  19. data/lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list.rb +1 -5
  20. data/lib/twilio-ruby/rest/api/v2010/account.rb +24 -103
  21. data/lib/twilio-ruby/rest/autopilot/v1/assistant/field_type.rb +1 -5
  22. data/lib/twilio-ruby/rest/autopilot/v1/assistant/task.rb +2 -10
  23. data/lib/twilio-ruby/rest/autopilot/v1/assistant.rb +6 -24
  24. data/lib/twilio-ruby/rest/bulkexports/v1/export.rb +2 -9
  25. data/lib/twilio-ruby/rest/chat/v1/service/channel.rb +3 -15
  26. data/lib/twilio-ruby/rest/chat/v1/service/user.rb +1 -6
  27. data/lib/twilio-ruby/rest/chat/v1/service.rb +3 -12
  28. data/lib/twilio-ruby/rest/chat/v2/service/channel.rb +4 -20
  29. data/lib/twilio-ruby/rest/chat/v2/service/user.rb +2 -10
  30. data/lib/twilio-ruby/rest/chat/v2/service.rb +4 -16
  31. data/lib/twilio-ruby/rest/conversations/v1/conversation/message.rb +1 -5
  32. data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +6 -36
  33. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb +1 -6
  34. data/lib/twilio-ruby/rest/conversations/v1/service/conversation.rb +6 -39
  35. data/lib/twilio-ruby/rest/conversations/v1/service/user.rb +1 -5
  36. data/lib/twilio-ruby/rest/conversations/v1/service.rb +5 -21
  37. data/lib/twilio-ruby/rest/conversations/v1/user.rb +1 -4
  38. data/lib/twilio-ruby/rest/events/v1/schema.rb +1 -4
  39. data/lib/twilio-ruby/rest/events/v1/sink.rb +2 -10
  40. data/lib/twilio-ruby/rest/events/v1/subscription.rb +1 -4
  41. data/lib/twilio-ruby/rest/flex_api/v1/assessments.rb +20 -20
  42. data/lib/twilio-ruby/rest/flex_api/v1/insights_assessments_comment.rb +5 -5
  43. data/lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires.rb +23 -23
  44. data/lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_category.rb +13 -13
  45. data/lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb +31 -31
  46. data/lib/twilio-ruby/rest/flex_api/v1/insights_segments.rb +13 -86
  47. data/lib/twilio-ruby/rest/flex_api/v1/insights_settings_answer_sets.rb +1 -1
  48. data/lib/twilio-ruby/rest/flex_api/v1/insights_settings_comment.rb +1 -1
  49. data/lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb +2 -11
  50. data/lib/twilio-ruby/rest/flex_api/v1/interaction.rb +1 -4
  51. data/lib/twilio-ruby/rest/flex_api/v1.rb +30 -39
  52. data/lib/twilio-ruby/rest/insights/v1/call.rb +2 -10
  53. data/lib/twilio-ruby/rest/insights/v1/conference.rb +1 -4
  54. data/lib/twilio-ruby/rest/insights/v1/room.rb +1 -4
  55. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb +3 -15
  56. data/lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb +1 -6
  57. data/lib/twilio-ruby/rest/ip_messaging/v1/service.rb +3 -12
  58. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel.rb +4 -20
  59. data/lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb +2 -10
  60. data/lib/twilio-ruby/rest/ip_messaging/v2/service.rb +4 -16
  61. data/lib/twilio-ruby/rest/messaging/v1/brand_registration.rb +2 -9
  62. data/lib/twilio-ruby/rest/messaging/v1/service.rb +31 -47
  63. data/lib/twilio-ruby/rest/messaging/v1.rb +0 -15
  64. data/lib/twilio-ruby/rest/messaging.rb +1 -1
  65. data/lib/twilio-ruby/rest/microvisor/v1/device.rb +2 -8
  66. data/lib/twilio-ruby/rest/microvisor.rb +2 -1
  67. data/lib/twilio-ruby/rest/notify/v1/service.rb +2 -9
  68. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb +4 -18
  69. data/lib/twilio-ruby/rest/numbers_base.rb +1 -6
  70. data/lib/twilio-ruby/rest/oauth.rb +1 -1
  71. data/lib/twilio-ruby/rest/preview/deployed_devices/fleet.rb +4 -16
  72. data/lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document.rb +1 -5
  73. data/lib/twilio-ruby/rest/preview/marketplace/available_add_on.rb +1 -4
  74. data/lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb +1 -4
  75. data/lib/twilio-ruby/rest/preview/sync/service/document.rb +1 -5
  76. data/lib/twilio-ruby/rest/preview/sync/service/sync_list.rb +2 -10
  77. data/lib/twilio-ruby/rest/preview/sync/service/sync_map.rb +2 -10
  78. data/lib/twilio-ruby/rest/preview/sync/service.rb +3 -12
  79. data/lib/twilio-ruby/rest/preview/understand/assistant/field_type.rb +1 -5
  80. data/lib/twilio-ruby/rest/preview/understand/assistant/task.rb +2 -10
  81. data/lib/twilio-ruby/rest/preview/understand/assistant.rb +5 -20
  82. data/lib/twilio-ruby/rest/proxy/v1/service/session/participant.rb +1 -6
  83. data/lib/twilio-ruby/rest/proxy/v1/service/session.rb +2 -10
  84. data/lib/twilio-ruby/rest/proxy/v1/service.rb +3 -12
  85. data/lib/twilio-ruby/rest/serverless/v1/service/asset.rb +1 -5
  86. data/lib/twilio-ruby/rest/serverless/v1/service/environment.rb +3 -15
  87. data/lib/twilio-ruby/rest/serverless/v1/service/function.rb +1 -5
  88. data/lib/twilio-ruby/rest/serverless/v1/service.rb +4 -16
  89. data/lib/twilio-ruby/rest/studio/v1/flow/engagement.rb +1 -5
  90. data/lib/twilio-ruby/rest/studio/v1/flow/execution.rb +1 -5
  91. data/lib/twilio-ruby/rest/studio/v1/flow.rb +2 -8
  92. data/lib/twilio-ruby/rest/studio/v2/flow/execution.rb +1 -5
  93. data/lib/twilio-ruby/rest/studio/v2/flow.rb +2 -8
  94. data/lib/twilio-ruby/rest/supersim/v1/network_access_profile.rb +1 -4
  95. data/lib/twilio-ruby/rest/supersim/v1/sim.rb +2 -10
  96. data/lib/twilio-ruby/rest/sync/v1/service/document.rb +1 -5
  97. data/lib/twilio-ruby/rest/sync/v1/service/sync_list.rb +2 -10
  98. data/lib/twilio-ruby/rest/sync/v1/service/sync_map.rb +2 -10
  99. data/lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb +1 -6
  100. data/lib/twilio-ruby/rest/sync/v1/service.rb +4 -16
  101. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb +1 -5
  102. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb +2 -10
  103. data/lib/twilio-ruby/rest/taskrouter/v1/workspace.rb +7 -28
  104. data/lib/twilio-ruby/rest/trunking/v1/trunk.rb +4 -16
  105. data/lib/twilio-ruby/rest/trusthub/v1/customer_profiles.rb +3 -12
  106. data/lib/twilio-ruby/rest/trusthub/v1/trust_products.rb +3 -12
  107. data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb +1 -7
  108. data/lib/twilio-ruby/rest/verify/v2/service/entity.rb +3 -16
  109. data/lib/twilio-ruby/rest/verify/v2/service/rate_limit.rb +1 -5
  110. data/lib/twilio-ruby/rest/verify/v2/service.rb +7 -29
  111. data/lib/twilio-ruby/rest/video/v1/room/participant.rb +3 -16
  112. data/lib/twilio-ruby/rest/video/v1/room.rb +3 -13
  113. data/lib/twilio-ruby/rest/voice/v1/connection_policy.rb +1 -4
  114. data/lib/twilio-ruby/rest/voice/v1/dialing_permissions/country.rb +1 -5
  115. data/lib/twilio-ruby/rest/wireless/v1/sim.rb +2 -10
  116. data/lib/twilio-ruby/version.rb +1 -1
  117. data/twilio-ruby.gemspec +1 -1
  118. metadata +9 -9
  119. data/lib/twilio-ruby/rest/messaging/v1/tollfree_verification.rb +0 -744
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b50bcb41c0f25e83979ea7c86cd34be29192f84e
4
- data.tar.gz: 03f7b80f2d0c3feede506fd95a8fa0adcf5772ff
3
+ metadata.gz: 85039c08af528f9313181700dd95e0899d8c7804
4
+ data.tar.gz: e3a4908a007fb1f83e5251938955b495cb33c2a1
5
5
  SHA512:
6
- metadata.gz: 468b2e3cbd98d1e945f567a6c9a6d2efe5638f7fb2c4ed6645369bfde36285cde24579ddbdc3a3579b4d13bee0f4028df854ef597603da465763a8e9fb1183e9
7
- data.tar.gz: d0160a37b6db988eb7b06cc881e0b1894173835571ce1e870f8b48a4f4fc38d7bd0a55860a56213920594f536ceb3e4613f7a1eb1d73f070bad9814dfe0b5bac
6
+ metadata.gz: bf79a09337c97ca9584703af2520e49964e76fe32c4fdb4e1502b24592577d98e2823581534881ed131d61cd48c820286d10acfe69f671ba29b13fa26eb8c292
7
+ data.tar.gz: 115c92304528bd4f7bf8fc372166e7e85c4de548f900214de6e884cee4d45fd460c0fc1c908aebadf24e8364f169a8432f537dbaacf24f388eab4fc1df3e1714
data/CHANGES.md CHANGED
@@ -1,13 +1,24 @@
1
1
  twilio-ruby changelog
2
- =====================
2
+ =====================
3
3
 
4
- [2023-04-19] Version 6.0.0-rc.3
5
- -------------------------------
6
- **Library - Fix**
7
- - [PR #644](https://github.com/twilio/twilio-ruby/pull/644): remove deprecated access token grants. Thanks to [@kridai](https://github.com/kridai)!
4
+ [2023-05-04] Version 6.0.0
5
+ --------------------------
6
+ **Note:** This release contains breaking changes, check our [upgrade guide](./UPGRADE.md#2023-05-03-5xx-to-6xx) for detailed migration notes.
8
7
 
9
- **Library - Chore**
10
- - [PR #647](https://github.com/twilio/twilio-ruby/pull/647): update client.rb. Thanks to [@shrutiburman](https://github.com/shrutiburman)!
8
+ **Library - Feature**
9
+ - [PR #651](https://github.com/twilio/twilio-ruby/pull/651): Merge branch '6.x.x-rc' to main. Thanks to [@shrutiburman](https://github.com/shrutiburman)! **(breaking change)**
10
+
11
+ **Conversations**
12
+ - Remove `start_date`, `end_date` and `state` query parameters from list operation on Conversations resource **(breaking change)**
13
+
14
+ **Twiml**
15
+ - Add support for new Amazon Polly voices (Q1 2023) for `Say` verb
16
+
17
+
18
+ [2023-04-19] Version 5.77.0
19
+ ---------------------------
20
+ **Library - Docs**
21
+ - [PR #645](https://github.com/twilio/twilio-ruby/pull/645): consolidate. Thanks to [@stern-shawn](https://github.com/stern-shawn)!
11
22
 
12
23
  **Messaging**
13
24
  - Remove `messaging_service_sids` and `messaging_service_sid_action` from domain config endpoint **(breaking change)**
@@ -17,15 +28,8 @@ twilio-ruby changelog
17
28
  - Added the new Eligibility API under version `/v1`.
18
29
 
19
30
 
20
- [2023-04-05] Version 6.0.0-rc.2
21
- -------------------------------
22
- **Library - Fix**
23
- - [PR #642](https://github.com/twilio/twilio-ruby/pull/642): remove deprecated Twilio::REST::TwilioError#body. Thanks to [@kridai](https://github.com/kridai)!
24
- - [PR #641](https://github.com/twilio/twilio-ruby/pull/641): remove deprecated TwilioResponse class. Thanks to [@kridai](https://github.com/kridai)!
25
-
26
- **Library - Chore**
27
- - [PR #643](https://github.com/twilio/twilio-ruby/pull/643): extend ruby & jruby support. Thanks to [@shrutiburman](https://github.com/shrutiburman)!
28
-
31
+ [2023-04-05] Version 5.76.0
32
+ ---------------------------
29
33
  **Conversations**
30
34
  - Expose query parameters `start_date`, `end_date` and `state` in list operation on Conversations resource for sorting and filtering
31
35
 
@@ -42,52 +46,93 @@ twilio-ruby changelog
42
46
  - Add Brand Registrations OTP API
43
47
 
44
48
 
45
- [2023-03-23] Version 6.0.0-rc.1
46
- -------------------------------
47
- **Library - Fix**
48
- - [PR #639](https://github.com/twilio/twilio-ruby/pull/639): add all handcrafted domain files. Thanks to [@charan678](https://github.com/charan678)!
49
-
49
+ [2023-03-22] Version 5.75.0
50
+ ---------------------------
50
51
  **Library - Chore**
51
- - [PR #631](https://github.com/twilio/twilio-ruby/pull/631): Add Cluster test to rc branch. Thanks to [@rohith-prakash](https://github.com/rohith-prakash)!
52
- - [PR #627](https://github.com/twilio/twilio-ruby/pull/627): bump jwt max version to 2.6. Thanks to [@claudiachua](https://github.com/claudiachua)!
53
-
54
- **Library - Feature**
55
- - [PR #622](https://github.com/twilio/twilio-ruby/pull/622): Add client base file. Thanks to [@shrutiburman](https://github.com/shrutiburman)!
52
+ - [PR #630](https://github.com/twilio/twilio-ruby/pull/630): Accommodate jwt's minor and patch updates. Thanks to [@sato11](https://github.com/sato11)!
56
53
 
57
54
  **Api**
58
55
  - Revert Corrected the data type for `friendly_name` in Available Phone Number Local, Mobile and TollFree resources
59
56
  - Corrected the data type for `friendly_name` in Available Phone Number Local, Mobile and TollFree resources **(breaking change)**
57
+
58
+ **Messaging**
59
+ - Add `linkshortening_messaging_service` resource
60
+ - Add new endpoint for GetDomainConfigByMessagingServiceSid
61
+ - Remove `validated` parameter and add `cert_in_validation` parameter to Link Shortening API **(breaking change)**
62
+
63
+
64
+ [2023-03-09] Version 5.74.5
65
+ ---------------------------
66
+ **Api**
60
67
  - Add new categories for whatsapp template
68
+
69
+ **Lookups**
70
+ - Remove `validation_results` from the `default_output_properties`
71
+
72
+ **Supersim**
73
+ - Add ESimProfile's `matching_id` and `activation_code` parameters to libraries
74
+
75
+
76
+ [2023-02-22] Version 5.74.4
77
+ ---------------------------
78
+ **Api**
61
79
  - Remove `scheduled_for` property from message resource
62
80
  - Add `scheduled_for` property to message resource
81
+
82
+
83
+ [2023-02-08] Version 5.74.3
84
+ ---------------------------
85
+ **Lookups**
86
+ - Add `disposable_phone_number_risk` package to the lookup response
87
+ - Add `sms_pumping_risk` package to the lookup response
88
+
89
+
90
+ [2023-01-25] Version 5.74.2
91
+ ---------------------------
92
+ **Api**
63
93
  - Add `public_application_connect_enabled` param to Application resource
64
- - Add `street_secondary` param to address create and update
65
- - Make `method` optional for user defined message subscription **(breaking change)**
94
+
95
+ **Messaging**
96
+ - Add new tollfree verification API property (ExternalReferenceId)]
97
+
98
+ **Verify**
99
+ - Add `device_ip` parameter and channel `auto` for sna/sms orchestration
100
+
101
+ **Twiml**
102
+ - Add support for `<Application>` noun and `<ApplicationSid>` noun, nested `<Parameter>` to `<Hangup>` and `<Leave>` verb
103
+
104
+
105
+ [2023-01-11] Version 5.74.1
106
+ ---------------------------
107
+ **Library - Chore**
108
+ - [PR #626](https://github.com/twilio/twilio-ruby/pull/626): Bump jwt version max version to 2.6. Thanks to [@MarcPer](https://github.com/MarcPer)!
66
109
 
67
110
  **Conversations**
68
111
  - Add support for creating Multi-Channel Rich Content Messages
69
112
 
113
+ **Lookups**
114
+ - Changed the no data message for match postal code from `no_data` to `data_not_available` in identity match package
115
+
116
+ **Messaging**
117
+ - Add update/edit tollfree verification API
118
+
119
+
120
+ [2022-12-14] Version 5.74.0
121
+ ---------------------------
122
+ **Api**
123
+ - Add `street_secondary` param to address create and update
124
+ - Make `method` optional for user defined message subscription **(breaking change)**
125
+
70
126
  **Flex**
71
127
  - Flex Conversations is now Generally Available
72
128
  - Adding the ie1 mapping for authorization api, updating service base uri and base url response attribute **(breaking change)**
73
129
  - Change web channels to GA and library visibility to public
74
130
  - Changing the uri for authorization api from using Accounts to Insights **(breaking change)**
75
131
 
76
- **Lookups**
77
- - Remove `validation_results` from the `default_output_properties`
78
- - Add `disposable_phone_number_risk` package to the lookup response
79
- - Add `sms_pumping_risk` package to the lookup response
80
- - Changed the no data message for match postal code from `no_data` to `data_not_available` in identity match package
81
-
82
132
  **Media**
83
133
  - Gate Twilio Live endpoints behind beta_feature for EOS
84
134
 
85
135
  **Messaging**
86
- - Add `linkshortening_messaging_service` resource
87
- - Add new endpoint for GetDomainConfigByMessagingServiceSid
88
- - Remove `validated` parameter and add `cert_in_validation` parameter to Link Shortening API **(breaking change)**
89
- - Add new tollfree verification API property (ExternalReferenceId)]
90
- - Add update/edit tollfree verification API
91
136
  - Mark `MessageFlow` as a required field for Campaign Creation **(breaking change)**
92
137
 
93
138
  **Oauth**
@@ -95,14 +140,9 @@ twilio-ruby changelog
95
140
  - Added device code authorization endpoint
96
141
 
97
142
  **Supersim**
98
- - Add ESimProfile's `matching_id` and `activation_code` parameters to libraries
99
143
  - Allow filtering the SettingsUpdates resource by `status`
100
144
 
101
- **Verify**
102
- - Add `device_ip` parameter and channel `auto` for sna/sms orchestration
103
-
104
145
  **Twiml**
105
- - Add support for `<Application>` noun and `<ApplicationSid>` noun, nested `<Parameter>` to `<Hangup>` and `<Leave>` verb
106
146
  - Add new Polly Neural voices
107
147
  - Add tr-TR, ar-AE, yue-CN, fi-FI languages to SSML `<lang>` element.
108
148
  - Add x-amazon-jyutping, x-amazon-pinyin, x-amazon-pron-kana, x-amazon-yomigana alphabets to SSML `<phoneme>` element.
@@ -110,10 +150,6 @@ twilio-ruby changelog
110
150
  - Rename `role` attribute to `format` in SSML `<say-as>` element. **(breaking change)**
111
151
 
112
152
 
113
- [2023-03-23] Version 6.0.0-rc.0
114
- ---------------------------
115
- - Release Candidate prep
116
-
117
153
  [2022-11-30] Version 5.73.4
118
154
  ---------------------------
119
155
  **Flex**
data/CONTRIBUTING.md CHANGED
@@ -21,7 +21,7 @@ it can be.
21
21
  ## <a name="question"></a> Got an API/Product Question or Problem?
22
22
 
23
23
  If you have questions about how to use `twilio-ruby`, please see our
24
- [docs][docs-link], and if you don't find the answer there, please contact
24
+ [docs](./README.md), and if you don't find the answer there, please contact
25
25
  [help@twilio.com](mailto:help@twilio.com) with any issues you have.
26
26
 
27
27
  ## <a name="issue"></a> Found an Issue?
@@ -37,6 +37,14 @@ This code was generated by
37
37
  / /
38
38
  """
39
39
  ```
40
+ or
41
+ ```
42
+ * This code was generated by
43
+ * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
44
+ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
45
+ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
46
+ *
47
+ ```
40
48
  then it is a generated file and the change will need to be made by us, but
41
49
  submitting an issue will help us track it and keep you up-to-date. If the file
42
50
  isn't generated, you can help us out even more by submitting a Pull Request with
@@ -68,10 +76,6 @@ you're working on.
68
76
  For large fixes, please build and test the documentation before submitting the
69
77
  PR to be sure you haven't accidentally introduced layout or formatting issues.
70
78
 
71
- If you want to help improve the docs at
72
- [https://www.twilio.com/docs/libraries/ruby][docs-link], please contact
73
- [help@twilio.com](mailto:help@twilio.com).
74
-
75
79
  ## <a name="submit"></a> Submission Guidelines
76
80
 
77
81
  ### Submitting an Issue
@@ -155,7 +159,5 @@ you are working:
155
159
  * All features or bug fixes **must be tested** by one or more tests.
156
160
  * All classes and methods **must be documented**.
157
161
 
158
-
159
- [docs-link]: https://www.twilio.com/docs/libraries/ruby
160
162
  [issue-link]: https://github.com/twilio/twilio-ruby/issues/new
161
- [github]: https://github.com/twilio/twilio-ruby
163
+ [github]: https://github.com/twilio/twilio-ruby
data/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  The documentation for the Twilio API can be found [here][apidocs].
10
10
 
11
- The Ruby library documentation can be found [here][libdocs] and individual releases [here][refdocs].
11
+ The individual releases [here][refdocs].
12
12
 
13
13
  ## Versions
14
14
 
@@ -30,7 +30,7 @@ This library supports the following Ruby implementations:
30
30
  * JRuby 9.3
31
31
  * JRuby 9.4
32
32
 
33
- ### Migrating from 4.x
33
+ ### Migrating from 5.x
34
34
 
35
35
  [Upgrade Guide][upgrade]
36
36
 
@@ -39,19 +39,13 @@ This library supports the following Ruby implementations:
39
39
  To install using [Bundler][bundler] grab the latest stable version:
40
40
 
41
41
  ```ruby
42
- gem 'twilio-ruby', '~> 6.0.0-rc.3'
42
+ gem 'twilio-ruby', '~> 6.0.0'
43
43
  ```
44
44
 
45
45
  To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:
46
46
 
47
47
  ```bash
48
- gem install twilio-ruby -v 6.0.0-rc.3
49
- ```
50
-
51
- To install `twilio-ruby` release candidate via [Rubygems][rubygems] simply gem install:
52
-
53
- ```bash
54
- gem install twilio-ruby -v 6.0.0-rc.3
48
+ gem install twilio-ruby -v 6.0.0
55
49
  ```
56
50
 
57
51
  To build and install the development branch yourself from the latest source:
@@ -62,18 +56,47 @@ cd twilio-ruby
62
56
  make install
63
57
  ```
64
58
 
65
- ## Getting Started
59
+ > **Info**
60
+ > If the command line gives you an error message that says Permission Denied, try running the above commands with sudo.
61
+ >
62
+ > For example: `sudo gem install twilio-ruby`
63
+
64
+ ### Test your installation
65
+
66
+ To make sure the installation was successful, try sending yourself an SMS message, like this:
66
67
 
67
- ### Setup Work
68
+ ```rb
69
+ require "twilio-ruby"
70
+
71
+ # Your Account SID and Auth Token from console.twilio.com
72
+ account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
73
+ auth_token = "your_auth_token"
74
+
75
+ @client = Twilio::REST::Client.new account_sid, auth_token
76
+ message = @client.messages.create(
77
+ body: "Hello from Ruby",
78
+ to: "+12345678901", # Text this number
79
+ from: "+15005550006", # From a valid Twilio number
80
+ )
81
+
82
+ puts message.sid
83
+ ```
84
+
85
+ > **Warning**
86
+ > It's okay to hardcode your credentials when testing locally, but you should use environment variables to keep them secret before committing any code or deploying to production. Check out [How to Set Environment Variables](https://www.twilio.com/blog/2017/01/how-to-set-environment-variables.html) for more information.
87
+
88
+ ## Usage
89
+
90
+ ### Authenticate the Client
68
91
 
69
92
  ```ruby
70
93
  require 'twilio-ruby'
71
94
 
72
- # put your own credentials here
95
+ # Your Account SID and Auth Token from console.twilio.com
73
96
  account_sid = 'ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
74
97
  auth_token = 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'
75
98
 
76
- # set up a client to talk to the Twilio REST API
99
+ # Initialize the Twilio Client with your credentials
77
100
  @client = Twilio::REST::Client.new account_sid, auth_token
78
101
  ```
79
102
 
@@ -82,8 +105,9 @@ auth_token = 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'
82
105
  ```ruby
83
106
  require 'twilio-ruby'
84
107
 
85
- # put your own credentials here
108
+ # Your Account SID from console.twilio.com
86
109
  account_sid = 'ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
110
+ # API Key from twilio.com/console/project/api-keys
87
111
  api_key_sid = 'zzzzzzzzzzzzzzzzzzzzzz'
88
112
  api_key_secret = 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'
89
113
 
@@ -108,22 +132,6 @@ To take advantage of Twilio's [Global Infrastructure](https://www.twilio.com/doc
108
132
 
109
133
  This will result in the `hostname` transforming from `api.twilio.com` to `api.sydney.au1.twilio.com`.
110
134
 
111
- ### Enable Debug logging
112
-
113
- In order to enable debug logging, pass in a 'logger' instance to the client with the level set to at least 'DEBUG'
114
-
115
- ```ruby
116
- @client = Twilio::REST::Client.new account_sid, auth_token
117
- myLogger = Logger.new(STDOUT)
118
- myLogger.level = Logger::DEBUG
119
- @client.logger = myLogger
120
-
121
- @client = Twilio::REST::Client.new account_sid, auth_token
122
- myLogger = Logger.new('my_log.log')
123
- myLogger.level = Logger::DEBUG
124
- @client.logger = myLogger
125
- ```
126
-
127
135
  ### Make a Call
128
136
 
129
137
  ```ruby
@@ -158,27 +166,59 @@ message_sid = 'SMxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
158
166
  @client.messages(message_sid).fetch
159
167
  ```
160
168
 
161
- ### Customizing your HTTP Client
169
+ ### Iterate through records
162
170
 
163
- `twilio-ruby` uses [Faraday][faraday] to make HTTP requests. You can tell `Twilio::REST::Client` to use any of the Faraday adapters like so:
171
+ The library automatically handles paging for you. Collections, such as `calls` and `messages`, have `list` and stream methods that page under the hood. With both `list` and `stream`, you can specify the number of records you want to receive (`limit`) and the maximum size you want each page fetch to be (`page_size`). The library will then handle the task for you.
164
172
 
165
- ```ruby
166
- @client.http_client.adapter = :typhoeus
173
+ `list` eagerly fetches all records and returns them as a list, whereas `stream` returns an enumerator and lazily retrieves pages of records as you iterate over the collection. You can also page manually using the `page` method.
174
+
175
+ For more information about these methods, view the [auto-generated library docs](https://www.twilio.com/docs/libraries/reference/twilio-ruby).
176
+
177
+ ```rb
178
+ require 'twilio-ruby'
179
+
180
+ account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
181
+ auth_token = 'your_auth_token'
182
+
183
+ @client = Twilio::REST::Client.new(account_sid, auth_token)
184
+
185
+ @client.calls.list
186
+ .each do |call|
187
+ puts call.direction
188
+ end
167
189
  ```
168
190
 
169
- To use a custom HTTP client with this helper library, please see the [Twilio documentation](https://www.twilio.com/docs/libraries/ruby/custom-http-clients).
191
+ ### Enable Debug logging
170
192
 
171
- To apply customizations such as middleware, you can use the `configure_connection` method like so:
193
+ In order to enable debug logging, pass in a 'logger' instance to the client with the level set to at least 'DEBUG'
172
194
 
173
195
  ```ruby
174
- @client.http_client.configure_connection do |faraday|
175
- faraday.use SomeMiddleware
176
- end
196
+ @client = Twilio::REST::Client.new account_sid, auth_token
197
+ myLogger = Logger.new(STDOUT)
198
+ myLogger.level = Logger::DEBUG
199
+ @client.logger = myLogger
200
+
201
+ @client = Twilio::REST::Client.new account_sid, auth_token
202
+ myLogger = Logger.new('my_log.log')
203
+ myLogger.level = Logger::DEBUG
204
+ @client.logger = myLogger
177
205
  ```
178
206
 
179
- ### Handling Errors
207
+ ### Handle Exceptions {#exceptions}
208
+
209
+ If the Twilio API returns a 400 or a 500 level HTTP response, the `twilio-ruby`
210
+ library will throw a `Twilio::REST::RestError`. 400-level errors are normal
211
+ during API operation (`“Invalid number”`, `“Cannot deliver SMS to that number”`,
212
+ for example) and should be handled appropriately.
213
+
214
+ ```rb
215
+ require 'twilio-ruby'
216
+
217
+ account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
218
+ auth_token = 'your_auth_token'
219
+
220
+ @client = Twilio::REST::Client.new account_sid, auth_token
180
221
 
181
- ```ruby
182
222
  begin
183
223
  messages = @client.messages.list(limit: 20)
184
224
  rescue Twilio::REST::RestError => e
@@ -186,9 +226,51 @@ rescue Twilio::REST::RestError => e
186
226
  end
187
227
  ```
188
228
 
189
- For more descriptive exception types, please see the [Twilio documentation](https://www.twilio.com/docs/libraries/ruby/usage-guide#error-handling).
229
+ ### Debug API requests
230
+
231
+ To assist with debugging, the library allows you to access the underlying request and response objects. This capability is built into the default HTTP client that ships with the library.
232
+
233
+ For example, you can retrieve the status code of the last response like so:
234
+
235
+ ```ruby
236
+ require 'rubygems' # Not necessary with ruby 1.9 but included for completeness
237
+ require 'twilio-ruby'
238
+
239
+ # Your Account SID and Auth Token from console.twilio.com
240
+ account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
241
+ auth_token = 'your_auth_token'
242
+
243
+ @client = Twilio::REST::Client.new(account_sid, auth_token)
244
+
245
+ @message = @client.messages.create(
246
+ to: '+14158675309',
247
+ from: '+14258675310',
248
+ body: 'Ahoy!'
249
+ )
250
+
251
+ # Retrieve the status code of the last response from the HTTP client
252
+ puts @client.http_client.last_response.status_code
253
+ ```
254
+
255
+ ### Customize your HTTP Client
256
+
257
+ `twilio-ruby` uses [Faraday][faraday] to make HTTP requests. You can tell `Twilio::REST::Client` to use any of the Faraday adapters like so:
258
+
259
+ ```ruby
260
+ @client.http_client.adapter = :typhoeus
261
+ ```
262
+
263
+ To use a custom HTTP client with this helper library, please see the [advanced example of how to do so](./advanced-examples/custom-http-client.md).
264
+
265
+ To apply customizations such as middleware, you can use the `configure_connection` method like so:
266
+
267
+ ```ruby
268
+ @client.http_client.configure_connection do |faraday|
269
+ faraday.use SomeMiddleware
270
+ end
271
+ ```
190
272
 
191
- ### Getting Started With Client Capability Tokens
273
+ ### Get started With Client Capability Tokens
192
274
 
193
275
  If you just need to generate a Capability Token for use with Twilio Client, you can do this:
194
276
 
@@ -216,7 +298,7 @@ capability.add_scope(incoming_scope)
216
298
 
217
299
  There is a slightly more detailed document in the [Capability][capability] section of the wiki.
218
300
 
219
- ### Generating TwiML
301
+ ### Generate TwiML
220
302
 
221
303
  To control phone calls, your application needs to output [TwiML][twiml].
222
304
 
@@ -260,7 +342,7 @@ If you've instead found a bug in the library or would like new features added, g
260
342
 
261
343
  [apidocs]: https://www.twilio.com/docs/api
262
344
  [twiml]: https://www.twilio.com/docs/api/twiml
263
- [libdocs]: https://www.twilio.com/docs/libraries/ruby
345
+ [libdocs]: https://www.twilio.com/docs/libraries/reference/twilio-ruby/
264
346
  [refdocs]: https://twilio.github.io/twilio-ruby
265
347
  [capability]: https://github.com/twilio/twilio-ruby/wiki/JWT-Tokens
266
348
  [wiki]: https://github.com/twilio/twilio-ruby/wiki
data/UPGRADE.md CHANGED
@@ -3,10 +3,13 @@
3
3
  _After `5.0.0` all `MINOR` and `MAJOR` version bumps will have upgrade notes
4
4
  posted here._
5
5
 
6
- [2023-03-23] 5.3.x to 6.0.0-rc.x
7
- ----------------------------
8
- Twilio Ruby Helper Library’s rc version 6.0.0-rc.x is now available. We ensured that you can upgrade to Ruby helper Library 6.0.0-rc version without any breaking changes.
9
- Behind the scenes Ruby RC Helper is now auto-generated via OpenAPI with this release. This enables us to rapidly add new features and enhance consistency across versions and languages.
6
+ [2023-05-03] 5.x.x to 6.x.x
7
+ -----------------------------
8
+ ### Overview
9
+
10
+ ##### Twilio Ruby Helper Library’s major version 6.0.0 is now available. We ensured that you can upgrade to Ruby helper Library 6.0.0 version without any breaking changes
11
+
12
+ Behind the scenes Ruby Helper is now auto-generated via OpenAPI with this release. This enables us to rapidly add new features and enhance consistency across versions and languages.
10
13
 
11
14
  To learn more about the Ruby Helper Library, check out [our docs](https://www.twilio.com/docs/libraries/ruby).
12
15