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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +92 -40
  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/jwt/access_token.rb +0 -59
  8. data/lib/twilio-ruby/rest/api/v2010/account/address.rb +1 -6
  9. data/lib/twilio-ruby/rest/api/v2010/account/available_phone_number_country.rb +7 -42
  10. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +8 -42
  11. data/lib/twilio-ruby/rest/api/v2010/account/conference.rb +2 -10
  12. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/assigned_add_on.rb +1 -6
  13. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb +1 -5
  14. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +2 -11
  15. data/lib/twilio-ruby/rest/api/v2010/account/queue.rb +1 -5
  16. data/lib/twilio-ruby/rest/api/v2010/account/recording/add_on_result.rb +1 -6
  17. data/lib/twilio-ruby/rest/api/v2010/account/recording.rb +2 -10
  18. data/lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb +1 -5
  19. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb +3 -16
  20. data/lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list.rb +1 -5
  21. data/lib/twilio-ruby/rest/api/v2010/account.rb +24 -103
  22. data/lib/twilio-ruby/rest/autopilot/v1/assistant/field_type.rb +1 -5
  23. data/lib/twilio-ruby/rest/autopilot/v1/assistant/task.rb +2 -10
  24. data/lib/twilio-ruby/rest/autopilot/v1/assistant.rb +6 -24
  25. data/lib/twilio-ruby/rest/bulkexports/v1/export.rb +2 -9
  26. data/lib/twilio-ruby/rest/chat/v1/service/channel.rb +3 -15
  27. data/lib/twilio-ruby/rest/chat/v1/service/user.rb +1 -6
  28. data/lib/twilio-ruby/rest/chat/v1/service.rb +3 -12
  29. data/lib/twilio-ruby/rest/chat/v2/service/channel.rb +4 -20
  30. data/lib/twilio-ruby/rest/chat/v2/service/user.rb +2 -10
  31. data/lib/twilio-ruby/rest/chat/v2/service.rb +4 -16
  32. data/lib/twilio-ruby/rest/client.rb +16 -15
  33. data/lib/twilio-ruby/rest/conversations/v1/conversation/message.rb +1 -5
  34. data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +6 -36
  35. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb +1 -6
  36. data/lib/twilio-ruby/rest/conversations/v1/service/conversation.rb +6 -39
  37. data/lib/twilio-ruby/rest/conversations/v1/service/user.rb +1 -5
  38. data/lib/twilio-ruby/rest/conversations/v1/service.rb +5 -21
  39. data/lib/twilio-ruby/rest/conversations/v1/user.rb +1 -4
  40. data/lib/twilio-ruby/rest/events/v1/schema.rb +1 -4
  41. data/lib/twilio-ruby/rest/events/v1/sink.rb +2 -10
  42. data/lib/twilio-ruby/rest/events/v1/subscription.rb +1 -4
  43. data/lib/twilio-ruby/rest/flex_api/v1/assessments.rb +20 -20
  44. data/lib/twilio-ruby/rest/flex_api/v1/insights_assessments_comment.rb +5 -5
  45. data/lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires.rb +23 -23
  46. data/lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_category.rb +13 -13
  47. data/lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb +31 -31
  48. data/lib/twilio-ruby/rest/flex_api/v1/insights_segments.rb +13 -86
  49. data/lib/twilio-ruby/rest/flex_api/v1/insights_settings_answer_sets.rb +1 -1
  50. data/lib/twilio-ruby/rest/flex_api/v1/insights_settings_comment.rb +1 -1
  51. data/lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb +2 -11
  52. data/lib/twilio-ruby/rest/flex_api/v1/interaction.rb +1 -4
  53. data/lib/twilio-ruby/rest/flex_api/v1.rb +30 -39
  54. data/lib/twilio-ruby/rest/insights/v1/call.rb +2 -10
  55. data/lib/twilio-ruby/rest/insights/v1/conference.rb +1 -4
  56. data/lib/twilio-ruby/rest/insights/v1/room.rb +1 -4
  57. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb +3 -15
  58. data/lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb +1 -6
  59. data/lib/twilio-ruby/rest/ip_messaging/v1/service.rb +3 -12
  60. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel.rb +4 -20
  61. data/lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb +2 -10
  62. data/lib/twilio-ruby/rest/ip_messaging/v2/service.rb +4 -16
  63. data/lib/twilio-ruby/rest/messaging/v1/brand_registration.rb +2 -9
  64. data/lib/twilio-ruby/rest/messaging/v1/domain_config.rb +2 -21
  65. data/lib/twilio-ruby/rest/messaging/v1/service.rb +31 -47
  66. data/lib/twilio-ruby/rest/messaging/v1.rb +0 -15
  67. data/lib/twilio-ruby/rest/messaging.rb +1 -1
  68. data/lib/twilio-ruby/rest/microvisor/v1/device.rb +2 -8
  69. data/lib/twilio-ruby/rest/microvisor.rb +2 -1
  70. data/lib/twilio-ruby/rest/notify/v1/service.rb +2 -9
  71. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb +4 -18
  72. data/lib/twilio-ruby/rest/oauth.rb +1 -1
  73. data/lib/twilio-ruby/rest/preview/deployed_devices/fleet.rb +4 -16
  74. data/lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document.rb +1 -5
  75. data/lib/twilio-ruby/rest/preview/marketplace/available_add_on.rb +1 -4
  76. data/lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb +1 -4
  77. data/lib/twilio-ruby/rest/preview/sync/service/document.rb +1 -5
  78. data/lib/twilio-ruby/rest/preview/sync/service/sync_list.rb +2 -10
  79. data/lib/twilio-ruby/rest/preview/sync/service/sync_map.rb +2 -10
  80. data/lib/twilio-ruby/rest/preview/sync/service.rb +3 -12
  81. data/lib/twilio-ruby/rest/preview/understand/assistant/field_type.rb +1 -5
  82. data/lib/twilio-ruby/rest/preview/understand/assistant/task.rb +2 -10
  83. data/lib/twilio-ruby/rest/preview/understand/assistant.rb +5 -20
  84. data/lib/twilio-ruby/rest/proxy/v1/service/session/participant.rb +1 -6
  85. data/lib/twilio-ruby/rest/proxy/v1/service/session.rb +2 -10
  86. data/lib/twilio-ruby/rest/proxy/v1/service.rb +3 -12
  87. data/lib/twilio-ruby/rest/serverless/v1/service/asset.rb +1 -5
  88. data/lib/twilio-ruby/rest/serverless/v1/service/environment.rb +3 -15
  89. data/lib/twilio-ruby/rest/serverless/v1/service/function.rb +1 -5
  90. data/lib/twilio-ruby/rest/serverless/v1/service.rb +4 -16
  91. data/lib/twilio-ruby/rest/studio/v1/flow/engagement.rb +1 -5
  92. data/lib/twilio-ruby/rest/studio/v1/flow/execution.rb +1 -5
  93. data/lib/twilio-ruby/rest/studio/v1/flow.rb +2 -8
  94. data/lib/twilio-ruby/rest/studio/v2/flow/execution.rb +1 -5
  95. data/lib/twilio-ruby/rest/studio/v2/flow.rb +2 -8
  96. data/lib/twilio-ruby/rest/supersim/v1/network_access_profile.rb +1 -4
  97. data/lib/twilio-ruby/rest/supersim/v1/sim.rb +2 -10
  98. data/lib/twilio-ruby/rest/sync/v1/service/document.rb +1 -5
  99. data/lib/twilio-ruby/rest/sync/v1/service/sync_list.rb +2 -10
  100. data/lib/twilio-ruby/rest/sync/v1/service/sync_map.rb +2 -10
  101. data/lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb +1 -6
  102. data/lib/twilio-ruby/rest/sync/v1/service.rb +4 -16
  103. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb +1 -5
  104. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb +2 -10
  105. data/lib/twilio-ruby/rest/taskrouter/v1/workspace.rb +7 -28
  106. data/lib/twilio-ruby/rest/trunking/v1/trunk.rb +4 -16
  107. data/lib/twilio-ruby/rest/trusthub/v1/customer_profiles.rb +3 -12
  108. data/lib/twilio-ruby/rest/trusthub/v1/trust_products.rb +3 -12
  109. data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb +1 -7
  110. data/lib/twilio-ruby/rest/verify/v2/service/entity.rb +3 -16
  111. data/lib/twilio-ruby/rest/verify/v2/service/rate_limit.rb +1 -5
  112. data/lib/twilio-ruby/rest/verify/v2/service.rb +11 -33
  113. data/lib/twilio-ruby/rest/verify/v2/template.rb +5 -5
  114. data/lib/twilio-ruby/rest/video/v1/room/participant.rb +3 -16
  115. data/lib/twilio-ruby/rest/video/v1/room.rb +3 -13
  116. data/lib/twilio-ruby/rest/voice/v1/connection_policy.rb +1 -4
  117. data/lib/twilio-ruby/rest/voice/v1/dialing_permissions/country.rb +1 -5
  118. data/lib/twilio-ruby/rest/wireless/v1/sim.rb +2 -10
  119. data/lib/twilio-ruby/version.rb +1 -1
  120. data/twilio-ruby.gemspec +1 -1
  121. metadata +9 -9
  122. data/lib/twilio-ruby/rest/messaging/v1/tollfree_verification.rb +0 -730
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 231028f0f7e044931062a37dae8fcf18ad1e3f3b
4
- data.tar.gz: 32f55aef766cc5f0471b7e8e992bf4b230e37fee
3
+ metadata.gz: 85039c08af528f9313181700dd95e0899d8c7804
4
+ data.tar.gz: e3a4908a007fb1f83e5251938955b495cb33c2a1
5
5
  SHA512:
6
- metadata.gz: 4dc793687fb876d5a7df9e56ee8392581cf2a99c0e9e7ce0a6856f51449aec5d30b16e8ef92e19487ad240893e0d5fb85903bd8d7de01a235e05275f70c5732c
7
- data.tar.gz: a4d1b73c690993495aaf8bc2eed953930114d1bf07c556a18569f2e6b579d31bd56679db91066476e099255ea4308f04986356484111d0d32da84e80d4aa6f7a
6
+ metadata.gz: bf79a09337c97ca9584703af2520e49964e76fe32c4fdb4e1502b24592577d98e2823581534881ed131d61cd48c820286d10acfe69f671ba29b13fa26eb8c292
7
+ data.tar.gz: 115c92304528bd4f7bf8fc372166e7e85c4de548f900214de6e884cee4d45fd460c0fc1c908aebadf24e8364f169a8432f537dbaacf24f388eab4fc1df3e1714
data/CHANGES.md CHANGED
@@ -1,15 +1,35 @@
1
1
  twilio-ruby changelog
2
- =====================
2
+ =====================
3
3
 
4
- [2023-04-05] Version 6.0.0-rc.2
5
- -------------------------------
6
- **Library - Fix**
7
- - [PR #642](https://github.com/twilio/twilio-ruby/pull/642): remove deprecated Twilio::REST::TwilioError#body. Thanks to [@kridai](https://github.com/kridai)!
8
- - [PR #641](https://github.com/twilio/twilio-ruby/pull/641): remove deprecated TwilioResponse class. 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.
9
7
 
10
- **Library - Chore**
11
- - [PR #643](https://github.com/twilio/twilio-ruby/pull/643): extend ruby & jruby support. 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)**
12
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)!
22
+
23
+ **Messaging**
24
+ - Remove `messaging_service_sids` and `messaging_service_sid_action` from domain config endpoint **(breaking change)**
25
+ - Add error_code and rejection_reason properties to tollfree verification API response
26
+
27
+ **Numbers**
28
+ - Added the new Eligibility API under version `/v1`.
29
+
30
+
31
+ [2023-04-05] Version 5.76.0
32
+ ---------------------------
13
33
  **Conversations**
14
34
  - Expose query parameters `start_date`, `end_date` and `state` in list operation on Conversations resource for sorting and filtering
15
35
 
@@ -26,52 +46,93 @@ twilio-ruby changelog
26
46
  - Add Brand Registrations OTP API
27
47
 
28
48
 
29
- [2023-03-23] Version 6.0.0-rc.1
30
- -------------------------------
31
- **Library - Fix**
32
- - [PR #639](https://github.com/twilio/twilio-ruby/pull/639): add all handcrafted domain files. Thanks to [@charan678](https://github.com/charan678)!
33
-
49
+ [2023-03-22] Version 5.75.0
50
+ ---------------------------
34
51
  **Library - Chore**
35
- - [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)!
36
- - [PR #627](https://github.com/twilio/twilio-ruby/pull/627): bump jwt max version to 2.6. Thanks to [@claudiachua](https://github.com/claudiachua)!
37
-
38
- **Library - Feature**
39
- - [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)!
40
53
 
41
54
  **Api**
42
55
  - Revert Corrected the data type for `friendly_name` in Available Phone Number Local, Mobile and TollFree resources
43
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**
44
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**
45
79
  - Remove `scheduled_for` property from message resource
46
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**
47
93
  - Add `public_application_connect_enabled` param to Application resource
48
- - Add `street_secondary` param to address create and update
49
- - 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)!
50
109
 
51
110
  **Conversations**
52
111
  - Add support for creating Multi-Channel Rich Content Messages
53
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
+
54
126
  **Flex**
55
127
  - Flex Conversations is now Generally Available
56
128
  - Adding the ie1 mapping for authorization api, updating service base uri and base url response attribute **(breaking change)**
57
129
  - Change web channels to GA and library visibility to public
58
130
  - Changing the uri for authorization api from using Accounts to Insights **(breaking change)**
59
131
 
60
- **Lookups**
61
- - Remove `validation_results` from the `default_output_properties`
62
- - Add `disposable_phone_number_risk` package to the lookup response
63
- - Add `sms_pumping_risk` package to the lookup response
64
- - Changed the no data message for match postal code from `no_data` to `data_not_available` in identity match package
65
-
66
132
  **Media**
67
133
  - Gate Twilio Live endpoints behind beta_feature for EOS
68
134
 
69
135
  **Messaging**
70
- - Add `linkshortening_messaging_service` resource
71
- - Add new endpoint for GetDomainConfigByMessagingServiceSid
72
- - Remove `validated` parameter and add `cert_in_validation` parameter to Link Shortening API **(breaking change)**
73
- - Add new tollfree verification API property (ExternalReferenceId)]
74
- - Add update/edit tollfree verification API
75
136
  - Mark `MessageFlow` as a required field for Campaign Creation **(breaking change)**
76
137
 
77
138
  **Oauth**
@@ -79,14 +140,9 @@ twilio-ruby changelog
79
140
  - Added device code authorization endpoint
80
141
 
81
142
  **Supersim**
82
- - Add ESimProfile's `matching_id` and `activation_code` parameters to libraries
83
143
  - Allow filtering the SettingsUpdates resource by `status`
84
144
 
85
- **Verify**
86
- - Add `device_ip` parameter and channel `auto` for sna/sms orchestration
87
-
88
145
  **Twiml**
89
- - Add support for `<Application>` noun and `<ApplicationSid>` noun, nested `<Parameter>` to `<Hangup>` and `<Leave>` verb
90
146
  - Add new Polly Neural voices
91
147
  - Add tr-TR, ar-AE, yue-CN, fi-FI languages to SSML `<lang>` element.
92
148
  - Add x-amazon-jyutping, x-amazon-pinyin, x-amazon-pron-kana, x-amazon-yomigana alphabets to SSML `<phoneme>` element.
@@ -94,10 +150,6 @@ twilio-ruby changelog
94
150
  - Rename `role` attribute to `format` in SSML `<say-as>` element. **(breaking change)**
95
151
 
96
152
 
97
- [2023-03-23] Version 6.0.0-rc.0
98
- ---------------------------
99
- - Release Candidate prep
100
-
101
153
  [2022-11-30] Version 5.73.4
102
154
  ---------------------------
103
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.2'
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.2
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.2
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