twilio-ruby 5.76.0 → 5.77.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.
- checksums.yaml +4 -4
 - data/CHANGES.md +13 -0
 - data/CONTRIBUTING.md +1 -7
 - data/README.md +132 -45
 - data/advanced-examples/custom-http-client.md +170 -0
 - data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +18 -12
 - data/lib/twilio-ruby/rest/conversations/v1/service/conversation.rb +18 -12
 - data/lib/twilio-ruby/rest/messaging/v1/domain_config.rb +4 -29
 - data/lib/twilio-ruby/rest/messaging/v1/tollfree_verification.rb +14 -0
 - data/lib/twilio-ruby/rest/numbers/v1/eligibility.rb +111 -0
 - data/lib/twilio-ruby/rest/numbers/v1.rb +35 -0
 - data/lib/twilio-ruby/rest/numbers.rb +13 -0
 - data/lib/twilio-ruby/rest/verify/v2/service.rb +3 -3
 - data/lib/twilio-ruby/rest/verify/v2/template.rb +3 -3
 - data/lib/twilio-ruby/version.rb +1 -1
 - metadata +5 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 9a318c2179298abd4418a2ce946ffa89d3d14a1a
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 95898f51182dca1ab44a774ae83108cb494f010c
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 22146fa2f467d8f02f2100c1358ced77ec7cbe8b0d9078a9748bd5baae30f25e1f47c0b20f4412cec3d95ac07375adfa2846f66036085c4b0ca6905c853fb80d
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: fc56f4af9f61277c749d4f6df039493ed6dfdd821f3b3eed01e63201b00501243c22556388128d386924e3ab7c9131f81476cbcba4ac1af773374ced104d37e4
         
     | 
    
        data/CHANGES.md
    CHANGED
    
    | 
         @@ -1,6 +1,19 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            twilio-ruby changelog
         
     | 
| 
       2 
2 
     | 
    
         
             
            =====================
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
      
 4 
     | 
    
         
            +
            [2023-04-19] Version 5.77.0
         
     | 
| 
      
 5 
     | 
    
         
            +
            ---------------------------
         
     | 
| 
      
 6 
     | 
    
         
            +
            **Library - Docs**
         
     | 
| 
      
 7 
     | 
    
         
            +
            - [PR #645](https://github.com/twilio/twilio-ruby/pull/645): consolidate. Thanks to [@stern-shawn](https://github.com/stern-shawn)!
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            **Messaging**
         
     | 
| 
      
 10 
     | 
    
         
            +
            - Remove `messaging_service_sids` and `messaging_service_sid_action` from domain config endpoint **(breaking change)**
         
     | 
| 
      
 11 
     | 
    
         
            +
            - Add error_code and rejection_reason properties to tollfree verification API response
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            **Numbers**
         
     | 
| 
      
 14 
     | 
    
         
            +
            - Added the new Eligibility API under version `/v1`.
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
       4 
17 
     | 
    
         
             
            [2023-04-05] Version 5.76.0
         
     | 
| 
       5 
18 
     | 
    
         
             
            ---------------------------
         
     | 
| 
       6 
19 
     | 
    
         
             
            **Conversations**
         
     | 
    
        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] 
     | 
| 
      
 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?
         
     | 
| 
         @@ -68,10 +68,6 @@ you're working on. 
     | 
|
| 
       68 
68 
     | 
    
         
             
            For large fixes, please build and test the documentation before submitting the
         
     | 
| 
       69 
69 
     | 
    
         
             
            PR to be sure you haven't accidentally introduced layout or formatting issues.
         
     | 
| 
       70 
70 
     | 
    
         | 
| 
       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 
71 
     | 
    
         
             
            ## <a name="submit"></a> Submission Guidelines
         
     | 
| 
       76 
72 
     | 
    
         | 
| 
       77 
73 
     | 
    
         
             
            ### Submitting an Issue
         
     | 
| 
         @@ -155,7 +151,5 @@ you are working: 
     | 
|
| 
       155 
151 
     | 
    
         
             
            * All features or bug fixes **must be tested** by one or more tests.
         
     | 
| 
       156 
152 
     | 
    
         
             
            * All classes and methods **must be documented**.
         
     | 
| 
       157 
153 
     | 
    
         | 
| 
       158 
     | 
    
         
            -
             
     | 
| 
       159 
     | 
    
         
            -
            [docs-link]: https://www.twilio.com/docs/libraries/ruby
         
     | 
| 
       160 
154 
     | 
    
         
             
            [issue-link]: https://github.com/twilio/twilio-ruby/issues/new
         
     | 
| 
       161 
155 
     | 
    
         
             
            [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  
     | 
| 
      
 11 
     | 
    
         
            +
            The individual releases [here][refdocs].
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
            ## Versions
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
         @@ -18,12 +18,12 @@ The Ruby library documentation can be found [here][libdocs] and individual relea 
     | 
|
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
            This library supports the following Ruby implementations:
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
      
 21 
     | 
    
         
            +
            - Ruby 2.4
         
     | 
| 
      
 22 
     | 
    
         
            +
            - Ruby 2.5
         
     | 
| 
      
 23 
     | 
    
         
            +
            - Ruby 2.6
         
     | 
| 
      
 24 
     | 
    
         
            +
            - Ruby 2.7
         
     | 
| 
      
 25 
     | 
    
         
            +
            - Ruby 3.0
         
     | 
| 
      
 26 
     | 
    
         
            +
            - Ruby 3.1
         
     | 
| 
       27 
27 
     | 
    
         | 
| 
       28 
28 
     | 
    
         
             
            ### Migrating from 4.x
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
         @@ -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. 
     | 
| 
      
 37 
     | 
    
         
            +
            gem 'twilio-ruby', '~> 5.77.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. 
     | 
| 
      
 43 
     | 
    
         
            +
            gem install twilio-ruby -v 5.77.0
         
     | 
| 
       44 
44 
     | 
    
         
             
            ```
         
     | 
| 
       45 
45 
     | 
    
         | 
| 
       46 
46 
     | 
    
         
             
            To build and install the development branch yourself from the latest source:
         
     | 
| 
         @@ -51,18 +51,47 @@ cd twilio-ruby 
     | 
|
| 
       51 
51 
     | 
    
         
             
            make install
         
     | 
| 
       52 
52 
     | 
    
         
             
            ```
         
     | 
| 
       53 
53 
     | 
    
         | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
      
 54 
     | 
    
         
            +
            > **Info**
         
     | 
| 
      
 55 
     | 
    
         
            +
            > If the command line gives you an error message that says Permission Denied, try running the above commands with sudo.
         
     | 
| 
      
 56 
     | 
    
         
            +
            >
         
     | 
| 
      
 57 
     | 
    
         
            +
            > For example: `sudo gem install twilio-ruby`
         
     | 
| 
       55 
58 
     | 
    
         | 
| 
       56 
     | 
    
         
            -
            ###  
     | 
| 
      
 59 
     | 
    
         
            +
            ### Test your installation
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
            To make sure the installation was successful, try sending yourself an SMS message, like this:
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
            ```rb
         
     | 
| 
      
 64 
     | 
    
         
            +
            require "twilio-ruby"
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
            # Your Account SID and Auth Token from console.twilio.com
         
     | 
| 
      
 67 
     | 
    
         
            +
            account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
         
     | 
| 
      
 68 
     | 
    
         
            +
            auth_token = "your_auth_token"
         
     | 
| 
      
 69 
     | 
    
         
            +
             
     | 
| 
      
 70 
     | 
    
         
            +
            @client = Twilio::REST::Client.new account_sid, auth_token
         
     | 
| 
      
 71 
     | 
    
         
            +
            message = @client.messages.create(
         
     | 
| 
      
 72 
     | 
    
         
            +
              body: "Hello from Ruby",
         
     | 
| 
      
 73 
     | 
    
         
            +
              to: "+12345678901",  # Text this number
         
     | 
| 
      
 74 
     | 
    
         
            +
              from: "+15005550006", # From a valid Twilio number
         
     | 
| 
      
 75 
     | 
    
         
            +
            )
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
            puts message.sid
         
     | 
| 
      
 78 
     | 
    
         
            +
            ```
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
            > **Warning**
         
     | 
| 
      
 81 
     | 
    
         
            +
            > 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.
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
            ## Usage
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
            ### Authenticate the Client
         
     | 
| 
       57 
86 
     | 
    
         | 
| 
       58 
87 
     | 
    
         
             
            ```ruby
         
     | 
| 
       59 
88 
     | 
    
         
             
            require 'twilio-ruby'
         
     | 
| 
       60 
89 
     | 
    
         | 
| 
       61 
     | 
    
         
            -
            #  
     | 
| 
      
 90 
     | 
    
         
            +
            # Your Account SID and Auth Token from console.twilio.com
         
     | 
| 
       62 
91 
     | 
    
         
             
            account_sid = 'ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
         
     | 
| 
       63 
92 
     | 
    
         
             
            auth_token = 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'
         
     | 
| 
       64 
93 
     | 
    
         | 
| 
       65 
     | 
    
         
            -
            #  
     | 
| 
      
 94 
     | 
    
         
            +
            # Initialize the Twilio Client with your credentials
         
     | 
| 
       66 
95 
     | 
    
         
             
            @client = Twilio::REST::Client.new account_sid, auth_token
         
     | 
| 
       67 
96 
     | 
    
         
             
            ```
         
     | 
| 
       68 
97 
     | 
    
         | 
| 
         @@ -71,8 +100,9 @@ auth_token = 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy' 
     | 
|
| 
       71 
100 
     | 
    
         
             
            ```ruby
         
     | 
| 
       72 
101 
     | 
    
         
             
            require 'twilio-ruby'
         
     | 
| 
       73 
102 
     | 
    
         | 
| 
       74 
     | 
    
         
            -
            #  
     | 
| 
      
 103 
     | 
    
         
            +
            # Your Account SID from console.twilio.com
         
     | 
| 
       75 
104 
     | 
    
         
             
            account_sid = 'ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
         
     | 
| 
      
 105 
     | 
    
         
            +
            # API Key from twilio.com/console/project/api-keys
         
     | 
| 
       76 
106 
     | 
    
         
             
            api_key_sid = 'zzzzzzzzzzzzzzzzzzzzzz'
         
     | 
| 
       77 
107 
     | 
    
         
             
            api_key_secret = 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'
         
     | 
| 
       78 
108 
     | 
    
         | 
| 
         @@ -97,22 +127,6 @@ To take advantage of Twilio's [Global Infrastructure](https://www.twilio.com/doc 
     | 
|
| 
       97 
127 
     | 
    
         | 
| 
       98 
128 
     | 
    
         
             
            This will result in the `hostname` transforming from `api.twilio.com` to `api.sydney.au1.twilio.com`.
         
     | 
| 
       99 
129 
     | 
    
         | 
| 
       100 
     | 
    
         
            -
            ### Enable Debug logging
         
     | 
| 
       101 
     | 
    
         
            -
             
     | 
| 
       102 
     | 
    
         
            -
            In order to enable debug logging, pass in a 'logger' instance to the client with the level set to at least 'DEBUG'
         
     | 
| 
       103 
     | 
    
         
            -
             
     | 
| 
       104 
     | 
    
         
            -
            ```ruby
         
     | 
| 
       105 
     | 
    
         
            -
            @client = Twilio::REST::Client.new account_sid, auth_token
         
     | 
| 
       106 
     | 
    
         
            -
            myLogger = Logger.new(STDOUT)
         
     | 
| 
       107 
     | 
    
         
            -
            myLogger.level = Logger::DEBUG
         
     | 
| 
       108 
     | 
    
         
            -
            @client.logger = myLogger
         
     | 
| 
       109 
     | 
    
         
            -
             
     | 
| 
       110 
     | 
    
         
            -
            @client = Twilio::REST::Client.new account_sid, auth_token
         
     | 
| 
       111 
     | 
    
         
            -
            myLogger = Logger.new('my_log.log')
         
     | 
| 
       112 
     | 
    
         
            -
            myLogger.level = Logger::DEBUG
         
     | 
| 
       113 
     | 
    
         
            -
            @client.logger = myLogger
         
     | 
| 
       114 
     | 
    
         
            -
            ```
         
     | 
| 
       115 
     | 
    
         
            -
             
     | 
| 
       116 
130 
     | 
    
         
             
            ### Make a Call
         
     | 
| 
       117 
131 
     | 
    
         | 
| 
       118 
132 
     | 
    
         
             
            ```ruby
         
     | 
| 
         @@ -147,27 +161,59 @@ message_sid = 'SMxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' 
     | 
|
| 
       147 
161 
     | 
    
         
             
            @client.messages(message_sid).fetch
         
     | 
| 
       148 
162 
     | 
    
         
             
            ```
         
     | 
| 
       149 
163 
     | 
    
         | 
| 
       150 
     | 
    
         
            -
            ###  
     | 
| 
      
 164 
     | 
    
         
            +
            ### Iterate through records
         
     | 
| 
       151 
165 
     | 
    
         | 
| 
       152 
     | 
    
         
            -
            ` 
     | 
| 
      
 166 
     | 
    
         
            +
            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.
         
     | 
| 
       153 
167 
     | 
    
         | 
| 
       154 
     | 
    
         
            -
             
     | 
| 
       155 
     | 
    
         
            -
             
     | 
| 
      
 168 
     | 
    
         
            +
            `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.
         
     | 
| 
      
 169 
     | 
    
         
            +
             
     | 
| 
      
 170 
     | 
    
         
            +
            For more information about these methods, view the [auto-generated library docs](https://www.twilio.com/docs/libraries/reference/twilio-ruby).
         
     | 
| 
      
 171 
     | 
    
         
            +
             
     | 
| 
      
 172 
     | 
    
         
            +
            ```rb
         
     | 
| 
      
 173 
     | 
    
         
            +
            require 'twilio-ruby'
         
     | 
| 
      
 174 
     | 
    
         
            +
             
     | 
| 
      
 175 
     | 
    
         
            +
            account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
         
     | 
| 
      
 176 
     | 
    
         
            +
            auth_token = 'your_auth_token'
         
     | 
| 
      
 177 
     | 
    
         
            +
             
     | 
| 
      
 178 
     | 
    
         
            +
            @client = Twilio::REST::Client.new(account_sid, auth_token)
         
     | 
| 
      
 179 
     | 
    
         
            +
             
     | 
| 
      
 180 
     | 
    
         
            +
            @client.calls.list
         
     | 
| 
      
 181 
     | 
    
         
            +
                   .each do |call|
         
     | 
| 
      
 182 
     | 
    
         
            +
                     puts call.direction
         
     | 
| 
      
 183 
     | 
    
         
            +
                   end
         
     | 
| 
       156 
184 
     | 
    
         
             
            ```
         
     | 
| 
       157 
185 
     | 
    
         | 
| 
       158 
     | 
    
         
            -
             
     | 
| 
      
 186 
     | 
    
         
            +
            ### Enable Debug logging
         
     | 
| 
       159 
187 
     | 
    
         | 
| 
       160 
     | 
    
         
            -
             
     | 
| 
      
 188 
     | 
    
         
            +
            In order to enable debug logging, pass in a 'logger' instance to the client with the level set to at least 'DEBUG'
         
     | 
| 
       161 
189 
     | 
    
         | 
| 
       162 
190 
     | 
    
         
             
            ```ruby
         
     | 
| 
       163 
     | 
    
         
            -
            @client. 
     | 
| 
       164 
     | 
    
         
            -
             
     | 
| 
       165 
     | 
    
         
            -
             
     | 
| 
      
 191 
     | 
    
         
            +
            @client = Twilio::REST::Client.new account_sid, auth_token
         
     | 
| 
      
 192 
     | 
    
         
            +
            myLogger = Logger.new(STDOUT)
         
     | 
| 
      
 193 
     | 
    
         
            +
            myLogger.level = Logger::DEBUG
         
     | 
| 
      
 194 
     | 
    
         
            +
            @client.logger = myLogger
         
     | 
| 
      
 195 
     | 
    
         
            +
             
     | 
| 
      
 196 
     | 
    
         
            +
            @client = Twilio::REST::Client.new account_sid, auth_token
         
     | 
| 
      
 197 
     | 
    
         
            +
            myLogger = Logger.new('my_log.log')
         
     | 
| 
      
 198 
     | 
    
         
            +
            myLogger.level = Logger::DEBUG
         
     | 
| 
      
 199 
     | 
    
         
            +
            @client.logger = myLogger
         
     | 
| 
       166 
200 
     | 
    
         
             
            ```
         
     | 
| 
       167 
201 
     | 
    
         | 
| 
       168 
     | 
    
         
            -
            ###  
     | 
| 
      
 202 
     | 
    
         
            +
            ### Handle Exceptions {#exceptions}
         
     | 
| 
      
 203 
     | 
    
         
            +
             
     | 
| 
      
 204 
     | 
    
         
            +
            If the Twilio API returns a 400 or a 500 level HTTP response, the `twilio-ruby`
         
     | 
| 
      
 205 
     | 
    
         
            +
            library will throw a `Twilio::REST::RestError`. 400-level errors are normal
         
     | 
| 
      
 206 
     | 
    
         
            +
            during API operation (`“Invalid number”`, `“Cannot deliver SMS to that number”`,
         
     | 
| 
      
 207 
     | 
    
         
            +
            for example) and should be handled appropriately.
         
     | 
| 
      
 208 
     | 
    
         
            +
             
     | 
| 
      
 209 
     | 
    
         
            +
            ```rb
         
     | 
| 
      
 210 
     | 
    
         
            +
            require 'twilio-ruby'
         
     | 
| 
      
 211 
     | 
    
         
            +
             
     | 
| 
      
 212 
     | 
    
         
            +
            account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
         
     | 
| 
      
 213 
     | 
    
         
            +
            auth_token = 'your_auth_token'
         
     | 
| 
      
 214 
     | 
    
         
            +
             
     | 
| 
      
 215 
     | 
    
         
            +
            @client = Twilio::REST::Client.new account_sid, auth_token
         
     | 
| 
       169 
216 
     | 
    
         | 
| 
       170 
     | 
    
         
            -
            ```ruby
         
     | 
| 
       171 
217 
     | 
    
         
             
            begin
         
     | 
| 
       172 
218 
     | 
    
         
             
              messages = @client.messages.list(limit: 20)
         
     | 
| 
       173 
219 
     | 
    
         
             
            rescue Twilio::REST::RestError => e
         
     | 
| 
         @@ -175,9 +221,51 @@ rescue Twilio::REST::RestError => e 
     | 
|
| 
       175 
221 
     | 
    
         
             
            end
         
     | 
| 
       176 
222 
     | 
    
         
             
            ```
         
     | 
| 
       177 
223 
     | 
    
         | 
| 
       178 
     | 
    
         
            -
             
     | 
| 
      
 224 
     | 
    
         
            +
            ### Debug API requests
         
     | 
| 
      
 225 
     | 
    
         
            +
             
     | 
| 
      
 226 
     | 
    
         
            +
            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.
         
     | 
| 
      
 227 
     | 
    
         
            +
             
     | 
| 
      
 228 
     | 
    
         
            +
            For example, you can retrieve the status code of the last response like so:
         
     | 
| 
      
 229 
     | 
    
         
            +
             
     | 
| 
      
 230 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 231 
     | 
    
         
            +
            require 'rubygems' # Not necessary with ruby 1.9 but included for completeness
         
     | 
| 
      
 232 
     | 
    
         
            +
            require 'twilio-ruby'
         
     | 
| 
      
 233 
     | 
    
         
            +
             
     | 
| 
      
 234 
     | 
    
         
            +
            # Your Account SID and Auth Token from console.twilio.com
         
     | 
| 
      
 235 
     | 
    
         
            +
            account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
         
     | 
| 
      
 236 
     | 
    
         
            +
            auth_token = 'your_auth_token'
         
     | 
| 
      
 237 
     | 
    
         
            +
             
     | 
| 
      
 238 
     | 
    
         
            +
            @client = Twilio::REST::Client.new(account_sid, auth_token)
         
     | 
| 
      
 239 
     | 
    
         
            +
             
     | 
| 
      
 240 
     | 
    
         
            +
            @message = @client.messages.create(
         
     | 
| 
      
 241 
     | 
    
         
            +
              to: '+14158675309',
         
     | 
| 
      
 242 
     | 
    
         
            +
              from: '+14258675310',
         
     | 
| 
      
 243 
     | 
    
         
            +
              body: 'Ahoy!'
         
     | 
| 
      
 244 
     | 
    
         
            +
            )
         
     | 
| 
      
 245 
     | 
    
         
            +
             
     | 
| 
      
 246 
     | 
    
         
            +
            # Retrieve the status code of the last response from the HTTP client
         
     | 
| 
      
 247 
     | 
    
         
            +
            puts @client.http_client.last_response.status_code
         
     | 
| 
      
 248 
     | 
    
         
            +
            ```
         
     | 
| 
      
 249 
     | 
    
         
            +
             
     | 
| 
      
 250 
     | 
    
         
            +
            ### Customize your HTTP Client
         
     | 
| 
      
 251 
     | 
    
         
            +
             
     | 
| 
      
 252 
     | 
    
         
            +
            `twilio-ruby` uses [Faraday][faraday] to make HTTP requests. You can tell `Twilio::REST::Client` to use any of the Faraday adapters like so:
         
     | 
| 
      
 253 
     | 
    
         
            +
             
     | 
| 
      
 254 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 255 
     | 
    
         
            +
            @client.http_client.adapter = :typhoeus
         
     | 
| 
      
 256 
     | 
    
         
            +
            ```
         
     | 
| 
      
 257 
     | 
    
         
            +
             
     | 
| 
      
 258 
     | 
    
         
            +
            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).
         
     | 
| 
      
 259 
     | 
    
         
            +
             
     | 
| 
      
 260 
     | 
    
         
            +
            To apply customizations such as middleware, you can use the `configure_connection` method like so:
         
     | 
| 
      
 261 
     | 
    
         
            +
             
     | 
| 
      
 262 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 263 
     | 
    
         
            +
            @client.http_client.configure_connection do |faraday|
         
     | 
| 
      
 264 
     | 
    
         
            +
              faraday.use SomeMiddleware
         
     | 
| 
      
 265 
     | 
    
         
            +
            end
         
     | 
| 
      
 266 
     | 
    
         
            +
            ```
         
     | 
| 
       179 
267 
     | 
    
         | 
| 
       180 
     | 
    
         
            -
            ###  
     | 
| 
      
 268 
     | 
    
         
            +
            ### Get started With Client Capability Tokens
         
     | 
| 
       181 
269 
     | 
    
         | 
| 
       182 
270 
     | 
    
         
             
            If you just need to generate a Capability Token for use with Twilio Client, you can do this:
         
     | 
| 
       183 
271 
     | 
    
         | 
| 
         @@ -205,7 +293,7 @@ capability.add_scope(incoming_scope) 
     | 
|
| 
       205 
293 
     | 
    
         | 
| 
       206 
294 
     | 
    
         
             
            There is a slightly more detailed document in the [Capability][capability] section of the wiki.
         
     | 
| 
       207 
295 
     | 
    
         | 
| 
       208 
     | 
    
         
            -
            ###  
     | 
| 
      
 296 
     | 
    
         
            +
            ### Generate TwiML
         
     | 
| 
       209 
297 
     | 
    
         | 
| 
       210 
298 
     | 
    
         
             
            To control phone calls, your application needs to output [TwiML][twiml].
         
     | 
| 
       211 
299 
     | 
    
         | 
| 
         @@ -249,7 +337,6 @@ If you've instead found a bug in the library or would like new features added, g 
     | 
|
| 
       249 
337 
     | 
    
         | 
| 
       250 
338 
     | 
    
         
             
            [apidocs]: https://www.twilio.com/docs/api
         
     | 
| 
       251 
339 
     | 
    
         
             
            [twiml]: https://www.twilio.com/docs/api/twiml
         
     | 
| 
       252 
     | 
    
         
            -
            [libdocs]: https://www.twilio.com/docs/libraries/ruby
         
     | 
| 
       253 
340 
     | 
    
         
             
            [refdocs]: https://twilio.github.io/twilio-ruby
         
     | 
| 
       254 
341 
     | 
    
         
             
            [capability]: https://github.com/twilio/twilio-ruby/wiki/JWT-Tokens
         
     | 
| 
       255 
342 
     | 
    
         
             
            [wiki]: https://github.com/twilio/twilio-ruby/wiki
         
     | 
| 
         @@ -0,0 +1,170 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Custom HTTP Clients for the Twilio Ruby Helper Library
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            If you are working with the Twilio Ruby Helper Library, and you need to be able to modify the HTTP requests that the library makes to the Twilio servers, you’re in the right place. The most common need to alter the HTTP request is to connect and authenticate with an enterprise’s proxy server. We’ll provide sample code that you can drop right into your app to handle this use case.
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Connect and authenticate with a proxy server
         
     | 
| 
      
 6 
     | 
    
         
            +
            To connect and provide credentials to a proxy server that may be between your app and Twilio, you need a way to modify the HTTP requests that the Twilio helper library makes on your behalf to invoke the Twilio REST API.
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            The Twilio Ruby helper library uses the [Faraday](https://rubygems.org/gems/faraday) gem under the hood to make the HTTP requests. The following example shows a typical request, without a custom `http_client`:
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            ```rb
         
     | 
| 
      
 11 
     | 
    
         
            +
            @client = Twilio::REST::Client.new(account_sid, auth_token)
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            message = @client.messages
         
     | 
| 
      
 14 
     | 
    
         
            +
              .create(
         
     | 
| 
      
 15 
     | 
    
         
            +
                to: "+15558675310",
         
     | 
| 
      
 16 
     | 
    
         
            +
                body: "Hey there!",
         
     | 
| 
      
 17 
     | 
    
         
            +
                from: "+15017122661",
         
     | 
| 
      
 18 
     | 
    
         
            +
              )
         
     | 
| 
      
 19 
     | 
    
         
            +
            ```
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            Out of the box, the helper library is creating a default `Twilio::Http::Client` for you, using the Twilio credentials you provide. However, you can create your own `Twilio::Http::Client`, and pass it to any Twilio REST API resource action you want.
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            Here’s an example of sending an SMS message with a custom client:
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            ```rb
         
     | 
| 
      
 26 
     | 
    
         
            +
            # Download the helper library from https://www.twilio.com/docs/ruby/install
         
     | 
| 
      
 27 
     | 
    
         
            +
            require "rubygems"
         
     | 
| 
      
 28 
     | 
    
         
            +
            require "twilio-ruby"
         
     | 
| 
      
 29 
     | 
    
         
            +
            require "dotenv/load"
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            # Custom HTTP Client
         
     | 
| 
      
 32 
     | 
    
         
            +
            require_relative "MyRequestClass"
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
            # Your Account Sid and Auth Token from twilio.com/console
         
     | 
| 
      
 35 
     | 
    
         
            +
            account_sid = ENV["ACCOUNT_SID"]
         
     | 
| 
      
 36 
     | 
    
         
            +
            auth_token = ENV["AUTH_TOKEN"]
         
     | 
| 
      
 37 
     | 
    
         
            +
            proxy_address = ENV["PROXY_ADDRESS"]
         
     | 
| 
      
 38 
     | 
    
         
            +
            proxy_protocol = ENV["PROXY_PROTOCOL"]
         
     | 
| 
      
 39 
     | 
    
         
            +
            proxy_port = ENV["PROXY_PORT"]
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            my_request_client = MyRequestClass.new(proxy_protocol, proxy_address, proxy_port)
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
            @client = Twilio::REST::Client.new(account_sid, auth_token,
         
     | 
| 
      
 44 
     | 
    
         
            +
                                               nil, nil, my_request_client)
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
            message = @client.messages
         
     | 
| 
      
 47 
     | 
    
         
            +
              .create(
         
     | 
| 
      
 48 
     | 
    
         
            +
                to: "+593978613041",
         
     | 
| 
      
 49 
     | 
    
         
            +
                body: "RB This is the ship that made the Kesssssel Run in fourteen parsecs?",
         
     | 
| 
      
 50 
     | 
    
         
            +
                from: "+13212855389",
         
     | 
| 
      
 51 
     | 
    
         
            +
              )
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
            puts "Message SID: #{message.sid}"
         
     | 
| 
      
 54 
     | 
    
         
            +
            ```
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
            ## Create your custom TwilioRestClient
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
            When you take a closer look at the constructor for `Twilio::Http::Client`, you see that this class provides it to the Twilio helper library to make the necessary HTTP requests.
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
            ## Call Twilio through the proxy server
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
            Now that we understand how all the components fit together, we can create our own `http_client` that can connect through a proxy server. To make this reusable, here’s a class that you can use to create this `http_client` whenever you need one.
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
            ```rb
         
     | 
| 
      
 65 
     | 
    
         
            +
            class MyRequestClass
         
     | 
| 
      
 66 
     | 
    
         
            +
              attr_accessor :adapter
         
     | 
| 
      
 67 
     | 
    
         
            +
              attr_reader :timeout, :last_response, :last_request
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
      
 69 
     | 
    
         
            +
              def initialize(proxy_prot = nil, proxy_addr = nil, proxy_port = nil, timeout: nil)
         
     | 
| 
      
 70 
     | 
    
         
            +
                @proxy_prot = proxy_prot
         
     | 
| 
      
 71 
     | 
    
         
            +
                @proxy_addr = proxy_addr
         
     | 
| 
      
 72 
     | 
    
         
            +
                @proxy_port = proxy_port
         
     | 
| 
      
 73 
     | 
    
         
            +
                @timeout = timeout
         
     | 
| 
      
 74 
     | 
    
         
            +
                @adapter = Faraday.default_adapter
         
     | 
| 
      
 75 
     | 
    
         
            +
              end
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
              def _request(request)
         
     | 
| 
      
 78 
     | 
    
         
            +
                @connection = Faraday.new(url: request.host + ":" + request.port.to_s, ssl: { verify: true }) do |f|
         
     | 
| 
      
 79 
     | 
    
         
            +
                  f.options.params_encoder = Faraday::FlatParamsEncoder
         
     | 
| 
      
 80 
     | 
    
         
            +
                  f.request :url_encoded
         
     | 
| 
      
 81 
     | 
    
         
            +
                  f.adapter @adapter
         
     | 
| 
      
 82 
     | 
    
         
            +
                  f.headers = request.headers
         
     | 
| 
      
 83 
     | 
    
         
            +
                  f.basic_auth(request.auth[0], request.auth[1])
         
     | 
| 
      
 84 
     | 
    
         
            +
                  if @proxy_addr
         
     | 
| 
      
 85 
     | 
    
         
            +
                    f.proxy = "#{@proxy_prot}://#{@proxy_addr}:#{@proxy_port}"
         
     | 
| 
      
 86 
     | 
    
         
            +
                  end
         
     | 
| 
      
 87 
     | 
    
         
            +
                  f.options.open_timeout = request.timeout || @timeout
         
     | 
| 
      
 88 
     | 
    
         
            +
                  f.options.timeout = request.timeout || @timeout
         
     | 
| 
      
 89 
     | 
    
         
            +
                end
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
                @last_request = request
         
     | 
| 
      
 92 
     | 
    
         
            +
                @last_response = nil
         
     | 
| 
      
 93 
     | 
    
         
            +
                response = @connection.send(request.method.downcase.to_sym,
         
     | 
| 
      
 94 
     | 
    
         
            +
                                            request.url,
         
     | 
| 
      
 95 
     | 
    
         
            +
                                            request.method == "GET" ? request.params : request.data)
         
     | 
| 
      
 96 
     | 
    
         
            +
             
     | 
| 
      
 97 
     | 
    
         
            +
                if response.body && !response.body.empty?
         
     | 
| 
      
 98 
     | 
    
         
            +
                  object = response.body
         
     | 
| 
      
 99 
     | 
    
         
            +
                elsif response.status == 400
         
     | 
| 
      
 100 
     | 
    
         
            +
                  object = { message: "Bad request", code: 400 }.to_json
         
     | 
| 
      
 101 
     | 
    
         
            +
                end
         
     | 
| 
      
 102 
     | 
    
         
            +
             
     | 
| 
      
 103 
     | 
    
         
            +
                twilio_response = Twilio::Response.new(response.status, object, headers: response.headers)
         
     | 
| 
      
 104 
     | 
    
         
            +
                @last_response = twilio_response
         
     | 
| 
      
 105 
     | 
    
         
            +
             
     | 
| 
      
 106 
     | 
    
         
            +
                twilio_response
         
     | 
| 
      
 107 
     | 
    
         
            +
              end
         
     | 
| 
      
 108 
     | 
    
         
            +
             
     | 
| 
      
 109 
     | 
    
         
            +
              def request(host, port, method, url, params = {}, data = {}, headers = {}, auth = nil, timeout = nil)
         
     | 
| 
      
 110 
     | 
    
         
            +
                request = Twilio::Request.new(host, port, method, url, params, data, headers, auth, timeout)
         
     | 
| 
      
 111 
     | 
    
         
            +
                _request(request)
         
     | 
| 
      
 112 
     | 
    
         
            +
              end
         
     | 
| 
      
 113 
     | 
    
         
            +
            end
         
     | 
| 
      
 114 
     | 
    
         
            +
            ```
         
     | 
| 
      
 115 
     | 
    
         
            +
             
     | 
| 
      
 116 
     | 
    
         
            +
            In this example, we are using some environment variables loaded at the program startup to retrieve various configuration settings:
         
     | 
| 
      
 117 
     | 
    
         
            +
             
     | 
| 
      
 118 
     | 
    
         
            +
            - Your Twilio Account Sid and Auth Token ([found here, in the Twilio console](https://console.twilio.com))
         
     | 
| 
      
 119 
     | 
    
         
            +
            - A proxy address in the form of `http://127.0.0.1:8888`
         
     | 
| 
      
 120 
     | 
    
         
            +
             
     | 
| 
      
 121 
     | 
    
         
            +
            These settings are located in a file like `.env` like so:
         
     | 
| 
      
 122 
     | 
    
         
            +
             
     | 
| 
      
 123 
     | 
    
         
            +
            ```env
         
     | 
| 
      
 124 
     | 
    
         
            +
            ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
         
     | 
| 
      
 125 
     | 
    
         
            +
            AUTH_TOKEN= your_auth_token
         
     | 
| 
      
 126 
     | 
    
         
            +
             
     | 
| 
      
 127 
     | 
    
         
            +
            HTTPS_PROXY=https://127.0.0.1:8888
         
     | 
| 
      
 128 
     | 
    
         
            +
            HTTP_PROXY=http://127.0.0.1:8888
         
     | 
| 
      
 129 
     | 
    
         
            +
            ```
         
     | 
| 
      
 130 
     | 
    
         
            +
             
     | 
| 
      
 131 
     | 
    
         
            +
            Here’s the full console program that sends a text message and shows how it all can work together. It loads the `.env` file.
         
     | 
| 
      
 132 
     | 
    
         
            +
             
     | 
| 
      
 133 
     | 
    
         
            +
            ```rb
         
     | 
| 
      
 134 
     | 
    
         
            +
            # Download the helper library from https://www.twilio.com/docs/ruby/install
         
     | 
| 
      
 135 
     | 
    
         
            +
            require "rubygems"
         
     | 
| 
      
 136 
     | 
    
         
            +
            require "twilio-ruby"
         
     | 
| 
      
 137 
     | 
    
         
            +
            require "dotenv/load"
         
     | 
| 
      
 138 
     | 
    
         
            +
             
     | 
| 
      
 139 
     | 
    
         
            +
            # Custom HTTP Client
         
     | 
| 
      
 140 
     | 
    
         
            +
            require_relative "MyRequestClass"
         
     | 
| 
      
 141 
     | 
    
         
            +
             
     | 
| 
      
 142 
     | 
    
         
            +
            # Your Account Sid and Auth Token from twilio.com/console
         
     | 
| 
      
 143 
     | 
    
         
            +
            account_sid = ENV["ACCOUNT_SID"]
         
     | 
| 
      
 144 
     | 
    
         
            +
            auth_token = ENV["AUTH_TOKEN"]
         
     | 
| 
      
 145 
     | 
    
         
            +
            proxy_address = ENV["PROXY_ADDRESS"]
         
     | 
| 
      
 146 
     | 
    
         
            +
            proxy_protocol = ENV["PROXY_PROTOCOL"]
         
     | 
| 
      
 147 
     | 
    
         
            +
            proxy_port = ENV["PROXY_PORT"]
         
     | 
| 
      
 148 
     | 
    
         
            +
             
     | 
| 
      
 149 
     | 
    
         
            +
            my_request_client = MyRequestClass.new(proxy_protocol, proxy_address, proxy_port)
         
     | 
| 
      
 150 
     | 
    
         
            +
             
     | 
| 
      
 151 
     | 
    
         
            +
            @client = Twilio::REST::Client.new(account_sid, auth_token,
         
     | 
| 
      
 152 
     | 
    
         
            +
                                               nil, nil, my_request_client)
         
     | 
| 
      
 153 
     | 
    
         
            +
             
     | 
| 
      
 154 
     | 
    
         
            +
            message = @client.messages
         
     | 
| 
      
 155 
     | 
    
         
            +
              .create(
         
     | 
| 
      
 156 
     | 
    
         
            +
                to: "+593978613041",
         
     | 
| 
      
 157 
     | 
    
         
            +
                body: "RB This is the ship that made the Kesssssel Run in fourteen parsecs?",
         
     | 
| 
      
 158 
     | 
    
         
            +
                from: "+13212855389",
         
     | 
| 
      
 159 
     | 
    
         
            +
              )
         
     | 
| 
      
 160 
     | 
    
         
            +
             
     | 
| 
      
 161 
     | 
    
         
            +
            puts "Message SID: #{message.sid}"
         
     | 
| 
      
 162 
     | 
    
         
            +
            ```
         
     | 
| 
      
 163 
     | 
    
         
            +
             
     | 
| 
      
 164 
     | 
    
         
            +
            ## What else can this technique be used for?
         
     | 
| 
      
 165 
     | 
    
         
            +
             
     | 
| 
      
 166 
     | 
    
         
            +
            Now that you know how to inject your own `http_client` into the Twilio API request pipeline, you could use this technique to add custom HTTP headers and authorization to the requests (perhaps as required by an upstream proxy server).
         
     | 
| 
      
 167 
     | 
    
         
            +
             
     | 
| 
      
 168 
     | 
    
         
            +
            You could also implement your own `http_client` to mock the Twilio API responses so your unit and integration tests can run quickly without the need to make a connection to Twilio. In fact, there’s already an example online showing [how to do exactly that with Node.js and Prism](https://www.twilio.com/docs/openapi/mock-api-generation-with-twilio-openapi-spec).
         
     | 
| 
      
 169 
     | 
    
         
            +
             
     | 
| 
      
 170 
     | 
    
         
            +
            We can’t wait to see what you build!
         
     | 
| 
         @@ -71,10 +71,12 @@ module Twilio 
     | 
|
| 
       71 
71 
     | 
    
         
             
                      # Lists ConversationInstance records from the API as a list.
         
     | 
| 
       72 
72 
     | 
    
         
             
                      # Unlike stream(), this operation is eager and will load `limit` records into
         
     | 
| 
       73 
73 
     | 
    
         
             
                      # memory before returning.
         
     | 
| 
       74 
     | 
    
         
            -
                      # @param [String] start_date Start date in ISO8601 format for  
     | 
| 
       75 
     | 
    
         
            -
                      #    
     | 
| 
       76 
     | 
    
         
            -
                      #  
     | 
| 
       77 
     | 
    
         
            -
                      # 
     | 
| 
      
 74 
     | 
    
         
            +
                      # @param [String] start_date Start date or time in ISO8601 format for filtering
         
     | 
| 
      
 75 
     | 
    
         
            +
                      #   list of Conversations. If a date is provided, the start time of the date is used
         
     | 
| 
      
 76 
     | 
    
         
            +
                      #   (YYYY-MM-DDT00:00:00Z). Can be combined with other filters.
         
     | 
| 
      
 77 
     | 
    
         
            +
                      # @param [String] end_date End date or time in ISO8601 format for filtering list
         
     | 
| 
      
 78 
     | 
    
         
            +
                      #   of Conversations. If a date is provided, the end time of the date is used
         
     | 
| 
      
 79 
     | 
    
         
            +
                      #   (YYYY-MM-DDT23:59:59Z). Can be combined with other filters.
         
     | 
| 
       78 
80 
     | 
    
         
             
                      # @param [conversation.State] state State for sorting and filtering list of
         
     | 
| 
       79 
81 
     | 
    
         
             
                      #   Conversations. Can be `active`, `inactive` or `closed`
         
     | 
| 
       80 
82 
     | 
    
         
             
                      # @param [Integer] limit Upper limit for the number of records to return. stream()
         
     | 
| 
         @@ -98,10 +100,12 @@ module Twilio 
     | 
|
| 
       98 
100 
     | 
    
         
             
                      # Streams ConversationInstance records from the API as an Enumerable.
         
     | 
| 
       99 
101 
     | 
    
         
             
                      # This operation lazily loads records as efficiently as possible until the limit
         
     | 
| 
       100 
102 
     | 
    
         
             
                      # is reached.
         
     | 
| 
       101 
     | 
    
         
            -
                      # @param [String] start_date Start date in ISO8601 format for  
     | 
| 
       102 
     | 
    
         
            -
                      #    
     | 
| 
       103 
     | 
    
         
            -
                      #  
     | 
| 
       104 
     | 
    
         
            -
                      # 
     | 
| 
      
 103 
     | 
    
         
            +
                      # @param [String] start_date Start date or time in ISO8601 format for filtering
         
     | 
| 
      
 104 
     | 
    
         
            +
                      #   list of Conversations. If a date is provided, the start time of the date is used
         
     | 
| 
      
 105 
     | 
    
         
            +
                      #   (YYYY-MM-DDT00:00:00Z). Can be combined with other filters.
         
     | 
| 
      
 106 
     | 
    
         
            +
                      # @param [String] end_date End date or time in ISO8601 format for filtering list
         
     | 
| 
      
 107 
     | 
    
         
            +
                      #   of Conversations. If a date is provided, the end time of the date is used
         
     | 
| 
      
 108 
     | 
    
         
            +
                      #   (YYYY-MM-DDT23:59:59Z). Can be combined with other filters.
         
     | 
| 
       105 
109 
     | 
    
         
             
                      # @param [conversation.State] state State for sorting and filtering list of
         
     | 
| 
       106 
110 
     | 
    
         
             
                      #   Conversations. Can be `active`, `inactive` or `closed`
         
     | 
| 
       107 
111 
     | 
    
         
             
                      # @param [Integer] limit Upper limit for the number of records to return. stream()
         
     | 
| 
         @@ -141,10 +145,12 @@ module Twilio 
     | 
|
| 
       141 
145 
     | 
    
         
             
                      ##
         
     | 
| 
       142 
146 
     | 
    
         
             
                      # Retrieve a single page of ConversationInstance records from the API.
         
     | 
| 
       143 
147 
     | 
    
         
             
                      # Request is executed immediately.
         
     | 
| 
       144 
     | 
    
         
            -
                      # @param [String] start_date Start date in ISO8601 format for  
     | 
| 
       145 
     | 
    
         
            -
                      #    
     | 
| 
       146 
     | 
    
         
            -
                      #  
     | 
| 
       147 
     | 
    
         
            -
                      # 
     | 
| 
      
 148 
     | 
    
         
            +
                      # @param [String] start_date Start date or time in ISO8601 format for filtering
         
     | 
| 
      
 149 
     | 
    
         
            +
                      #   list of Conversations. If a date is provided, the start time of the date is used
         
     | 
| 
      
 150 
     | 
    
         
            +
                      #   (YYYY-MM-DDT00:00:00Z). Can be combined with other filters.
         
     | 
| 
      
 151 
     | 
    
         
            +
                      # @param [String] end_date End date or time in ISO8601 format for filtering list
         
     | 
| 
      
 152 
     | 
    
         
            +
                      #   of Conversations. If a date is provided, the end time of the date is used
         
     | 
| 
      
 153 
     | 
    
         
            +
                      #   (YYYY-MM-DDT23:59:59Z). Can be combined with other filters.
         
     | 
| 
       148 
154 
     | 
    
         
             
                      # @param [conversation.State] state State for sorting and filtering list of
         
     | 
| 
       149 
155 
     | 
    
         
             
                      #   Conversations. Can be `active`, `inactive` or `closed`
         
     | 
| 
       150 
156 
     | 
    
         
             
                      # @param [String] page_token PageToken provided by the API
         
     | 
| 
         @@ -75,10 +75,12 @@ module Twilio 
     | 
|
| 
       75 
75 
     | 
    
         
             
                        # Lists ConversationInstance records from the API as a list.
         
     | 
| 
       76 
76 
     | 
    
         
             
                        # Unlike stream(), this operation is eager and will load `limit` records into
         
     | 
| 
       77 
77 
     | 
    
         
             
                        # memory before returning.
         
     | 
| 
       78 
     | 
    
         
            -
                        # @param [String] start_date Start date in ISO8601 format for  
     | 
| 
       79 
     | 
    
         
            -
                        #    
     | 
| 
       80 
     | 
    
         
            -
                        #  
     | 
| 
       81 
     | 
    
         
            -
                        # 
     | 
| 
      
 78 
     | 
    
         
            +
                        # @param [String] start_date Start date or time in ISO8601 format for filtering
         
     | 
| 
      
 79 
     | 
    
         
            +
                        #   list of Conversations. If a date is provided, the start time of the date is used
         
     | 
| 
      
 80 
     | 
    
         
            +
                        #   (YYYY-MM-DDT00:00:00Z). Can be combined with other filters.
         
     | 
| 
      
 81 
     | 
    
         
            +
                        # @param [String] end_date End date or time in ISO8601 format for filtering list
         
     | 
| 
      
 82 
     | 
    
         
            +
                        #   of Conversations. If a date is provided, the end time of the date is used
         
     | 
| 
      
 83 
     | 
    
         
            +
                        #   (YYYY-MM-DDT23:59:59Z). Can be combined with other filters.
         
     | 
| 
       82 
84 
     | 
    
         
             
                        # @param [conversation.State] state State for sorting and filtering list of
         
     | 
| 
       83 
85 
     | 
    
         
             
                        #   Conversations. Can be `active`, `inactive` or `closed`
         
     | 
| 
       84 
86 
     | 
    
         
             
                        # @param [Integer] limit Upper limit for the number of records to return. stream()
         
     | 
| 
         @@ -102,10 +104,12 @@ module Twilio 
     | 
|
| 
       102 
104 
     | 
    
         
             
                        # Streams ConversationInstance records from the API as an Enumerable.
         
     | 
| 
       103 
105 
     | 
    
         
             
                        # This operation lazily loads records as efficiently as possible until the limit
         
     | 
| 
       104 
106 
     | 
    
         
             
                        # is reached.
         
     | 
| 
       105 
     | 
    
         
            -
                        # @param [String] start_date Start date in ISO8601 format for  
     | 
| 
       106 
     | 
    
         
            -
                        #    
     | 
| 
       107 
     | 
    
         
            -
                        #  
     | 
| 
       108 
     | 
    
         
            -
                        # 
     | 
| 
      
 107 
     | 
    
         
            +
                        # @param [String] start_date Start date or time in ISO8601 format for filtering
         
     | 
| 
      
 108 
     | 
    
         
            +
                        #   list of Conversations. If a date is provided, the start time of the date is used
         
     | 
| 
      
 109 
     | 
    
         
            +
                        #   (YYYY-MM-DDT00:00:00Z). Can be combined with other filters.
         
     | 
| 
      
 110 
     | 
    
         
            +
                        # @param [String] end_date End date or time in ISO8601 format for filtering list
         
     | 
| 
      
 111 
     | 
    
         
            +
                        #   of Conversations. If a date is provided, the end time of the date is used
         
     | 
| 
      
 112 
     | 
    
         
            +
                        #   (YYYY-MM-DDT23:59:59Z). Can be combined with other filters.
         
     | 
| 
       109 
113 
     | 
    
         
             
                        # @param [conversation.State] state State for sorting and filtering list of
         
     | 
| 
       110 
114 
     | 
    
         
             
                        #   Conversations. Can be `active`, `inactive` or `closed`
         
     | 
| 
       111 
115 
     | 
    
         
             
                        # @param [Integer] limit Upper limit for the number of records to return. stream()
         
     | 
| 
         @@ -145,10 +149,12 @@ module Twilio 
     | 
|
| 
       145 
149 
     | 
    
         
             
                        ##
         
     | 
| 
       146 
150 
     | 
    
         
             
                        # Retrieve a single page of ConversationInstance records from the API.
         
     | 
| 
       147 
151 
     | 
    
         
             
                        # Request is executed immediately.
         
     | 
| 
       148 
     | 
    
         
            -
                        # @param [String] start_date Start date in ISO8601 format for  
     | 
| 
       149 
     | 
    
         
            -
                        #    
     | 
| 
       150 
     | 
    
         
            -
                        #  
     | 
| 
       151 
     | 
    
         
            -
                        # 
     | 
| 
      
 152 
     | 
    
         
            +
                        # @param [String] start_date Start date or time in ISO8601 format for filtering
         
     | 
| 
      
 153 
     | 
    
         
            +
                        #   list of Conversations. If a date is provided, the start time of the date is used
         
     | 
| 
      
 154 
     | 
    
         
            +
                        #   (YYYY-MM-DDT00:00:00Z). Can be combined with other filters.
         
     | 
| 
      
 155 
     | 
    
         
            +
                        # @param [String] end_date End date or time in ISO8601 format for filtering list
         
     | 
| 
      
 156 
     | 
    
         
            +
                        #   of Conversations. If a date is provided, the end time of the date is used
         
     | 
| 
      
 157 
     | 
    
         
            +
                        #   (YYYY-MM-DDT23:59:59Z). Can be combined with other filters.
         
     | 
| 
       152 
158 
     | 
    
         
             
                        # @param [conversation.State] state State for sorting and filtering list of
         
     | 
| 
       153 
159 
     | 
    
         
             
                        #   Conversations. Can be `active`, `inactive` or `closed`
         
     | 
| 
       154 
160 
     | 
    
         
             
                        # @param [String] page_token PageToken provided by the API
         
     | 
| 
         @@ -81,24 +81,15 @@ module Twilio 
     | 
|
| 
       81 
81 
     | 
    
         | 
| 
       82 
82 
     | 
    
         
             
                      ##
         
     | 
| 
       83 
83 
     | 
    
         
             
                      # Update the DomainConfigInstance
         
     | 
| 
       84 
     | 
    
         
            -
                      # @param [Array[String]] messaging_service_sids A list of messagingServiceSids
         
     | 
| 
       85 
     | 
    
         
            -
                      #   (with prefix MG)
         
     | 
| 
       86 
84 
     | 
    
         
             
                      # @param [String] fallback_url Any requests we receive to this domain that do not
         
     | 
| 
       87 
85 
     | 
    
         
             
                      #   match an existing shortened message will be redirected to the fallback url.
         
     | 
| 
       88 
86 
     | 
    
         
             
                      #   These will likely be either expired messages, random misdirected traffic, or
         
     | 
| 
       89 
87 
     | 
    
         
             
                      #   intentional scraping.
         
     | 
| 
       90 
88 
     | 
    
         
             
                      # @param [String] callback_url URL to receive click events to your webhook
         
     | 
| 
       91 
89 
     | 
    
         
             
                      #   whenever the recipients click on the shortened links
         
     | 
| 
       92 
     | 
    
         
            -
                      # @param [String] messaging_service_sids_action An action type for
         
     | 
| 
       93 
     | 
    
         
            -
                      #   messaging_service_sids operation (ADD, DELETE, REPLACE)
         
     | 
| 
       94 
90 
     | 
    
         
             
                      # @return [DomainConfigInstance] Updated DomainConfigInstance
         
     | 
| 
       95 
     | 
    
         
            -
                      def update( 
     | 
| 
       96 
     | 
    
         
            -
                        data = Twilio::Values.of({
         
     | 
| 
       97 
     | 
    
         
            -
                            'MessagingServiceSids' => Twilio.serialize_list(messaging_service_sids) { |e| e },
         
     | 
| 
       98 
     | 
    
         
            -
                            'FallbackUrl' => fallback_url,
         
     | 
| 
       99 
     | 
    
         
            -
                            'CallbackUrl' => callback_url,
         
     | 
| 
       100 
     | 
    
         
            -
                            'MessagingServiceSidsAction' => messaging_service_sids_action,
         
     | 
| 
       101 
     | 
    
         
            -
                        })
         
     | 
| 
      
 91 
     | 
    
         
            +
                      def update(fallback_url: :unset, callback_url: :unset)
         
     | 
| 
      
 92 
     | 
    
         
            +
                        data = Twilio::Values.of({'FallbackUrl' => fallback_url, 'CallbackUrl' => callback_url, })
         
     | 
| 
       102 
93 
     | 
    
         | 
| 
       103 
94 
     | 
    
         
             
                        payload = @version.update('POST', @uri, data: data)
         
     | 
| 
       104 
95 
     | 
    
         | 
| 
         @@ -146,7 +137,6 @@ module Twilio 
     | 
|
| 
       146 
137 
     | 
    
         
             
                        @properties = {
         
     | 
| 
       147 
138 
     | 
    
         
             
                            'domain_sid' => payload['domain_sid'],
         
     | 
| 
       148 
139 
     | 
    
         
             
                            'config_sid' => payload['config_sid'],
         
     | 
| 
       149 
     | 
    
         
            -
                            'messaging_service_sids' => payload['messaging_service_sids'],
         
     | 
| 
       150 
140 
     | 
    
         
             
                            'fallback_url' => payload['fallback_url'],
         
     | 
| 
       151 
141 
     | 
    
         
             
                            'callback_url' => payload['callback_url'],
         
     | 
| 
       152 
142 
     | 
    
         
             
                            'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
         
     | 
| 
         @@ -182,12 +172,6 @@ module Twilio 
     | 
|
| 
       182 
172 
     | 
    
         
             
                        @properties['config_sid']
         
     | 
| 
       183 
173 
     | 
    
         
             
                      end
         
     | 
| 
       184 
174 
     | 
    
         | 
| 
       185 
     | 
    
         
            -
                      ##
         
     | 
| 
       186 
     | 
    
         
            -
                      # @return [Array[String]] A list of messagingServiceSids (with prefix MG).
         
     | 
| 
       187 
     | 
    
         
            -
                      def messaging_service_sids
         
     | 
| 
       188 
     | 
    
         
            -
                        @properties['messaging_service_sids']
         
     | 
| 
       189 
     | 
    
         
            -
                      end
         
     | 
| 
       190 
     | 
    
         
            -
             
     | 
| 
       191 
175 
     | 
    
         
             
                      ##
         
     | 
| 
       192 
176 
     | 
    
         
             
                      # @return [String] We will redirect requests to urls we are unable to identify to this url.
         
     | 
| 
       193 
177 
     | 
    
         
             
                      def fallback_url
         
     | 
| 
         @@ -220,24 +204,15 @@ module Twilio 
     | 
|
| 
       220 
204 
     | 
    
         | 
| 
       221 
205 
     | 
    
         
             
                      ##
         
     | 
| 
       222 
206 
     | 
    
         
             
                      # Update the DomainConfigInstance
         
     | 
| 
       223 
     | 
    
         
            -
                      # @param [Array[String]] messaging_service_sids A list of messagingServiceSids
         
     | 
| 
       224 
     | 
    
         
            -
                      #   (with prefix MG)
         
     | 
| 
       225 
207 
     | 
    
         
             
                      # @param [String] fallback_url Any requests we receive to this domain that do not
         
     | 
| 
       226 
208 
     | 
    
         
             
                      #   match an existing shortened message will be redirected to the fallback url.
         
     | 
| 
       227 
209 
     | 
    
         
             
                      #   These will likely be either expired messages, random misdirected traffic, or
         
     | 
| 
       228 
210 
     | 
    
         
             
                      #   intentional scraping.
         
     | 
| 
       229 
211 
     | 
    
         
             
                      # @param [String] callback_url URL to receive click events to your webhook
         
     | 
| 
       230 
212 
     | 
    
         
             
                      #   whenever the recipients click on the shortened links
         
     | 
| 
       231 
     | 
    
         
            -
                      # @param [String] messaging_service_sids_action An action type for
         
     | 
| 
       232 
     | 
    
         
            -
                      #   messaging_service_sids operation (ADD, DELETE, REPLACE)
         
     | 
| 
       233 
213 
     | 
    
         
             
                      # @return [DomainConfigInstance] Updated DomainConfigInstance
         
     | 
| 
       234 
     | 
    
         
            -
                      def update( 
     | 
| 
       235 
     | 
    
         
            -
                        context.update(
         
     | 
| 
       236 
     | 
    
         
            -
                            messaging_service_sids: messaging_service_sids,
         
     | 
| 
       237 
     | 
    
         
            -
                            fallback_url: fallback_url,
         
     | 
| 
       238 
     | 
    
         
            -
                            callback_url: callback_url,
         
     | 
| 
       239 
     | 
    
         
            -
                            messaging_service_sids_action: messaging_service_sids_action,
         
     | 
| 
       240 
     | 
    
         
            -
                        )
         
     | 
| 
      
 214 
     | 
    
         
            +
                      def update(fallback_url: :unset, callback_url: :unset)
         
     | 
| 
      
 215 
     | 
    
         
            +
                        context.update(fallback_url: fallback_url, callback_url: callback_url, )
         
     | 
| 
       241 
216 
     | 
    
         
             
                      end
         
     | 
| 
       242 
217 
     | 
    
         | 
| 
       243 
218 
     | 
    
         
             
                      ##
         
     | 
| 
         @@ -402,6 +402,8 @@ module Twilio 
     | 
|
| 
       402 
402 
     | 
    
         
             
                            'tollfree_phone_number_sid' => payload['tollfree_phone_number_sid'],
         
     | 
| 
       403 
403 
     | 
    
         
             
                            'status' => payload['status'],
         
     | 
| 
       404 
404 
     | 
    
         
             
                            'url' => payload['url'],
         
     | 
| 
      
 405 
     | 
    
         
            +
                            'rejection_reason' => payload['rejection_reason'],
         
     | 
| 
      
 406 
     | 
    
         
            +
                            'error_code' => payload['error_code'] == nil ? payload['error_code'] : payload['error_code'].to_i,
         
     | 
| 
       405 
407 
     | 
    
         
             
                            'resource_links' => payload['resource_links'],
         
     | 
| 
       406 
408 
     | 
    
         
             
                            'external_reference_id' => payload['external_reference_id'],
         
     | 
| 
       407 
409 
     | 
    
         
             
                        }
         
     | 
| 
         @@ -602,6 +604,18 @@ module Twilio 
     | 
|
| 
       602 
604 
     | 
    
         
             
                        @properties['url']
         
     | 
| 
       603 
605 
     | 
    
         
             
                      end
         
     | 
| 
       604 
606 
     | 
    
         | 
| 
      
 607 
     | 
    
         
            +
                      ##
         
     | 
| 
      
 608 
     | 
    
         
            +
                      # @return [String] The rejection reason given when a Tollfree Verification has been rejected.
         
     | 
| 
      
 609 
     | 
    
         
            +
                      def rejection_reason
         
     | 
| 
      
 610 
     | 
    
         
            +
                        @properties['rejection_reason']
         
     | 
| 
      
 611 
     | 
    
         
            +
                      end
         
     | 
| 
      
 612 
     | 
    
         
            +
             
     | 
| 
      
 613 
     | 
    
         
            +
                      ##
         
     | 
| 
      
 614 
     | 
    
         
            +
                      # @return [String] The error code given when a Tollfree Verification has been rejected.
         
     | 
| 
      
 615 
     | 
    
         
            +
                      def error_code
         
     | 
| 
      
 616 
     | 
    
         
            +
                        @properties['error_code']
         
     | 
| 
      
 617 
     | 
    
         
            +
                      end
         
     | 
| 
      
 618 
     | 
    
         
            +
             
     | 
| 
       605 
619 
     | 
    
         
             
                      ##
         
     | 
| 
       606 
620 
     | 
    
         
             
                      # @return [Hash] The URLs of the documents associated with the Tollfree Verification resource
         
     | 
| 
       607 
621 
     | 
    
         
             
                      def resource_links
         
     | 
| 
         @@ -0,0 +1,111 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ##
         
     | 
| 
      
 2 
     | 
    
         
            +
            # This code was generated by
         
     | 
| 
      
 3 
     | 
    
         
            +
            # \ / _    _  _|   _  _
         
     | 
| 
      
 4 
     | 
    
         
            +
            #  | (_)\/(_)(_|\/| |(/_  v1.0.0
         
     | 
| 
      
 5 
     | 
    
         
            +
            #       /       /
         
     | 
| 
      
 6 
     | 
    
         
            +
            #
         
     | 
| 
      
 7 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            module Twilio
         
     | 
| 
      
 10 
     | 
    
         
            +
              module REST
         
     | 
| 
      
 11 
     | 
    
         
            +
                class Numbers < Domain
         
     | 
| 
      
 12 
     | 
    
         
            +
                  class V1 < Version
         
     | 
| 
      
 13 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 14 
     | 
    
         
            +
                    # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
         
     | 
| 
      
 15 
     | 
    
         
            +
                    class EligibilityList < ListResource
         
     | 
| 
      
 16 
     | 
    
         
            +
                      ##
         
     | 
| 
      
 17 
     | 
    
         
            +
                      # Initialize the EligibilityList
         
     | 
| 
      
 18 
     | 
    
         
            +
                      # @param [Version] version Version that contains the resource
         
     | 
| 
      
 19 
     | 
    
         
            +
                      # @return [EligibilityList] EligibilityList
         
     | 
| 
      
 20 
     | 
    
         
            +
                      def initialize(version)
         
     | 
| 
      
 21 
     | 
    
         
            +
                        super(version)
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                        # Path Solution
         
     | 
| 
      
 24 
     | 
    
         
            +
                        @solution = {}
         
     | 
| 
      
 25 
     | 
    
         
            +
                        @uri = "/HostedNumber/Eligibility"
         
     | 
| 
      
 26 
     | 
    
         
            +
                      end
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                      ##
         
     | 
| 
      
 29 
     | 
    
         
            +
                      # Create the EligibilityInstance
         
     | 
| 
      
 30 
     | 
    
         
            +
                      # @return [EligibilityInstance] Created EligibilityInstance
         
     | 
| 
      
 31 
     | 
    
         
            +
                      def create
         
     | 
| 
      
 32 
     | 
    
         
            +
                        payload = @version.create('POST', @uri)
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                        EligibilityInstance.new(@version, payload, )
         
     | 
| 
      
 35 
     | 
    
         
            +
                      end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                      ##
         
     | 
| 
      
 38 
     | 
    
         
            +
                      # Provide a user friendly representation
         
     | 
| 
      
 39 
     | 
    
         
            +
                      def to_s
         
     | 
| 
      
 40 
     | 
    
         
            +
                        '#<Twilio.Numbers.V1.EligibilityList>'
         
     | 
| 
      
 41 
     | 
    
         
            +
                      end
         
     | 
| 
      
 42 
     | 
    
         
            +
                    end
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 45 
     | 
    
         
            +
                    # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
         
     | 
| 
      
 46 
     | 
    
         
            +
                    class EligibilityPage < Page
         
     | 
| 
      
 47 
     | 
    
         
            +
                      ##
         
     | 
| 
      
 48 
     | 
    
         
            +
                      # Initialize the EligibilityPage
         
     | 
| 
      
 49 
     | 
    
         
            +
                      # @param [Version] version Version that contains the resource
         
     | 
| 
      
 50 
     | 
    
         
            +
                      # @param [Response] response Response from the API
         
     | 
| 
      
 51 
     | 
    
         
            +
                      # @param [Hash] solution Path solution for the resource
         
     | 
| 
      
 52 
     | 
    
         
            +
                      # @return [EligibilityPage] EligibilityPage
         
     | 
| 
      
 53 
     | 
    
         
            +
                      def initialize(version, response, solution)
         
     | 
| 
      
 54 
     | 
    
         
            +
                        super(version, response)
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
                        # Path Solution
         
     | 
| 
      
 57 
     | 
    
         
            +
                        @solution = solution
         
     | 
| 
      
 58 
     | 
    
         
            +
                      end
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
                      ##
         
     | 
| 
      
 61 
     | 
    
         
            +
                      # Build an instance of EligibilityInstance
         
     | 
| 
      
 62 
     | 
    
         
            +
                      # @param [Hash] payload Payload response from the API
         
     | 
| 
      
 63 
     | 
    
         
            +
                      # @return [EligibilityInstance] EligibilityInstance
         
     | 
| 
      
 64 
     | 
    
         
            +
                      def get_instance(payload)
         
     | 
| 
      
 65 
     | 
    
         
            +
                        EligibilityInstance.new(@version, payload, )
         
     | 
| 
      
 66 
     | 
    
         
            +
                      end
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
                      ##
         
     | 
| 
      
 69 
     | 
    
         
            +
                      # Provide a user friendly representation
         
     | 
| 
      
 70 
     | 
    
         
            +
                      def to_s
         
     | 
| 
      
 71 
     | 
    
         
            +
                        '<Twilio.Numbers.V1.EligibilityPage>'
         
     | 
| 
      
 72 
     | 
    
         
            +
                      end
         
     | 
| 
      
 73 
     | 
    
         
            +
                    end
         
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
      
 75 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 76 
     | 
    
         
            +
                    # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
         
     | 
| 
      
 77 
     | 
    
         
            +
                    class EligibilityInstance < InstanceResource
         
     | 
| 
      
 78 
     | 
    
         
            +
                      ##
         
     | 
| 
      
 79 
     | 
    
         
            +
                      # Initialize the EligibilityInstance
         
     | 
| 
      
 80 
     | 
    
         
            +
                      # @param [Version] version Version that contains the resource
         
     | 
| 
      
 81 
     | 
    
         
            +
                      # @param [Hash] payload payload that contains response from Twilio
         
     | 
| 
      
 82 
     | 
    
         
            +
                      # @return [EligibilityInstance] EligibilityInstance
         
     | 
| 
      
 83 
     | 
    
         
            +
                      def initialize(version, payload)
         
     | 
| 
      
 84 
     | 
    
         
            +
                        super(version)
         
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
      
 86 
     | 
    
         
            +
                        # Marshaled Properties
         
     | 
| 
      
 87 
     | 
    
         
            +
                        @properties = {'results' => payload['results'], }
         
     | 
| 
      
 88 
     | 
    
         
            +
                      end
         
     | 
| 
      
 89 
     | 
    
         
            +
             
     | 
| 
      
 90 
     | 
    
         
            +
                      ##
         
     | 
| 
      
 91 
     | 
    
         
            +
                      # @return [Array[Hash]] The result set of the requested number in the eligibility check.
         
     | 
| 
      
 92 
     | 
    
         
            +
                      def results
         
     | 
| 
      
 93 
     | 
    
         
            +
                        @properties['results']
         
     | 
| 
      
 94 
     | 
    
         
            +
                      end
         
     | 
| 
      
 95 
     | 
    
         
            +
             
     | 
| 
      
 96 
     | 
    
         
            +
                      ##
         
     | 
| 
      
 97 
     | 
    
         
            +
                      # Provide a user friendly representation
         
     | 
| 
      
 98 
     | 
    
         
            +
                      def to_s
         
     | 
| 
      
 99 
     | 
    
         
            +
                        "<Twilio.Numbers.V1.EligibilityInstance>"
         
     | 
| 
      
 100 
     | 
    
         
            +
                      end
         
     | 
| 
      
 101 
     | 
    
         
            +
             
     | 
| 
      
 102 
     | 
    
         
            +
                      ##
         
     | 
| 
      
 103 
     | 
    
         
            +
                      # Provide a detailed, user friendly representation
         
     | 
| 
      
 104 
     | 
    
         
            +
                      def inspect
         
     | 
| 
      
 105 
     | 
    
         
            +
                        "<Twilio.Numbers.V1.EligibilityInstance>"
         
     | 
| 
      
 106 
     | 
    
         
            +
                      end
         
     | 
| 
      
 107 
     | 
    
         
            +
                    end
         
     | 
| 
      
 108 
     | 
    
         
            +
                  end
         
     | 
| 
      
 109 
     | 
    
         
            +
                end
         
     | 
| 
      
 110 
     | 
    
         
            +
              end
         
     | 
| 
      
 111 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,35 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ##
         
     | 
| 
      
 2 
     | 
    
         
            +
            # This code was generated by
         
     | 
| 
      
 3 
     | 
    
         
            +
            # \ / _    _  _|   _  _
         
     | 
| 
      
 4 
     | 
    
         
            +
            #  | (_)\/(_)(_|\/| |(/_  v1.0.0
         
     | 
| 
      
 5 
     | 
    
         
            +
            #       /       /
         
     | 
| 
      
 6 
     | 
    
         
            +
            #
         
     | 
| 
      
 7 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            module Twilio
         
     | 
| 
      
 10 
     | 
    
         
            +
              module REST
         
     | 
| 
      
 11 
     | 
    
         
            +
                class Numbers
         
     | 
| 
      
 12 
     | 
    
         
            +
                  class V1 < Version
         
     | 
| 
      
 13 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 14 
     | 
    
         
            +
                    # Initialize the V1 version of Numbers
         
     | 
| 
      
 15 
     | 
    
         
            +
                    def initialize(domain)
         
     | 
| 
      
 16 
     | 
    
         
            +
                      super
         
     | 
| 
      
 17 
     | 
    
         
            +
                      @version = 'v1'
         
     | 
| 
      
 18 
     | 
    
         
            +
                      @eligibilities = nil
         
     | 
| 
      
 19 
     | 
    
         
            +
                    end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 22 
     | 
    
         
            +
                    # @return [Twilio::REST::Numbers::V1::EligibilityContext]
         
     | 
| 
      
 23 
     | 
    
         
            +
                    def eligibilities
         
     | 
| 
      
 24 
     | 
    
         
            +
                      @eligibilities ||= EligibilityList.new self
         
     | 
| 
      
 25 
     | 
    
         
            +
                    end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 28 
     | 
    
         
            +
                    # Provide a user friendly representation
         
     | 
| 
      
 29 
     | 
    
         
            +
                    def to_s
         
     | 
| 
      
 30 
     | 
    
         
            +
                      '<Twilio::REST::Numbers::V1>'
         
     | 
| 
      
 31 
     | 
    
         
            +
                    end
         
     | 
| 
      
 32 
     | 
    
         
            +
                  end
         
     | 
| 
      
 33 
     | 
    
         
            +
                end
         
     | 
| 
      
 34 
     | 
    
         
            +
              end
         
     | 
| 
      
 35 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -19,15 +19,28 @@ module Twilio 
     | 
|
| 
       19 
19 
     | 
    
         
             
                    @port = 443
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         
             
                    # Versions
         
     | 
| 
      
 22 
     | 
    
         
            +
                    @v1 = nil
         
     | 
| 
       22 
23 
     | 
    
         
             
                    @v2 = nil
         
     | 
| 
       23 
24 
     | 
    
         
             
                  end
         
     | 
| 
       24 
25 
     | 
    
         | 
| 
      
 26 
     | 
    
         
            +
                  ##
         
     | 
| 
      
 27 
     | 
    
         
            +
                  # Version v1 of numbers
         
     | 
| 
      
 28 
     | 
    
         
            +
                  def v1
         
     | 
| 
      
 29 
     | 
    
         
            +
                    @v1 ||= V1.new self
         
     | 
| 
      
 30 
     | 
    
         
            +
                  end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
       25 
32 
     | 
    
         
             
                  ##
         
     | 
| 
       26 
33 
     | 
    
         
             
                  # Version v2 of numbers
         
     | 
| 
       27 
34 
     | 
    
         
             
                  def v2
         
     | 
| 
       28 
35 
     | 
    
         
             
                    @v2 ||= V2.new self
         
     | 
| 
       29 
36 
     | 
    
         
             
                  end
         
     | 
| 
       30 
37 
     | 
    
         | 
| 
      
 38 
     | 
    
         
            +
                  ##
         
     | 
| 
      
 39 
     | 
    
         
            +
                  # @return [Twilio::REST::Numbers::V1::EligibilityInstance]
         
     | 
| 
      
 40 
     | 
    
         
            +
                  def eligibilities
         
     | 
| 
      
 41 
     | 
    
         
            +
                    self.v1.eligibilities()
         
     | 
| 
      
 42 
     | 
    
         
            +
                  end
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
       31 
44 
     | 
    
         
             
                  ##
         
     | 
| 
       32 
45 
     | 
    
         
             
                  # @return [Twilio::REST::Numbers::V2::RegulatoryComplianceInstance]
         
     | 
| 
       33 
46 
     | 
    
         
             
                  def regulatory_compliance
         
     | 
| 
         @@ -26,7 +26,7 @@ module Twilio 
     | 
|
| 
       26 
26 
     | 
    
         
             
                      ##
         
     | 
| 
       27 
27 
     | 
    
         
             
                      # Create the ServiceInstance
         
     | 
| 
       28 
28 
     | 
    
         
             
                      # @param [String] friendly_name A descriptive string that you create to describe
         
     | 
| 
       29 
     | 
    
         
            -
                      #   the verification service. It can be up to  
     | 
| 
      
 29 
     | 
    
         
            +
                      #   the verification service. It can be up to 32 characters long. **This value
         
     | 
| 
       30 
30 
     | 
    
         
             
                      #   should not contain PII.**
         
     | 
| 
       31 
31 
     | 
    
         
             
                      # @param [String] code_length The length of the verification code to generate.
         
     | 
| 
       32 
32 
     | 
    
         
             
                      #   Must be an integer value between 4 and 10, inclusive.
         
     | 
| 
         @@ -264,7 +264,7 @@ module Twilio 
     | 
|
| 
       264 
264 
     | 
    
         
             
                      ##
         
     | 
| 
       265 
265 
     | 
    
         
             
                      # Update the ServiceInstance
         
     | 
| 
       266 
266 
     | 
    
         
             
                      # @param [String] friendly_name A descriptive string that you create to describe
         
     | 
| 
       267 
     | 
    
         
            -
                      #   the verification service. It can be up to  
     | 
| 
      
 267 
     | 
    
         
            +
                      #   the verification service. It can be up to 32 characters long. **This value
         
     | 
| 
       268 
268 
     | 
    
         
             
                      #   should not contain PII.**
         
     | 
| 
       269 
269 
     | 
    
         
             
                      # @param [String] code_length The length of the verification code to generate.
         
     | 
| 
       270 
270 
     | 
    
         
             
                      #   Must be an integer value between 4 and 10, inclusive.
         
     | 
| 
         @@ -649,7 +649,7 @@ module Twilio 
     | 
|
| 
       649 
649 
     | 
    
         
             
                      ##
         
     | 
| 
       650 
650 
     | 
    
         
             
                      # Update the ServiceInstance
         
     | 
| 
       651 
651 
     | 
    
         
             
                      # @param [String] friendly_name A descriptive string that you create to describe
         
     | 
| 
       652 
     | 
    
         
            -
                      #   the verification service. It can be up to  
     | 
| 
      
 652 
     | 
    
         
            +
                      #   the verification service. It can be up to 32 characters long. **This value
         
     | 
| 
       653 
653 
     | 
    
         
             
                      #   should not contain PII.**
         
     | 
| 
       654 
654 
     | 
    
         
             
                      # @param [String] code_length The length of the verification code to generate.
         
     | 
| 
       655 
655 
     | 
    
         
             
                      #   Must be an integer value between 4 and 10, inclusive.
         
     | 
| 
         @@ -28,7 +28,7 @@ module Twilio 
     | 
|
| 
       28 
28 
     | 
    
         
             
                      # Unlike stream(), this operation is eager and will load `limit` records into
         
     | 
| 
       29 
29 
     | 
    
         
             
                      # memory before returning.
         
     | 
| 
       30 
30 
     | 
    
         
             
                      # @param [String] friendly_name String filter used to query templates with a given
         
     | 
| 
       31 
     | 
    
         
            -
                      #   friendly name
         
     | 
| 
      
 31 
     | 
    
         
            +
                      #   friendly name.
         
     | 
| 
       32 
32 
     | 
    
         
             
                      # @param [Integer] limit Upper limit for the number of records to return. stream()
         
     | 
| 
       33 
33 
     | 
    
         
             
                      #    guarantees to never return more than limit.  Default is no limit
         
     | 
| 
       34 
34 
     | 
    
         
             
                      # @param [Integer] page_size Number of records to fetch per request, when
         
     | 
| 
         @@ -45,7 +45,7 @@ module Twilio 
     | 
|
| 
       45 
45 
     | 
    
         
             
                      # This operation lazily loads records as efficiently as possible until the limit
         
     | 
| 
       46 
46 
     | 
    
         
             
                      # is reached.
         
     | 
| 
       47 
47 
     | 
    
         
             
                      # @param [String] friendly_name String filter used to query templates with a given
         
     | 
| 
       48 
     | 
    
         
            -
                      #   friendly name
         
     | 
| 
      
 48 
     | 
    
         
            +
                      #   friendly name.
         
     | 
| 
       49 
49 
     | 
    
         
             
                      # @param [Integer] limit Upper limit for the number of records to return. stream()
         
     | 
| 
       50 
50 
     | 
    
         
             
                      #    guarantees to never return more than limit. Default is no limit.
         
     | 
| 
       51 
51 
     | 
    
         
             
                      # @param [Integer] page_size Number of records to fetch per request, when
         
     | 
| 
         @@ -79,7 +79,7 @@ module Twilio 
     | 
|
| 
       79 
79 
     | 
    
         
             
                      # Retrieve a single page of TemplateInstance records from the API.
         
     | 
| 
       80 
80 
     | 
    
         
             
                      # Request is executed immediately.
         
     | 
| 
       81 
81 
     | 
    
         
             
                      # @param [String] friendly_name String filter used to query templates with a given
         
     | 
| 
       82 
     | 
    
         
            -
                      #   friendly name
         
     | 
| 
      
 82 
     | 
    
         
            +
                      #   friendly name.
         
     | 
| 
       83 
83 
     | 
    
         
             
                      # @param [String] page_token PageToken provided by the API
         
     | 
| 
       84 
84 
     | 
    
         
             
                      # @param [Integer] page_number Page Number, this value is simply for client state
         
     | 
| 
       85 
85 
     | 
    
         
             
                      # @param [Integer] page_size Number of records to return, defaults to 50
         
     | 
    
        data/lib/twilio-ruby/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: twilio-ruby
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 5. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 5.77.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Twilio API Team
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2023-04- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2023-04-20 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: jwt
         
     | 
| 
         @@ -217,6 +217,7 @@ files: 
     | 
|
| 
       217 
217 
     | 
    
         
             
            - Rakefile
         
     | 
| 
       218 
218 
     | 
    
         
             
            - UPGRADE.md
         
     | 
| 
       219 
219 
     | 
    
         
             
            - VERSIONS.md
         
     | 
| 
      
 220 
     | 
    
         
            +
            - advanced-examples/custom-http-client.md
         
     | 
| 
       220 
221 
     | 
    
         
             
            - conf/cacert.pem
         
     | 
| 
       221 
222 
     | 
    
         
             
            - examples/examples.rb
         
     | 
| 
       222 
223 
     | 
    
         
             
            - examples/print_call_log.rb
         
     | 
| 
         @@ -539,6 +540,8 @@ files: 
     | 
|
| 
       539 
540 
     | 
    
         
             
            - lib/twilio-ruby/rest/notify/v1/service/binding.rb
         
     | 
| 
       540 
541 
     | 
    
         
             
            - lib/twilio-ruby/rest/notify/v1/service/notification.rb
         
     | 
| 
       541 
542 
     | 
    
         
             
            - lib/twilio-ruby/rest/numbers.rb
         
     | 
| 
      
 543 
     | 
    
         
            +
            - lib/twilio-ruby/rest/numbers/v1.rb
         
     | 
| 
      
 544 
     | 
    
         
            +
            - lib/twilio-ruby/rest/numbers/v1/eligibility.rb
         
     | 
| 
       542 
545 
     | 
    
         
             
            - lib/twilio-ruby/rest/numbers/v2.rb
         
     | 
| 
       543 
546 
     | 
    
         
             
            - lib/twilio-ruby/rest/numbers/v2/regulatory_compliance.rb
         
     | 
| 
       544 
547 
     | 
    
         
             
            - lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb
         
     |