/ / असिंचित स्थिर ट्विलियो प्राप्त करना

अनियमित स्थिरता प्राप्त करना Twilio :: REST :: RequestError - ruby-on-rails-4, twilio, twilio-click-to-call

जब से मैं उन्नत हुआ, मुझे वही त्रुटि मिलती रही:

gem "twilio-ruby", "~> 5.0.0.rc4"

कॉल ट्वाइलियो के लिए सफल रहा, लेकिन वो कुछ त्रुटि हो रही है.

app/controllers/home_controller.rb:59:in `rescue in call"

require "rubygems"
require "twilio-ruby"

def call
@twilio = Twilio::REST::Client.new account_sid, auth_token

begin
@call = @twilio.account.calls.create({
:to => ,
:from => twilio_number,
:url => url,
:method => "GET",
:if_machine => "Hangup",
:timeout => "20"
})

# Getting current call status (seems like error here...!)
get_status(@call.sid)

rescue Twilio::REST::RequestError => error
@err_msg = error.message
puts @err_msg
#returned error is like below:
#NameError (uninitialized constant Twilio::REST::RequestError)
end
end

वर्तमान कॉल स्थिति प्राप्त करने के लिए कोड:

def get_status(sid)
@twilio = Twilio::REST::Client.new account_sid, auth_token
@call = @twilio.account.calls.get(sid)
puts "Process Status : " + @call.status
return @call.status
end

कृपया इसका पता लगाने में मदद करें।

धन्यवाद!

उत्तर:

जवाब के लिए 0 № 1

संस्करण 5 के लिए, प्रयास करें Twilio::REST::RestError.

यह दस्तावेज है यहाँ:

त्रुटियों से बचाव के लिए नई कक्षाएं हैं। नई लाइब्रेरी अब Twilio :: REST :: RestError क्लास का उपयोग करती है।