initial post to tumblr support

This commit is contained in:
Maxwell Salzberg 2011-06-01 22:30:22 -07:00
parent 1ef9d43262
commit 5cbbdf2949
12 changed files with 114 additions and 62 deletions

View file

@ -16,8 +16,8 @@ gem 'devise', '~> 1.3.1'
gem 'devise_invitable', '0.5.0'
#Authentication
gem 'omniauth', '0.1.6'
gem 'twitter', :git => 'git://github.com/jnunemaker/twitter.git', :ref => 'ef122bbb280e229ed343'
gem 'omniauth', '0.2.6'
gem 'twitter', '1.5.0'
#Views
gem 'haml', '3.0.25'
@ -31,7 +31,7 @@ gem 'acts-as-taggable-on', :git => 'git://github.com/diaspora/acts-as-taggable-o
#Uncatagorized
gem 'roxml', :git => 'git://github.com/Empact/roxml.git', :ref => '7ea9a9ffd2338aaef5b0'
gem 'addressable', '2.2.2', :require => 'addressable/uri'
gem 'addressable', '2.2.4', :require => 'addressable/uri'
gem 'json', '1.4.6'
gem 'http_accept_language', :git => 'git://github.com/iain/http_accept_language.git', :ref => '0b78aa7849fc90cf9e12'

View file

@ -37,19 +37,6 @@ GIT
addressable (>= 2.1.1)
eventmachine (>= 0.12.9)
GIT
remote: git://github.com/jnunemaker/twitter.git
revision: ef122bbb280e229ed34347c235c68aa9349d0d8e
ref: ef122bbb280e229ed343
specs:
twitter (1.0.0)
faraday (~> 0.5.3)
faraday_middleware (~> 0.3.0)
hashie (~> 0.4.0)
multi_json (~> 0.0.5)
multi_xml (~> 0.2.0)
simple_oauth (~> 0.1.2)
GEM
remote: http://rubygems.org/
specs:
@ -85,7 +72,7 @@ GEM
activemodel (= 3.0.3)
activesupport (= 3.0.3)
activesupport (3.0.3)
addressable (2.2.2)
addressable (2.2.4)
arel (2.0.10)
aws (2.3.32)
activesupport
@ -163,12 +150,12 @@ GEM
factory_girl_rails (1.0.1)
factory_girl (~> 1.3)
railties (>= 3.0.0)
faraday (0.5.4)
addressable (~> 2.2.2)
faraday (0.6.1)
addressable (~> 2.2.4)
multipart-post (~> 1.1.0)
rack (< 2, >= 1.1.0)
faraday_middleware (0.3.2)
faraday (~> 0.5.4)
rack (>= 1.1.0, < 2)
faraday_middleware (0.6.3)
faraday (~> 0.6.0)
fastercsv (1.5.4)
fastthread (1.0.7)
ffi (0.6.3)
@ -190,10 +177,10 @@ GEM
rspec-instafail (~> 0.1.4)
ruby-progressbar (~> 0.0.10)
gem_plugin (0.2.3)
gherkin (2.3.9)
gherkin (2.3.10)
json (>= 1.4.6)
haml (3.0.25)
hashie (0.4.0)
hashie (1.0.0)
highline (1.6.2)
http_connection (1.4.1)
i18n (0.6.0)
@ -236,11 +223,11 @@ GEM
daemons (>= 1.0.3)
fastthread (>= 1.0.1)
gem_plugin (>= 0.2.3)
multi_json (0.0.5)
multi_json (1.0.3)
multi_xml (0.2.2)
multipart-post (1.1.2)
mysql2 (0.2.6)
net-ldap (0.1.1)
net-ldap (0.2.2)
net-scp (1.0.4)
net-ssh (>= 1.99.1)
net-sftp (2.0.5)
@ -249,33 +236,36 @@ GEM
net-ssh-gateway (1.1.0)
net-ssh (>= 1.99.1)
nokogiri (1.4.3.1)
oa-basic (0.1.6)
multi_json (~> 0.0.2)
nokogiri (~> 1.4.2)
oa-core (= 0.1.6)
oa-basic (0.2.6)
oa-core (= 0.2.6)
rest-client (~> 1.6.0)
oa-core (0.1.6)
rack (~> 1.1)
oa-enterprise (0.1.6)
net-ldap (~> 0.1.1)
oa-core (0.2.6)
oa-enterprise (0.2.6)
addressable (= 2.2.4)
net-ldap (~> 0.2.2)
nokogiri (~> 1.4.2)
oa-core (= 0.1.6)
oa-core (= 0.2.6)
pyu-ruby-sasl (~> 0.0.3.1)
rubyntlm (~> 0.1.1)
oa-oauth (0.1.6)
multi_json (~> 0.0.2)
nokogiri (~> 1.4.2)
oa-core (= 0.1.6)
oa-more (0.2.6)
multi_json (~> 1.0.0)
oa-core (= 0.2.6)
rest-client (~> 1.6.0)
oa-oauth (0.2.6)
faraday (~> 0.6.1)
multi_json (~> 1.0.0)
multi_xml (~> 0.2.2)
oa-core (= 0.2.6)
oauth (~> 0.4.0)
oauth2 (~> 0.1.0)
oa-openid (0.1.6)
oa-core (= 0.1.6)
rack-openid (~> 1.2.0)
ruby-openid-apps-discovery
oauth2 (~> 0.4.1)
oa-openid (0.2.6)
oa-core (= 0.2.6)
rack-openid (~> 1.3.1)
ruby-openid-apps-discovery (~> 1.2.0)
oauth (0.4.4)
oauth2 (0.1.1)
faraday (~> 0.5.0)
multi_json (~> 0.0.4)
oauth2 (0.4.1)
faraday (~> 0.6.1)
multi_json (>= 0.0.5)
ohai (0.5.8)
extlib
json (<= 1.4.6, >= 1.4.4)
@ -283,20 +273,21 @@ GEM
mixlib-config
mixlib-log
systemu
omniauth (0.1.6)
oa-basic (= 0.1.6)
oa-core (= 0.1.6)
oa-enterprise (= 0.1.6)
oa-oauth (= 0.1.6)
oa-openid (= 0.1.6)
omniauth (0.2.6)
oa-basic (= 0.2.6)
oa-core (= 0.2.6)
oa-enterprise (= 0.2.6)
oa-more (= 0.2.6)
oa-oauth (= 0.2.6)
oa-openid (= 0.2.6)
open4 (1.0.1)
orm_adapter (0.0.5)
polyglot (0.3.1)
pyu-ruby-sasl (0.0.3.2)
pyu-ruby-sasl (0.0.3.3)
rack (1.2.3)
rack-mount (0.6.14)
rack (>= 1.0.0)
rack-openid (1.2.0)
rack-openid (1.3.1)
rack (>= 1.1.0)
ruby-openid (>= 2.1.8)
rack-test (0.5.7)
@ -314,7 +305,9 @@ GEM
activesupport (= 3.0.3)
rake (>= 0.8.7)
thor (~> 0.14.4)
rake (0.9.0)
rake (0.9.1)
rash (0.3.0)
hashie (~> 1.0.0)
rcov (0.9.9)
redis (2.2.0)
redis-namespace (0.8.0)
@ -335,7 +328,7 @@ GEM
diff-lcs (~> 1.1.2)
rspec-instafail (0.1.7)
rspec-mocks (2.6.0)
rspec-rails (2.6.0)
rspec-rails (2.6.1)
actionpack (~> 3.0)
activesupport (~> 3.0)
railties (~> 3.0)
@ -370,9 +363,17 @@ GEM
eventmachine (>= 0.12.6)
rack (>= 1.0.0)
thor (0.14.6)
tilt (1.3.1)
tilt (1.3.2)
treetop (1.4.9)
polyglot (>= 0.3.1)
twitter (1.5.0)
faraday (~> 0.6.1)
faraday_middleware (~> 0.6.3)
hashie (~> 1.0.0)
multi_json (~> 1.0.0)
multi_xml (~> 0.2.0)
rash (~> 0.3.0)
simple_oauth (~> 0.1.5)
typhoeus (0.2.4)
mime-types
mime-types
@ -386,7 +387,7 @@ GEM
addressable (>= 2.2.2)
crack (>= 0.1.7)
will_paginate (3.0.pre2)
xml-simple (1.0.15)
xml-simple (1.0.16)
yui-compressor (0.9.6)
POpen4 (>= 0.1.4)
@ -396,7 +397,7 @@ PLATFORMS
DEPENDENCIES
SystemTimer (= 1.2.1)
acts-as-taggable-on!
addressable (= 2.2.2)
addressable (= 2.2.4)
aws (= 2.3.32)
bundler (>= 1.0.0)
capistrano (= 2.5.19)
@ -429,7 +430,7 @@ DEPENDENCIES
mysql2 (= 0.2.6)
nokogiri
ohai (= 0.5.8)
omniauth (= 0.1.6)
omniauth (= 0.2.6)
rails (= 3.0.3)
rcov
resque (= 1.10.0)
@ -444,7 +445,7 @@ DEPENDENCIES
settingslogic (= 2.0.6)
sod!
thin (= 1.2.11)
twitter!
twitter (= 1.5.0)
typhoeus
webmock
will_paginate (= 3.0.pre2)

View file

@ -11,6 +11,8 @@ class ServicesController < ApplicationController
def create
auth = request.env['omniauth.auth']
puts auth.inspect
toke = auth['credentials']['token']
secret = auth['credentials']['secret']

View file

@ -0,0 +1,27 @@
class Services::Tumblr < Service
MAX_CHARACTERS = 1000
def provider
"tumblr"
end
def consumer_key
SERVICES['tumblr']['consumer_key']
end
def consumer_secret
SERVICES['tumblr']['consumer_secret']
end
def post(post, url='')
consumer = OAuth::Consumer.new(consumer_key, consumer_secret, :site => 'http://tumblr.com')
access = OAuth::AccessToken.new(consumer, self.access_token, self.access_secret)
resp = access.post('http://tumblr.com/api/write', {:type => 'regular', :title => self.public_message(post, url), :generator => 'diaspora'})
resp
end
def public_message(post, url)
super(post, MAX_CHARACTERS, url)
end
end

View file

@ -0,0 +1,17 @@
.people_stream
- for person in people
.stream_element{:id => person.id}
= person_image_link(person)
- if current_user
- contact = current_user.contacts.find_by_person_id(person.id)
- contact ||= Contact.new(:person => person)
- unless person == current_user.person
.right
= render 'aspect_memberships/aspect_dropdown', :contact => contact, :person => person, :hang => 'left'
.content
%span.from
=person_link(person)
.info
= person.profile.format_tags(person.profile.tag_string)
= will_paginate people, :params => {:controller => 'people', :action => 'tag_index'}

View file

@ -0,0 +1 @@
$(".people_stream").html("<%= escape_javascript(render("index", :people => @people)) %>");

View file

@ -16,3 +16,6 @@
- unless @services.any?{|x| x.provider == 'facebook'}
%h4= link_to t('services.index.connect_to_facebook'), "/auth/facebook" if SERVICES['facebook']['app_id'] !=""
- unless @services.any?{|x| x.provider == 'tumblr'}
%h4= link_to t('services.index.connect_to_tumblr'), "/auth/tumblr" if SERVICES['tumblr']['consumer_key'] !=""

View file

@ -4,6 +4,7 @@
Rails.application.config.middleware.use OmniAuth::Builder do
provider :twitter, SERVICES['twitter']['consumer_key'], SERVICES['twitter']['consumer_secret']
provider :tumblr, SERVICES['tumblr']['consumer_key'], SERVICES['tumblr']['consumer_secret']
provider :facebook, SERVICES['facebook']['app_id'], SERVICES['facebook']['app_secret'], :scope => "publish_stream,email,offline_access"
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 796 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB