Permalink
Browse files

pulls tweets in now

  • Loading branch information...
2 parents 4c2d100 + d457b00 commit 272d1dd21a5cdc254a5c6738ed2ce4da763dec1f @scalabl3 committed Dec 13, 2012
View
Binary file not shown.
Binary file not shown.
@@ -4,6 +4,7 @@ gem 'rails', '3.2.9'
gem 'omniauth'
gem 'omniauth-twitter'
+
gem 'couchbase', '>= 1.2.0.z.beta3'
gem 'couchbase-model'
gem 'masonry-rails'
@@ -0,0 +1,33 @@
+require 'grackle'
+require 'couchbase/model'
+
+class Tweet < Couchbase::Model
+
+ HIPSTER = "rbin"
+ attribute :content
+ attribute :created
+
+ uuid_algorithm :random
+
+ def self.get_latest
+ tweets = client.statuses.user_timeline? :screen_name => HIPSTER # hit the API
+ tweets.each do |t|
+ created = DateTime.parse(t.created_at)
+ #unless Tweet.exists?(["created=?", created.to_i])
+ Tweet.create({:content => t.text, :created => created.to_i })
+ #end
+ end
+ end
+
+ private
+ def self.client
+ Grackle::Client.new(:auth=>{
+ :type=>:oauth,
+ :consumer_key=>'P5iDj6rQL0Zx6ooDgrKMg',
+ :consumer_secret=>'9Znpz8qQ0dIOoqz96tyeuXfqW6g5miHZu2rGKpKuPRs',
+ :token=>"145237874-BThPiQ80HfSD5tnquOCq9HIstKEi5JXOAeUVwuOC",
+ :token_secret=>"yVZY6r2R3znNJsmYSzZ13TfSA0uiOphqtwr6grjTjI"
+ })
+
+ end
+end
@@ -7,11 +7,11 @@ common: &common
development:
<<: *common
- bucket: twitter_hipster_development
+ bucket: default
test:
<<: *common
- bucket: twitter_hipster_test
+ bucket: default
# set these environment variables on your production server
production:

0 comments on commit 272d1dd

Please sign in to comment.