Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined method validation_requests #676

Open
exop-it opened this issue Sep 13, 2023 · 1 comment
Open

Undefined method validation_requests #676

exop-it opened this issue Sep 13, 2023 · 1 comment

Comments

@exop-it
Copy link

exop-it commented Sep 13, 2023

Issue Summary

The method Twilio::REST::Client#validation_reqeusts has been removed in v6.0.0.

Running the example code from https://www.twilio.com/docs/voice/api/outgoing-caller-ids?code-sample=code-add-a-new-outgoing-caller-id&code-language=Ruby&code-sdk-version=6.x will raise a NoMethodError.

Steps to Reproduce

Run the example code from https://www.twilio.com/docs/voice/api/outgoing-caller-ids?code-sample=code-add-a-new-outgoing-caller-id&code-language=Ruby&code-sdk-version=6.x

Code Snippet

validation_request = @client.validation_requests
                            .create(
                               friendly_name: 'My Home Phone Number',
                               phone_number: '+14158675310'
                             )

Exception/Log

NoMethodError: undefined method `validation_requests' for #<Twilio::REST::Client:0x00007fcc6234fdd8 @username="xxx", @password="xxx", @region=nil, @edge=nil, @account_sid="xxx", @auth_token="xxx", @auth=["xxx", "xxx"], @http_client=#<Twilio::HTTP::Client:0x00007fcc62217c68 @proxy_prot=nil, @ssl_ca_file=nil, @timeout=nil, @adapter=:net_http, @configure_connection_blocks=[], @connection=#<Faraday::Connection:0x00007fcc602b9010 @parallel_manager=nil, @headers={"User-Agent"=>"twilio-ruby/6.6.0 (linux x86_64) Ruby/3.2.2", "Accept-Charset"=>"utf-8", "Content-Type"=>"application/x-www-form-urlencoded", "Accept"=>"application/json"}, @params={}, @options=#<Faraday::RequestOptions params_encoder=Faraday::FlatParamsEncoder>, @ssl=#<Faraday::SSLOptions verify=true>, @default_parallel_manager=nil, @manual_proxy=false, @builder=#<Faraday::RackBuilder:0x00007fcc60302b98 @adapter=Faraday::Adapter::NetHttp, @handlers=[Faraday::Request::UrlEncoded, Faraday::Request::BasicAuthentication], @app=#<Faraday::Request::UrlEncoded:0x00007fcc6033b290 @app=#<Faraday::Request::BasicAuthentication:0x00007fcc602b0690 @type="xxx", @param="xxx", @app=#<Faraday::Adapter::NetHttp:0x00007fcc602b06e0 @ssl_cert_store=#<OpenSSL::X509::Store:0x00007fcc603393c8 @verify_callback=nil, @error=nil, @error_string=nil, @chain=nil, @time=nil, @_httpclient_cert_store_items=[:default]>, @app=#<Proc:0x00007fcc6033b5b0 /home/mz/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/faraday-1.10.3/lib/faraday/adapter.rb:34 (lambda)>, @connection_options={}, @config_block=nil>, @options={}>, @options={}>>, @url_prefix=#<URI::HTTPS https://api.twilio.com/>, @proxy=nil>, @last_request=#<Twilio::Request:0x00007fcc62237090 @host="https://api.twilio.com", @port=443, @url="https://api.twilio.com/2010-04-01/Accounts/xxx/OutgoingCallerIds.json", @method="POST", @params={}, @data={"PhoneNumber"=>nil}, @headers={"User-Agent"=>"twilio-ruby/6.6.0 (linux x86_64) Ruby/3.2.2", "Accept-Charset"=>"utf-8", "Content-Type"=>"application/x-www-form-urlencoded", "Accept"=>"application/json"}, @auth=["xxx", "xxx"], @timeout=nil>, @last_response=#<Twilio::Response:0x00007fcc6035dc50 @status_code=401, @body={"code"=>20003, "message"=>"Authenticate", "more_info"=>"https://www.twilio.com/docs/errors/20003", "status"=>401}, @headers={"date"=>"Wed, 13 Sep 2023 07:36:17 GMT", "content-type"=>"application/json", "content-length"=>"107", "connection"=>"keep-alive", "www-authenticate"=>"Basic realm=\"Twilio API\"", "twilio-request-id"=>"RQ3492925d882107ecf5554b85f438344a", "x-shenanigans"=>"none", "access-control-allow-origin"=>"*", "access-control-allow-headers"=>"Accept, Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, Idempotency-Key", "access-control-allow-methods"=>"GET, POST, DELETE, OPTIONS", "access-control-expose-headers"=>"ETag", "access-control-allow-credentials"=>"true", "x-powered-by"=>"AT-5000", "x-home-region"=>"us1", "x-api-domain"=>"api.twilio.com"}>>, @logger=nil, @user_agent_extensions=[], @api=#<Twilio::REST::Api:0x00007fcc622d88f0 @client=#<Twilio::REST::Client:0x00007fcc6234fdd8 ...>, @host="api.twilio.com", @base_url="https://api.twilio.com", @port=443, @v2010=#<Twilio::REST::Api::V2010:0x00007fcc6136c8f8 @domain=#<Twilio::REST::Api:0x00007fcc622d88f0 ...>, @version="2010-04-01", @accounts=nil, @account=#<Twilio.Api.V2010.AccountContext sid: xxx>>>>

Technical details:

  • twilio-ruby version: 6.6.0
  • ruby version: 3.2.2
@jstrouse
Copy link

The documentation looks like it needs updated, but the reason for the error seems to be

warn "validation_requests is deprecated. Use account.validation_requests instead."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants