omniauth-tumblr2 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ .DS_Store
2
+ *.gem
3
+ .bundle
4
+ Gemfile.lock
5
+ pkg/*
6
+ coverage
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'rake'
4
+
5
+ # Specify your gem's dependencies in omniauth-tumblr2.gemspec
6
+ gemspec
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ OmniAuth Tumblr2
2
+ ================
3
+
4
+ This gem is an OmniAuth 1.0 Strategy for authenticating with the [Tumblr API V2](http://www.tumblr.com/docs/en/api/v2)
5
+
6
+ Usage
7
+ -----
8
+
9
+ Register your application with [Tumblr](http://www.tumblr.com/oauth/apps). *Important*: you must
10
+ specify a default callback URL, or Tumblr will throw 400 Bad Request errors despite
11
+ the `?oauth_callback` param. Any URL is fine.
12
+
13
+ Get started by adding the Tumblr strategy to your `Gemfile`:
14
+
15
+ ```ruby
16
+ gem 'omniauth-tumblr2'
17
+ ```
18
+
19
+ Then add the Tumblr strategy to your Rack middleware:
20
+
21
+ ```ruby
22
+ use OmniAuth::Builder do
23
+ provider :tumblr2, ENV['TUMBLR_KEY'], ENV['TUMBLR_SECRET']
24
+ end
25
+ ```
26
+
27
+ In Rails, create a file like @config/initializers/omniauth.com@:
28
+
29
+ ```ruby
30
+ Rails.application.config.middleware.use OmniAuth::Builder do
31
+ provider :tumblr2, ENV['TUMBLR_KEY'], ENV['TUMBLR_SECRET']
32
+ end
33
+ ```
34
+
35
+ License
36
+ -------
37
+
38
+ Copyright (c) 2011 Aubrey Holland
39
+
40
+ This source code released under an MIT license.
41
+
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ desc 'Default: run specs.'
5
+ task :default => :spec
6
+
7
+ desc 'Run specs'
8
+ RSpec::Core::RakeTask.new
9
+
10
+ desc 'Run specs'
11
+ task :default => :spec
@@ -0,0 +1,2 @@
1
+ require "omniauth-tumblr2/version"
2
+ require 'omniauth/strategies/tumblr2'
@@ -0,0 +1,5 @@
1
+ module Omniauth
2
+ module Tumblr2
3
+ VERSION = '0.0.1'
4
+ end
5
+ end
@@ -0,0 +1,33 @@
1
+ require 'omniauth-oauth'
2
+ require 'multi_json'
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+ class Tumblr2 < OmniAuth::Strategies::OAuth
7
+
8
+ option :name, 'tumblr2'
9
+ option :client_options, {:site => 'http://www.tumblr.com'}
10
+
11
+ uid { user['name'] }
12
+
13
+ info do
14
+ {
15
+ :nickname => raw_info['name'],
16
+ :name => raw_info['name'],
17
+ :blogs => raw_info['blogs'].map do |b|
18
+ { :name => b['name'], :url => b['url'], :title => b['title'] }
19
+ end
20
+ }
21
+ end
22
+
23
+ extra do
24
+ { 'raw_info' => raw_info }
25
+ end
26
+
27
+ def raw_info
28
+ url = 'http://api.tumblr.com/v2/user/info'
29
+ @raw_info ||= MultiJson.decode(@access_token.get(url).body)['response']['user']
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require 'omniauth-tumblr2/version'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'omniauth-tumblr2'
7
+ s.version = Omniauth::Tumblr2::VERSION
8
+ s.authors = ['Aubrey Holland']
9
+ s.email = ['aubreyholland@gmail.com']
10
+ s.homepage = 'https://github.com/aub/omniauth-tumblr2'
11
+ s.summary = 'OmniAuth strategy for the Tumblr API v2'
12
+ s.description = 'OmniAuth strategy for the Tumblr API v2'
13
+
14
+ s.rubyforge_project = 'omniauth-tumblr2'
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ['lib']
20
+
21
+ s.add_runtime_dependency 'omniauth-oauth', '~> 1.0'
22
+ s.add_development_dependency 'rspec', '~> 2.7'
23
+ s.add_development_dependency 'rack-test'
24
+ s.add_development_dependency 'simplecov'
25
+ s.add_development_dependency 'webmock'
26
+ end
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-tumblr2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Aubrey Holland
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-02-16 00:00:00.000000000 -05:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: omniauth-oauth
17
+ requirement: &70186907124840 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: '1.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: *70186907124840
26
+ - !ruby/object:Gem::Dependency
27
+ name: rspec
28
+ requirement: &70186907124320 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '2.7'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: *70186907124320
37
+ - !ruby/object:Gem::Dependency
38
+ name: rack-test
39
+ requirement: &70186907123940 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ type: :development
46
+ prerelease: false
47
+ version_requirements: *70186907123940
48
+ - !ruby/object:Gem::Dependency
49
+ name: simplecov
50
+ requirement: &70186907123460 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ type: :development
57
+ prerelease: false
58
+ version_requirements: *70186907123460
59
+ - !ruby/object:Gem::Dependency
60
+ name: webmock
61
+ requirement: &70186907123040 !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ type: :development
68
+ prerelease: false
69
+ version_requirements: *70186907123040
70
+ description: OmniAuth strategy for the Tumblr API v2
71
+ email:
72
+ - aubreyholland@gmail.com
73
+ executables: []
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - .gitignore
78
+ - Gemfile
79
+ - README.md
80
+ - Rakefile
81
+ - lib/omniauth-tumblr2.rb
82
+ - lib/omniauth-tumblr2/version.rb
83
+ - lib/omniauth/strategies/tumblr2.rb
84
+ - omniauth-tumblr2.gemspec
85
+ has_rdoc: true
86
+ homepage: https://github.com/aub/omniauth-tumblr2
87
+ licenses: []
88
+ post_install_message:
89
+ rdoc_options: []
90
+ require_paths:
91
+ - lib
92
+ required_ruby_version: !ruby/object:Gem::Requirement
93
+ none: false
94
+ requirements:
95
+ - - ! '>='
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ! '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirements: []
105
+ rubyforge_project: omniauth-tumblr2
106
+ rubygems_version: 1.6.2
107
+ signing_key:
108
+ specification_version: 3
109
+ summary: OmniAuth strategy for the Tumblr API v2
110
+ test_files: []