Twilio library doesn't work in Rails, but works outside rails? -
Twilio library doesn't work in Rails, but works outside rails? -
first time poster here ( gentle, i've done research! )
i'm new ruby ecosystem having come language, strikes me odd. i've added twilio-ruby library gemfile, done bundle install / tried bundle update
bundle show twilio-ruby ~/.rvm/gems/ruby-2.1.2/gems/twilio-ruby-3.11.5
however, next error when trying any of examples.
undefined method 'messages' #<twilio::rest::client::account:0x00000102cea740>
substitute calls, etc etc. nil works. not @client.account.sms.messages ( legacy calls ).
i'm familiar pry , have done @client.pry yielding self.account.methods.sort , these methods / class members not nowadays in module @ all.
so work? ruby test.rb containing:
@client = twilio::rest::client.new '{{removed}}', '{{removed}}' #@client.pry p @client.account.messages.create( :from => '+1xxx', :to => '+1xxx', :body => 'hey there!' )
if set same code @ top of application.rb, outside application class delcaration works.
where else have tried? controllers, models, stand lone classes imported , called in controllers/models. seems after rails bootstrapped doesn't work. i'm confused.
i'm pretty @ debugging, tips in direction appreciated!
versions: ruby 2.1.2, rails 4.0.4, twilio-ruby 3.11.5
after each , every alter create restart rails server.
updateconfig/application.rb require 'twilio-ruby' @client = twilio::rest::client.new '{{removed}}', '{{removed}}' #@client.pry p @client.account.messages.create( :from => '+', :to => '+', :body => 'hey there!' ) bundler.require(:default, rails.env) #require 'twilio-ruby' @client = twilio::rest::client.new '{{removed}}', '{{removed}}' #@client.pry p @client.account.messages.create( :from => '+', :to => '+', :body => 'hey there!' )
the phone call twilio-ruby prior phone call bundler works.
the phone call twilio-ruby after phone call bundler not work.
ruby-on-rails twilio
Comments
Post a Comment