omniauth-angellist 0.0.7 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 23a07e484b93866e6d8d95a07b6949411e3fc386
4
- data.tar.gz: 5126251bf779b4def3750e8616fb2f1b5901814b
3
+ metadata.gz: a7fcf72d337a95f545086adb06cbfa76da04769a
4
+ data.tar.gz: 93e9c47c0b32cf70b8919e2165047309bbd99ff2
5
5
  SHA512:
6
- metadata.gz: f234b34d47f342f9450f57d6041592cefdf8c11b0a2763d58882a01502021792a2695b7e5bcafb654018ec2c38a020d818cd28f057935933d464d844a9238fe5
7
- data.tar.gz: 033352a9c4e0074b6f7901c7d49535922a31fd5d264b730f53a4d6a8284ce6e7805fd78864cc08452ba7bd0deacf4fd48c7a29ba43a6494d9ac9f156492b2084
6
+ metadata.gz: 5350bee46f7b08f55208773c97262aa5b9a80de9661919e807881cdccd52619b0a9eaef31ad40a2b2b93dea991ad2e2e2b6cbd43cfcad2bd2b6634b1c8b2712c
7
+ data.tar.gz: f149fee4067aa28c82a9c688bd3b8915d9ecd7398456dbfcf6d2303176e537baf366aa05177c882aed4067724ed03786717f0b4d6acddc8fc4a7dafc23efe186
data/Gemfile CHANGED
@@ -1,4 +1,3 @@
1
- source "http://rubygems.org"
1
+ source 'http://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in ..gemspec
4
3
  gemspec
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  This gem contains the AngelList strategy for OmniAuth.
4
4
 
5
- AngelList uses the OAuth2 flow, you can read about it here: http://angel.co/api/oauth/faq
5
+ AngelList uses the OAuth2 flow, you can read about it here: https://angel.co/api/oauth/faq
6
6
 
7
7
  ## How To Use It
8
8
 
@@ -17,10 +17,10 @@ You can pull them in directly from github e.g.:
17
17
  Once these are in, you need to add the following to your `config/initializers/omniauth.rb`:
18
18
 
19
19
  Rails.application.config.middleware.use OmniAuth::Builder do
20
- provider :angellist, "consumer_key", "consumer_secret"
20
+ provider :angellist, "consumer_key", "consumer_secret"
21
21
  end
22
22
 
23
- You will obviously have to put in your key and secret, which you get when you register your app with AngelList (they call them API Key and Secret Key).
23
+ You will obviously have to put in your key and secret, which you get when you register your app with AngelList (they call them API Key and Secret Key).
24
24
 
25
25
  Now just follow the README at: https://github.com/intridea/omniauth
26
26
 
@@ -32,4 +32,4 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
32
32
 
33
33
  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
34
34
 
35
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -1,7 +1,6 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
2
2
  require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
7
-
6
+ task default: :spec
@@ -6,14 +6,14 @@ module OmniAuth
6
6
  DEFAULT_SCOPE = 'email'
7
7
 
8
8
  option :client_options, {
9
- :site => 'https://angel.co/',
10
- :authorize_url => 'https://angel.co/api/oauth/authorize',
11
- :token_url => 'https://angel.co/api/oauth/token'
9
+ site: 'https://angel.co/',
10
+ authorize_url: 'https://angel.co/api/oauth/authorize',
11
+ token_url: 'https://angel.co/api/oauth/token'
12
12
  }
13
13
 
14
14
  option :access_token_options, {
15
- :mode => :query,
16
- :header_format => 'OAuth %s'
15
+ mode: :query,
16
+ header_format: 'OAuth %s'
17
17
  }
18
18
 
19
19
  option :provider_ignores_state, true
@@ -25,58 +25,57 @@ module OmniAuth
25
25
  uid { raw_info['id'] }
26
26
 
27
27
  info do
28
- prune!({
29
- "name" => raw_info["name"],
30
- "email" => raw_info["email"],
31
- "bio" => raw_info["bio"],
32
- "blog_url" => raw_info["blog_url"],
33
- "online_bio_url" => raw_info["online_bio_url"],
34
- "twitter_url" => raw_info["twitter_url"],
35
- "facebook_url" => raw_info["facebook_url"],
36
- "linkedin_url" => raw_info["linkedin_url"],
37
- "follower_count" => raw_info["follower_count"],
38
- "investor" => raw_info["investor"],
39
- "locations" => raw_info["locations"],
40
- "roles" => raw_info["roles"],
41
- "angellist_url" => raw_info["angellist_url"],
42
- "image" => raw_info["image"],
43
- "skills" => raw_info["skills"]
44
- })
28
+ prune!({ 'name' => raw_info['name'],
29
+ 'email' => raw_info['email'],
30
+ 'bio' => raw_info['bio'],
31
+ 'blog_url' => raw_info['blog_url'],
32
+ 'online_bio_url' => raw_info['online_bio_url'],
33
+ 'twitter_url' => raw_info['twitter_url'],
34
+ 'facebook_url' => raw_info['facebook_url'],
35
+ 'linkedin_url' => raw_info['linkedin_url'],
36
+ 'follower_count' => raw_info['follower_count'],
37
+ 'investor' => raw_info['investor'],
38
+ 'locations' => raw_info['locations'],
39
+ 'roles' => raw_info['roles'],
40
+ 'angellist_url' => raw_info['angellist_url'],
41
+ 'image' => raw_info['image'],
42
+ 'skills' => raw_info['skills'] })
45
43
  end
46
44
 
47
45
  credentials do
48
- hash = {'token' => access_token.token}
49
- hash.merge!('refresh_token' => access_token.refresh_token) if access_token.expires? && access_token.refresh_token
50
- hash.merge!('expires_at' => access_token.expires_at) if access_token.expires?
46
+ hash = { 'token' => access_token.token }
47
+ hash.merge!('refresh_token' => access_token.refresh_token) if
48
+ access_token.expires? && access_token.refresh_token
49
+ hash.merge!('expires_at' => access_token.expires_at) if
50
+ access_token.expires?
51
51
  hash.merge!('expires' => access_token.expires?)
52
- hash.merge!('scope' => raw_info["scopes"] ? raw_info["scopes"].join(" ") : nil)
52
+ hash.merge!(
53
+ 'scope' => raw_info['scopes'] ? raw_info['scopes'].join(' ') : nil)
53
54
  prune!(hash)
54
55
  end
55
56
 
56
57
  def raw_info
57
- unless skip_info?
58
- @raw_info ||= access_token.get('https://api.angel.co/1/me').parsed
59
- else
60
- {}
61
- end
58
+ return {} if skip_info?
59
+
60
+ @raw_info ||= access_token.get('https://api.angel.co/1/me').parsed
62
61
  end
63
62
 
64
63
  def authorize_params
65
64
  super.tap do |params|
66
- %w[scope state].each do |v|
67
- if request.params[v]
68
- params[v.to_sym] = request.params[v]
65
+ %w(scope state).each do |value|
66
+ next unless request.params[value]
69
67
 
70
- # to support omniauth-oauth2's auto csrf protection
71
- session['omniauth.state'] = params[:state] if v == 'state'
72
- end
68
+ params[value.to_sym] = request.params[value]
69
+
70
+ session['omniauth.state'] = params[:state] if value == 'state'
73
71
  end
74
72
 
75
73
  params[:scope] ||= DEFAULT_SCOPE
76
74
  end
77
75
  end
78
76
 
79
- private
77
+ private
78
+
80
79
  def prune!(hash)
81
80
  hash.delete_if do |_, value|
82
81
  prune!(value) if value.is_a?(Hash)
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module AngelList
3
- VERSION = "0.0.7"
3
+ VERSION = '1.0.0'
4
4
  end
5
5
  end
@@ -1,2 +1,2 @@
1
- require "omniauth-angellist/version"
2
- require "omniauth/strategies/angellist"
1
+ require 'omniauth-angellist/version'
2
+ require 'omniauth/strategies/angellist'
@@ -1,23 +1,22 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "omniauth-angellist/version"
1
+ $LOAD_PATH.push File.expand_path('../lib', __FILE__)
2
+ require 'omniauth-angellist/version'
4
3
 
5
4
  Gem::Specification.new do |s|
6
- s.name = "omniauth-angellist"
5
+ s.name = 'omniauth-angellist'
7
6
  s.version = Omniauth::AngelList::VERSION
8
- s.authors = ["Sebastian Rabuini"]
9
- s.email = ["srabuini@gmail.com"]
10
- s.homepage = "https://github.com/wasabit/omniauth-angellist"
11
- s.summary = %q{AngelList OAuth strategy for OmniAuth}
12
- s.description = %q{AngelList OAuth strategy for OmniAuth}
13
- s.license = "MIT"
7
+ s.authors = ['Sebastian Rabuini']
8
+ s.email = ['srabuini@gmail.com']
9
+ s.homepage = 'https://github.com/wasabit/omniauth-angellist'
10
+ s.summary = 'AngelList OAuth strategy for OmniAuth'
11
+ s.description = 'AngelList OAuth strategy for OmniAuth'
12
+ s.license = 'MIT'
14
13
 
15
- s.rubyforge_project = "omniauth-angellist"
14
+ s.rubyforge_project = 'omniauth-angellist'
16
15
 
17
16
  s.files = `git ls-files`.split("\n")
18
17
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
- s.require_paths = ["lib"]
18
+
19
+ s.require_paths = ['lib']
21
20
 
22
21
  s.add_runtime_dependency 'omniauth-oauth2', '~> 1.1'
23
22
  s.add_development_dependency 'rspec', '~> 2.7'
@@ -19,24 +19,24 @@ describe OmniAuth::Strategies::AngelList do
19
19
  'follower_count' => 6,
20
20
  'investor' => false,
21
21
  'locations' => [
22
- {'id' => 1963, 'tag_type' => 'LocationTag', 'name' => 'buenos aires',
22
+ { 'id' => 1963, 'tag_type' => 'LocationTag', 'name' => 'buenos aires',
23
23
  'display_name' => 'Buenos Aires',
24
- 'angellist_url' => 'https://angel.co/buenos-aires'}
24
+ 'angellist_url' => 'https://angel.co/buenos-aires' }
25
25
  ],
26
26
  'roles' => [
27
- {'id' => 14726, 'tag_type' => 'RoleTag', 'name' => 'developer',
27
+ { 'id' => 14726, 'tag_type' => 'RoleTag', 'name' => 'developer',
28
28
  'display_name' => 'Developer',
29
- 'angellist_url' => 'https://angel.co/developer'},
30
- {'id' => 14725, 'tag_type' => 'RoleTag', 'name' => 'entrepreneur',
29
+ 'angellist_url' => 'https://angel.co/developer' },
30
+ { 'id' => 14725, 'tag_type' => 'RoleTag', 'name' => 'entrepreneur',
31
31
  'display_name' => 'Entrepreneur',
32
- 'angellist_url' => 'https://angel.co/entrepreneur-1'}
32
+ 'angellist_url' => 'https://angel.co/entrepreneur-1' }
33
33
  ],
34
34
  'skills' => [
35
- {"id" => 82532, "tag_type" => "SkillTag", "name" => "ruby on rails",
36
- "display_name" => "Ruby on Rails",
37
- "angellist_url" => "https://angel.co/ruby-on-rails-1"}
35
+ { 'id' => 82532, 'tag_type' => 'SkillTag', 'name' => 'ruby on rails',
36
+ 'display_name' => 'Ruby on Rails',
37
+ 'angellist_url' => 'https://angel.co/ruby-on-rails-1' }
38
38
  ],
39
- 'scopes' => ["email","comment","message","talent"],
39
+ 'scopes' => %w(email comment message talent),
40
40
  'angellist_url' => 'https://angel.co/sebasr',
41
41
  'image' => 'https://s3.amazonaws.com/photos.angel.co/users/90585-medium_jpg?1327684569'
42
42
  }
@@ -83,19 +83,19 @@ describe OmniAuth::Strategies::AngelList do
83
83
  subject.info['image'].should eq(@raw_info['image'])
84
84
  end
85
85
 
86
- it "return the email" do
86
+ it 'return the email' do
87
87
  subject.info['email'].should eq('sebas@wasabit.com.ar')
88
88
  end
89
89
 
90
- it "return skills" do
91
- subject.info['skills'].first['name'].should eq("ruby on rails")
90
+ it 'return skills' do
91
+ subject.info['skills'].first['name'].should eq('ruby on rails')
92
92
  end
93
93
  end
94
94
  end
95
95
 
96
96
  describe '#authorize_params' do
97
97
  before :each do
98
- subject.stub(:session => {})
98
+ subject.stub(session: {})
99
99
  end
100
100
 
101
101
  it 'includes default scope for email' do
@@ -122,8 +122,8 @@ describe OmniAuth::Strategies::AngelList do
122
122
  subject.credentials['token'].should eq('123')
123
123
  end
124
124
 
125
- it "return scopes" do
126
- subject.credentials['scope'].should eq("email comment message talent")
125
+ it 'return scopes' do
126
+ subject.credentials['scope'].should eq('email comment message talent')
127
127
  end
128
128
 
129
129
  it 'returns the expiry status' do
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,4 @@
1
1
  require 'bundler/setup'
2
2
  require 'rspec'
3
- Dir[File.expand_path('../support/**/*', __FILE__)].each { |f| require f }
4
3
 
5
- RSpec.configure do |config|
6
- end
4
+ Dir[File.expand_path('../support/**/*', __FILE__)].each { |f| require f }
@@ -1,23 +1,23 @@
1
- # NOTE it would be useful if this lived in omniauth-oauth2 eventually
2
1
  shared_examples 'an oauth2 strategy' do
3
2
  describe '#client' do
4
3
  it 'should be initialized with symbolized client_options' do
5
- @options = { :client_options => { 'authorize_url' => 'https://example.com' } }
4
+ @options = { client_options:
5
+ { 'authorize_url' => 'https://example.com' } }
6
6
  subject.client.options[:authorize_url].should == 'https://example.com'
7
7
  end
8
8
  end
9
9
 
10
10
  describe '#token_params' do
11
- it 'should include any authorize params passed in the :authorize_params option' do
12
- @options = { :token_params => { :foo => 'bar', :baz => 'zip' } }
11
+ it 'should include any params passed in the :authorize_params option' do
12
+ @options = { token_params: { foo: 'bar', baz: 'zip' } }
13
13
  subject.token_params['foo'].should eq('bar')
14
14
  subject.token_params['baz'].should eq('zip')
15
15
  end
16
16
 
17
- it 'should include top-level options that are marked as :authorize_options' do
18
- @options = { :token_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
17
+ it 'should include top-level options marked as :authorize_options' do
18
+ @options = { token_options: [:scope, :foo], scope: 'bar', foo: 'baz' }
19
19
  subject.token_params['scope'].should eq('bar')
20
20
  subject.token_params['foo'].should eq('baz')
21
21
  end
22
22
  end
23
- end
23
+ end
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-angellist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Rabuini
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-16 00:00:00.000000000 Z
11
+ date: 2015-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth-oauth2
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '2.7'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '2.7'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rack-test
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: simplecov
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: webmock
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  description: AngelList OAuth strategy for OmniAuth
@@ -87,7 +87,7 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
- - .gitignore
90
+ - ".gitignore"
91
91
  - Gemfile
92
92
  - README.md
93
93
  - Rakefile
@@ -108,17 +108,17 @@ require_paths:
108
108
  - lib
109
109
  required_ruby_version: !ruby/object:Gem::Requirement
110
110
  requirements:
111
- - - '>='
111
+ - - ">="
112
112
  - !ruby/object:Gem::Version
113
113
  version: '0'
114
114
  required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - '>='
116
+ - - ">="
117
117
  - !ruby/object:Gem::Version
118
118
  version: '0'
119
119
  requirements: []
120
120
  rubyforge_project: omniauth-angellist
121
- rubygems_version: 2.0.3
121
+ rubygems_version: 2.4.5
122
122
  signing_key:
123
123
  specification_version: 4
124
124
  summary: AngelList OAuth strategy for OmniAuth