mbbx6spp / twitter4r

OLD repository: Please see http://github.com/twitter4r/twitter4r-core for latest official repository for project.Twitter4R: The most Ruby-like bindings for the Twitter.com REST API by a long way. (Anyone want to take over? I don't have time for Ruby OSS projects any more)
http://github.com/twitter4r/twitter4r-core
MIT License
89 stars 9 forks source link

Strange "bless_model" error #4

Open hernan43 opened 15 years ago

hernan43 commented 15 years ago

Twitter4r Version: mbbx6spp-twitter4r-0.3.1 OS: Ubuntu Jaunty Ruby Version: ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]

I get the following error seemingly at random. Sometimes I get the error, othertime I don't. It just started happening after a couple of days of usage with the above config. I'm wondering if there isn't some transient Twitter issue at play:

/usr/lib/ruby/gems/1.8/gems/mbbx6spp-twitter4r-0.3.1/lib/twitter/client/base.rb:25:in bless_model': undefined methodbless' for []:Array (NoMethodError) from /usr/lib/ruby/gems/1.8/gems/mbbx6spp-twitter4r-0.3.1/lib/twitter/client/messaging.rb:77:in message' from bot.rb:68 from /usr/lib/ruby/gems/1.8/gems/twibot-0.1.6/lib/twibot/handlers.rb:108:incall' from /usr/lib/ruby/gems/1.8/gems/twibot-0.1.6/lib/twibot/handlers.rb:108:in handle' from /usr/lib/ruby/gems/1.8/gems/twibot-0.1.6/lib/twibot/handlers.rb:100:indispatch' from /usr/lib/ruby/gems/1.8/gems/twibot-0.1.6/lib/twibot/handlers.rb:12:in dispatch' from /usr/lib/ruby/gems/1.8/gems/twibot-0.1.6/lib/twibot/handlers.rb:12:ineach' from /usr/lib/ruby/gems/1.8/gems/twibot-0.1.6/lib/twibot/handlers.rb:12:in dispatch' from /usr/lib/ruby/gems/1.8/gems/twibot-0.1.6/lib/twibot/bot.rb:148:indispatch_messages' from /usr/lib/ruby/gems/1.8/gems/twibot-0.1.6/lib/twibot/bot.rb:148:in each' from /usr/lib/ruby/gems/1.8/gems/twibot-0.1.6/lib/twibot/bot.rb:148:indispatch_messages' from /usr/lib/ruby/gems/1.8/gems/twibot-0.1.6/lib/twibot/bot.rb:101:in receive_messages' from /usr/lib/ruby/gems/1.8/gems/twibot-0.1.6/lib/twibot/bot.rb:81:inpoll' from /usr/lib/ruby/gems/1.8/gems/twibot-0.1.6/lib/twibot/bot.rb:68:in `run!' from /usr/lib/ruby/gems/1.8/gems/twibot-0.1.6/lib/twibot/bot.rb:228 from bot.rb:92

It seems to revolve around the following lines of code from /usr/lib/ruby/gems/1.8/gems/mbbx6spp-twitter4r-0.3.1/lib/twitter/client/base.rb:

22 23 # "Blesses" model object with client information 24 def bless_model(model) 25 model.bless(self) if model 26 end 27

And /usr/lib/ruby/gems/1.8/gems/mbbx6spp-twitter4r-0.3.1/lib/twitter/client/messaging.rb:

65 def message(action, value, user = nil) 66 raise ArgumentError, "Invalid messaging action: #{action}" unless [:post, :delete].member?(action) 67 raise ArgumentError, "User argument must be supplied for :post case" if action.eql?(:post) and user.nil ? 68 uri = @@MESSAGING_URIS[action] 69 user = user.to_i if user and user.is_a?(Twitter::User) 70 case action 71 when :post 72 response = http_connect({:text => value, :user => user, :source => @@config.source}.to_http_str) {|conn| create_http_post_request(uri) } 73 when :delete 74 response = http_connect {|conn| create_http_delete_request(uri, :id => value.to_i) } 75 end 76 message = Twitter::Message.unmarshal(response.body) 77 bless_model(message) 78 end

Here is the relevant line from my Twitter bot: twitter.message(:post, schedule_msg[0...140], message.sender)

Please let me know if there is anymore information I can provide.