omniauth-tumblr 1.1 → 1.2

This diff has not been reviewed by any users.
Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 52c721879f95a16d3210f8a409e7b206afdf09e5
4
+ data.tar.gz: 51c8156fa24b5fdec962192c69b9b90e2b8eeed7
5
+ SHA512:
6
+ metadata.gz: 3dbd006c97129a740d81399525c4aff5f77cf99cc617e21740c0ff79818bd7c6d34ab44c51dad2273d5584ef888bc8f58a1aaa4725073b62d9342aea131f6870
7
+ data.tar.gz: 4f8e7b1c0883fb518aeef9dca16805419b131af201994fe90ead9c9d1ff915b991ff598f5ee9c2c59c7645e53f520f0ae8773cce5581c8dd081374f412811b27
data/.gitignore CHANGED
@@ -1,2 +1,4 @@
1
+ .bundle
1
2
  .DS_Store
3
+ .gems
2
4
  *.gem
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1 @@
1
+ 2.2.3
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,41 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ omniauth-tumblr (1.2)
5
+ multi_json
6
+ omniauth-oauth (~> 1.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ diff-lcs (1.1.3)
12
+ hashie (3.4.3)
13
+ multi_json (1.11.2)
14
+ oauth (0.4.7)
15
+ omniauth (1.2.2)
16
+ hashie (>= 1.2, < 4)
17
+ rack (~> 1.0)
18
+ omniauth-oauth (1.1.0)
19
+ oauth
20
+ omniauth (~> 1.0)
21
+ rack (1.6.4)
22
+ rake (0.9.2.2)
23
+ rspec (2.11.0)
24
+ rspec-core (~> 2.11.0)
25
+ rspec-expectations (~> 2.11.0)
26
+ rspec-mocks (~> 2.11.0)
27
+ rspec-core (2.11.1)
28
+ rspec-expectations (2.11.2)
29
+ diff-lcs (~> 1.1.3)
30
+ rspec-mocks (2.11.1)
31
+
32
+ PLATFORMS
33
+ ruby
34
+
35
+ DEPENDENCIES
36
+ omniauth-tumblr!
37
+ rake
38
+ rspec
39
+
40
+ BUNDLED WITH
41
+ 1.10.6
data/README.md CHANGED
@@ -7,11 +7,21 @@ An example Rails application is available:
7
7
  <https://github.com/jamiew/omniauth-rails-app>
8
8
 
9
9
 
10
- Usage
10
+ Setup
11
11
  -----
12
12
 
13
- Register your application with Tumblr. *Important*: you must specify a default callback URL,
14
- or Tumblr will throw 400 Bad Request errors despite the `?oauth_callback` param. Any URL is fine.
13
+ Register your application with [Tumblr](http://www.tumblr.com/oauth/apps).
14
+
15
+ *Important*: your callback URL needs to be specified as `http://[hostname]/auth/tumblr/callback`.
16
+ The Tumblr API does not respect the dynamic ?oauth_callback URL passed by Omniauth. ([related thread](https://groups.google.com/forum/?fromgroups#!searchin/tumblr-api/callback$20url/tumblr-api/5k_afNDUB5s/gfaNMnRtINoJ))
17
+
18
+ In order to authenticate with Tumblr in both development and production we recommend
19
+ registering a "-dev" app with Tumblr which points at localhost:3000 or yourapp.dev (not ideal)
20
+
21
+ Using services like https://ngrok.com works like a charm.
22
+
23
+ Usage
24
+ -----
15
25
 
16
26
  Get started by adding the Tumblr strategy to your `Gemfile`:
17
27
 
@@ -19,27 +29,27 @@ Get started by adding the Tumblr strategy to your `Gemfile`:
19
29
  gem 'omniauth-tumblr'
20
30
  ```
21
31
 
22
- Then add the Tumblr strategy to your Rack middleware:
32
+ In a Rails app, add the Tumblr provider to your Omniauth middleware, e.g.
33
+ in a file like @config/initializers/omniauth.rb@:
23
34
 
24
35
  ```ruby
25
- use OmniAuth::Builder do
36
+ Rails.application.config.middleware.use OmniAuth::Builder do
26
37
  provider :tumblr, ENV['TUMBLR_KEY'], ENV['TUMBLR_SECRET']
27
38
  end
28
39
  ```
29
40
 
30
- In Rails, create a file like @config/initializers/omniauth.com@:
41
+ In any Rack app you can add the Tumblr strategy like so:
31
42
 
32
43
  ```ruby
33
- Rails.application.config.middleware.use OmniAuth::Builder do
44
+ use OmniAuth::Builder do
34
45
  provider :tumblr, ENV['TUMBLR_KEY'], ENV['TUMBLR_SECRET']
35
46
  end
36
47
  ```
37
48
 
38
-
39
49
  License
40
50
  -------
41
51
 
42
- Copyright (c) 2011 Jamie Wilkinson
52
+ Copyright (c) 2011-2012 [Jamie Wilkinson](http://jamiedubs.com)
43
53
 
44
54
  This source code released under an MIT license.
45
55
 
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env rake
2
+
3
+ require "bundler/gem_tasks"
4
+ require 'rspec/core/rake_task'
5
+
6
+ desc "Run specs"
7
+ RSpec::Core::RakeTask.new
8
+
9
+ task :default => :spec
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Tumblr
3
- VERSION = "1.1"
3
+ VERSION = "1.2"
4
4
  end
5
5
  end
@@ -6,7 +6,10 @@ module OmniAuth
6
6
  class Tumblr < OmniAuth::Strategies::OAuth
7
7
 
8
8
  option :name, 'tumblr'
9
- option :client_options, {:site => 'http://www.tumblr.com'}
9
+ option :client_options, {:site => 'https://www.tumblr.com',
10
+ :request_token_path => "/oauth/request_token",
11
+ :access_token_path => "/oauth/access_token",
12
+ :authorize_path => "/oauth/authorize"}
10
13
 
11
14
  uid { raw_info['name'] }
12
15
 
@@ -17,6 +17,10 @@ Gem::Specification.new do |gem|
17
17
  gem.require_paths = ["lib"]
18
18
 
19
19
  gem.add_runtime_dependency 'omniauth-oauth', '~> 1.0'
20
+ gem.add_runtime_dependency 'multi_json'
21
+
22
+ gem.add_development_dependency 'rspec' #, "~> 2.9"
23
+ gem.add_development_dependency 'rake' #, '~> 0.9'
20
24
 
21
25
  gem.required_rubygems_version = Gem::Requirement.new('>= 1.3.6') if gem.respond_to? :required_rubygems_version=
22
- end
26
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe OmniAuth::Strategies::Tumblr do
4
+
5
+ subject do
6
+ OmniAuth::Strategies::Tumblr.new({})
7
+ end
8
+
9
+ context "client options" do
10
+ it 'should have correct name' do
11
+ subject.options.name.should eq("tumblr")
12
+ end
13
+
14
+ it 'should have correct site' do
15
+ subject.options.client_options.site.should eq("https://www.tumblr.com")
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,53 @@
1
+ $:.unshift File.expand_path('..', __FILE__)
2
+ $:.unshift File.expand_path('../../lib', __FILE__)
3
+
4
+ require 'rspec'
5
+ require 'omniauth'
6
+ require 'omniauth-tumblr'
7
+
8
+ RSpec.configure do |config|
9
+ config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
10
+ end
11
+
12
+
13
+
14
+
15
+ # Copied/inlined from omniauth-google2
16
+ # TODO this should also be part of omniauth-oauth
17
+ # NOTE it would be useful if this lived in omniauth-oauth2 eventually
18
+ shared_examples 'an oauth2 strategy' do
19
+ describe '#client' do
20
+ it 'should be initialized with symbolized client_options' do
21
+ @options = { :client_options => { 'authorize_url' => 'https://example.com' } }
22
+ subject.client.options[:authorize_url].should == 'https://example.com'
23
+ end
24
+ end
25
+
26
+ describe '#authorize_params' do
27
+ it 'should include any authorize params passed in the :authorize_params option' do
28
+ @options = { :authorize_params => { :foo => 'bar', :baz => 'zip' } }
29
+ subject.authorize_params['foo'].should eq('bar')
30
+ subject.authorize_params['baz'].should eq('zip')
31
+ end
32
+
33
+ it 'should include top-level options that are marked as :authorize_options' do
34
+ @options = { :authorize_options => [:scope, :foo], :scope => 'http://bar', :foo => 'baz' }
35
+ subject.authorize_params['scope'].should eq('http://bar')
36
+ subject.authorize_params['foo'].should eq('baz')
37
+ end
38
+ end
39
+
40
+ describe '#token_params' do
41
+ it 'should include any token params passed in the :token_params option' do
42
+ @options = { :token_params => { :foo => 'bar', :baz => 'zip' } }
43
+ subject.token_params['foo'].should eq('bar')
44
+ subject.token_params['baz'].should eq('zip')
45
+ end
46
+
47
+ it 'should include top-level options that are marked as :token_options' do
48
+ @options = { :token_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
49
+ subject.token_params['scope'].should eq('bar')
50
+ subject.token_params['foo'].should eq('baz')
51
+ end
52
+ end
53
+ end
metadata CHANGED
@@ -1,32 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-tumblr
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.1'
5
- prerelease:
4
+ version: '1.2'
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jamie Wilkinson
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-08-04 00:00:00.000000000 Z
11
+ date: 2015-11-15 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: omniauth-oauth
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: '1.0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: multi_json
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
30
69
  description: OmniAuth strategy for Tumblr
31
70
  email:
32
71
  - jamie@jamiedubs.com
@@ -34,35 +73,42 @@ executables: []
34
73
  extensions: []
35
74
  extra_rdoc_files: []
36
75
  files:
37
- - .gitignore
76
+ - ".gitignore"
77
+ - ".rspec"
78
+ - ".ruby-version"
79
+ - Gemfile
80
+ - Gemfile.lock
38
81
  - README.md
82
+ - Rakefile
39
83
  - lib/omniauth-tumblr.rb
40
84
  - lib/omniauth-tumblr/version.rb
41
85
  - lib/omniauth/strategies/tumblr.rb
42
86
  - omniauth-tumblr.gemspec
87
+ - spec/omniauth/strategies/tumblr_spec.rb
88
+ - spec/spec_helper.rb
43
89
  homepage: https://github.com/jamiew/omniauth-tumblr
44
90
  licenses: []
91
+ metadata: {}
45
92
  post_install_message:
46
93
  rdoc_options: []
47
94
  require_paths:
48
95
  - lib
49
96
  required_ruby_version: !ruby/object:Gem::Requirement
50
- none: false
51
97
  requirements:
52
- - - ! '>='
98
+ - - ">="
53
99
  - !ruby/object:Gem::Version
54
100
  version: '0'
55
101
  required_rubygems_version: !ruby/object:Gem::Requirement
56
- none: false
57
102
  requirements:
58
- - - ! '>='
103
+ - - ">="
59
104
  - !ruby/object:Gem::Version
60
105
  version: 1.3.6
61
106
  requirements: []
62
107
  rubyforge_project:
63
- rubygems_version: 1.8.24
108
+ rubygems_version: 2.4.5.1
64
109
  signing_key:
65
- specification_version: 3
110
+ specification_version: 4
66
111
  summary: OmniAuth strategy for Tumblr
67
- test_files: []
68
- has_rdoc:
112
+ test_files:
113
+ - spec/omniauth/strategies/tumblr_spec.rb
114
+ - spec/spec_helper.rb