Created
January 21, 2013 00:03
-
-
Save doombongo/4582707 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Grackle::TwitterError: Unable to decode response: 757: unexpected token at '<?xml version="1.0" encoding="UTF-8"?> | |
<hash> | |
<request>/1/statueses/user_timeline.json?screen_name=my_event_organizer</request> | |
<error>Timestamp out of bounds</error> | |
</hash> | |
' | |
from /usr/local/rvm/gems/ruby-1.9.3-p125/gems/grackle-0.2.1/lib/grackle/client.rb:274:in `rescue in process_response' | |
from /usr/local/rvm/gems/ruby-1.9.3-p125/gems/grackle-0.2.1/lib/grackle/client.rb:265:in `process_response' | |
from /usr/local/rvm/gems/ruby-1.9.3-p125/gems/grackle-0.2.1/lib/grackle/client.rb:241:in `call_with_format' | |
from /usr/local/rvm/gems/ruby-1.9.3-p125/gems/grackle-0.2.1/lib/grackle/client.rb:221:in `append' | |
from /usr/local/rvm/gems/ruby-1.9.3-p125/gems/grackle-0.2.1/lib/grackle/client.rb:159:in `method_missing' | |
from /Users/Mike/rails_projects/twitter_app/app/models/tweet.rb:10:in `get_latest' | |
from (irb):2 | |
from /usr/local/rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.9/lib/rails/commands/console.rb:47:in `start' | |
from /usr/local/rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.9/lib/rails/commands/console.rb:8:in `start' | |
from /usr/local/rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.9/lib/rails/commands.rb:41:in `<top (required)>' | |
from script/rails:6:in `require' | |
from script/rails:6:in `<main>' | |
1.9.3p125 :003 > |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'grackle' | |
class Tweet < ActiveRecord::Base | |
MY_APPLICATION_NAME = "my_event_organizer" | |
# Connect to the Twitter API and pull down the latest tweets | |
def self.get_latest | |
tweets = client.statueses.user_timeline? :screen_name => MY_APPLICATION_NAME | |
tweets.each do |t| | |
created = DateTime.parse(t.created_at) | |
unless Tweet.exists?(["created=?",created]) | |
Tweet.create({:content => t.text, :created => created}) | |
end | |
end | |
end | |
private | |
def self.client | |
Grackle::Client.new(:auth=>{ | |
:type=>:oauth, | |
:consumer_key=>'#', | |
:consumer_secret=>'#', | |
:token=>'#', | |
:token_secret=>'#' | |
}) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment