omniauth-dribbble 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ce4c143ce77036d949a0dcc6e3997ecfbbce9fb2
4
+ data.tar.gz: 95187dd2891bc66682a02cb57c5b3f2cf50ce208
5
+ SHA512:
6
+ metadata.gz: 527be377b1fbc542da20e125fa40b3ac721a40239ee34c89a5f6365f89d1d42dbf2843107f5e3f5bd904c4a476875ace7f9f4bf5152780ab93534c9db1a1e94a
7
+ data.tar.gz: 6f3e7c1dabed0054c68ca5ae3208190759e4ecdaf91d1a0358c75fce31ea69e7b2c8be901466e5bf3a2e7c9a922e5885decec7afc93717c7239167cf9e333470
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .rbenv-gemsets
6
+ .ruby-version
7
+ .yardoc
8
+ Gemfile.lock
9
+ InstalledFiles
10
+ _yardoc
11
+ coverage
12
+ doc/
13
+ lib/bundler/man
14
+ /pkg
15
+ rdoc
16
+ spec/reports
17
+ test/tmp
18
+ test/version_tmp
19
+ tmp
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in omniauth-dribbble.gemspec
4
+ gemspec
5
+
6
+ group :development, :test do
7
+ gem 'guard'
8
+ gem 'guard-rspec'
9
+ gem 'guard-bundler'
10
+ gem 'rb-fsevent'
11
+ end
data/Guardfile ADDED
@@ -0,0 +1,10 @@
1
+ guard 'rspec' do
2
+ watch(%r{^spec/.+_spec\.rb$})
3
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
4
+ watch('spec/spec_helper.rb') { "spec" }
5
+ end
6
+
7
+ guard 'bundler' do
8
+ watch('Gemfile')
9
+ watch('omniauth-dribbble.gemspec')
10
+ end
data/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # OmniAuth Dribbble
2
+
3
+ This is an OmniAuth strategy for authenticating with Dribbble. To
4
+ use it, you'll need to register for an OAuth2 Client ID and Secret
5
+ on your [Dirbbble Applications Page](https://dribbble.com/account/applications).
6
+
7
+ ## Basic Usage
8
+
9
+ use OmniAuth::Builder do
10
+ provider :dribbble, ENV['DRIBBLE_CLIENT_KEY'], ENV['DRIBBBLE_CLIENT_SECRET']
11
+ end
12
+
13
+ ## Scopes
14
+
15
+ Dribbble API v1 lets you set scopes to provide granular access. `public` is the default scope:
16
+
17
+ use OmniAuth::Builder do
18
+ provider :dribbble, ENV['DRIBBLE_CLIENT_KEY'], ENV['DRIBBBLE_CLIENT_SECRET'], scope: 'public write'
19
+ end
20
+
21
+ More info on [Scopes](https://github.com/dribbble/api-documentation/blob/master/content/v1/oauth.md#scopes).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env rake
2
+ require 'bundler/gem_tasks'
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new
6
+
7
+ desc 'Run specs'
8
+ task :default => :spec
@@ -0,0 +1,2 @@
1
+ require 'omniauth-dribbble/version'
2
+ require 'omniauth/strategies/dribbble'
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module Dribbble
3
+ VERSION = '0.0.1'
4
+ end
5
+ end
@@ -0,0 +1,47 @@
1
+ require 'omniauth-oauth2'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class Dribbble < OmniAuth::Strategies::OAuth2
6
+ option :client_options, {
7
+ site: 'https://api.dribbble.com',
8
+ authorize_url: 'https://dribbble.com/oauth/authorize',
9
+ token_url: 'https://dribbble.com/oauth/token'
10
+ }
11
+
12
+ def request_phase
13
+ super
14
+ end
15
+
16
+ def callback_phase
17
+ super
18
+ end
19
+
20
+ uid { raw_info['id'].to_s }
21
+
22
+ info do
23
+ {
24
+ name: raw_info['name'],
25
+ email: raw_info['email'],
26
+ nickname: raw_info['username'],
27
+ location: raw_info['location'],
28
+ description: raw_info['bio'],
29
+ image: raw_info['avatar_url'],
30
+ urls: {
31
+ dribbble: raw_info['html_url'],
32
+ web: raw_info['links']['web'],
33
+ twitter: raw_info['links']['twitter']
34
+ }
35
+ }
36
+ end
37
+
38
+ extra do
39
+ { raw_info: raw_info }
40
+ end
41
+
42
+ def raw_info
43
+ @raw_info ||= access_token.get('/v1/user').parsed
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/omniauth-dribbble/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ['Adam Spooner']
6
+ gem.email = ['adamjspooner@gmail.com']
7
+ gem.description = %q{OmniAuth strategy for Dribbble.}
8
+ gem.summary = %q{OmniAuth strategy for Dribbble.}
9
+ gem.homepage = 'https://github.com/adamjspooner/omniauth-dribbble'
10
+
11
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
+ gem.files = `git ls-files`.split("\n")
13
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
+ gem.name = 'omniauth-dribbble'
15
+ gem.require_paths = ['lib']
16
+ gem.version = OmniAuth::Dribbble::VERSION
17
+
18
+ gem.add_dependency 'omniauth', '~> 1.0'
19
+ gem.add_dependency 'omniauth-oauth2', '~> 1.1'
20
+ gem.add_development_dependency 'rspec', '~> 2.14'
21
+ gem.add_development_dependency 'rack-test'
22
+ gem.add_development_dependency 'simplecov'
23
+ gem.add_development_dependency 'webmock'
24
+ end
@@ -0,0 +1,34 @@
1
+ require 'spec_helper'
2
+
3
+ describe OmniAuth::Strategies::Dribbble do
4
+ let(:access_token) { double('AccessToken', :options => {}) }
5
+ let(:parsed_response) { double('ParsedResponse') }
6
+ let(:response) { double('Response', :parsed => parsed_response) }
7
+
8
+ subject { OmniAuth::Strategies::Dribbble.new({}) }
9
+
10
+ before do
11
+ subject.stub(:access_token).and_return(access_token)
12
+ end
13
+
14
+ context 'client options' do
15
+ it 'has the correct site' do
16
+ expect(subject.options.client_options.site).to eq('https://api.dribbble.com')
17
+ end
18
+
19
+ it 'has the correct authorize URL' do
20
+ expect(subject.options.client_options.authorize_url).to eq('https://dribbble.com/oauth/authorize')
21
+ end
22
+
23
+ it 'has the correct token URL' do
24
+ expect(subject.options.client_options.token_url).to eq('https://dribbble.com/oauth/token')
25
+ end
26
+ end
27
+
28
+ context '#raw_info' do
29
+ it 'uses absolute paths' do
30
+ access_token.should_receive(:get).with('/v1/user').and_return(response)
31
+ expect(subject.raw_info).to eq(parsed_response)
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,16 @@
1
+ $:.unshift File.expand_path('..', __FILE__)
2
+ $:.unshift File.expand_path('../../lib', __FILE__)
3
+ require 'simplecov'
4
+ SimpleCov.start
5
+ require 'rspec'
6
+ require 'rack/test'
7
+ require 'webmock/rspec'
8
+ require 'omniauth'
9
+ require 'omniauth-dribbble'
10
+
11
+ RSpec.configure do |config|
12
+ config.include WebMock::API
13
+ config.include Rack::Test::Methods
14
+ config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
15
+ end
16
+
metadata ADDED
@@ -0,0 +1,141 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-dribbble
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Adam Spooner
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-05-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: omniauth
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: omniauth-oauth2
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.14'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.14'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rack-test
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'
69
+ - !ruby/object:Gem::Dependency
70
+ name: simplecov
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: webmock
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: OmniAuth strategy for Dribbble.
98
+ email:
99
+ - adamjspooner@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - ".rspec"
106
+ - Gemfile
107
+ - Guardfile
108
+ - README.md
109
+ - Rakefile
110
+ - lib/omniauth-dribbble.rb
111
+ - lib/omniauth-dribbble/version.rb
112
+ - lib/omniauth/strategies/dribbble.rb
113
+ - omniauth-dribbble.gemspec
114
+ - spec/omniauth/strategies/dribbble_spec.rb
115
+ - spec/spec_helper.rb
116
+ homepage: https://github.com/adamjspooner/omniauth-dribbble
117
+ licenses: []
118
+ metadata: {}
119
+ post_install_message:
120
+ rdoc_options: []
121
+ require_paths:
122
+ - lib
123
+ required_ruby_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ required_rubygems_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ requirements: []
134
+ rubyforge_project:
135
+ rubygems_version: 2.2.2
136
+ signing_key:
137
+ specification_version: 4
138
+ summary: OmniAuth strategy for Dribbble.
139
+ test_files:
140
+ - spec/omniauth/strategies/dribbble_spec.rb
141
+ - spec/spec_helper.rb