Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

pulls tweets in now

  • Loading branch information...
commit 272d1dd21a5cdc254a5c6738ed2ce4da763dec1f 2 parents 4c2d100 + d457b00
@scalabl3 authored
View
BIN  .DS_Store
Binary file not shown
View
BIN  TwitterHipster/.DS_Store
Binary file not shown
View
1  TwitterHipster/Gemfile
@@ -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'
View
33 TwitterHipster/app/models/tweet.rb
@@ -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
View
4 TwitterHipster/config/couchbase.yml
@@ -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:
Please sign in to comment.
Something went wrong with that request. Please try again.