omniauth-gplus 2.0.0.beta1 → 2.0.0.beta2

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: 8acb5ae7c83c1728f717c4385e4217bcd8337621
4
- data.tar.gz: 2b55f613f0eb0f415bd10c72a1bcdde02d18129a
3
+ metadata.gz: a54087e815dbb305001bfd818bc13b2e3581ce22
4
+ data.tar.gz: 269d6dd198735f2233632970ec2bca9260f89000
5
5
  SHA512:
6
- metadata.gz: a23afce6c3d5f705b0ff975916f5b6fb2eb4270785e159214af5adfae0482efd234b85282ed6908f57de6672510a24140cca9eb3d3f45d07e71b8b47cad6f65e
7
- data.tar.gz: ed04c2cc4276876e04d0b5d87120f56a0deea144d208b3decb28cd0b46e056090019a9cf93dc76b4201d739ac4bd4bf21ab5dbf1372930e38b0de97c14de11a7
6
+ metadata.gz: cc693f35739939f28022213a979ae99371ded6ab092f09dec0e13f5d68df565cd8bfaa87d75941d3a2c03e1d97d792515db7a3409f62e14c017cd93885506f42
7
+ data.tar.gz: c37d1242a31352fabb84b32d9c6206da16fa82790435fdd31d7d9761508528afe533a38fe1e05f23e74bb91bbc15aaecd4cc80b0096798035d0ca9f7e7e11f0a
data/.rubocop.yml ADDED
@@ -0,0 +1,3 @@
1
+ # This is the configuration used to check the rubocop source code.
2
+
3
+ inherit_from: .rubocop_todo.yml
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,78 @@
1
+ AllCops:
2
+ Include:
3
+ - 'Gemfile'
4
+ - 'Rakefile'
5
+ - 'omniauth-gplus.gemspec'
6
+
7
+ # Avoid long parameter lists
8
+ ParameterLists:
9
+ Max: 5
10
+ CountKeywordArgs: true
11
+
12
+ MethodLength:
13
+ CountComments: false
14
+ Max: 18
15
+
16
+ # Avoid more than `Max` levels of nesting.
17
+ BlockNesting:
18
+ Max: 2
19
+
20
+ # Align with the style guide.
21
+ CollectionMethods:
22
+ PreferredMethods:
23
+ map: 'collect'
24
+ reduce: 'inject'
25
+ find: 'detect'
26
+ find_all: 'select'
27
+
28
+ # Do not force public/protected/private keyword to be indented at the same
29
+ # level as the def keyword. My personal preference is to outdent these keywords
30
+ # because I think when scanning code it makes it easier to identify the
31
+ # sections of code and visually separate them. When the keyword is at the same
32
+ # level I think it sort of blends in with the def keywords and makes it harder
33
+ # to scan the code and see where the sections are.
34
+ AccessModifierIndentation:
35
+ Enabled: false
36
+
37
+ # Limit line length
38
+ LineLength:
39
+ Enabled: false
40
+
41
+ # Disable documentation checking until a class needs to be documented once
42
+ Documentation:
43
+ Enabled: false
44
+
45
+ # Enforce Ruby 1.8-compatible hash syntax
46
+ HashSyntax:
47
+ EnforcedStyle: hash_rockets
48
+
49
+ # No spaces inside hash literals
50
+ SpaceInsideHashLiteralBraces:
51
+ EnforcedStyle: no_space
52
+
53
+ # Allow dots at the end of lines
54
+ DotPosition:
55
+ Enabled: false
56
+
57
+ # Don't require magic comment at the top of every file
58
+ Encoding:
59
+ Enabled: false
60
+
61
+ EmptyLinesAroundAccessModifier:
62
+ Enabled: true
63
+
64
+ # Align ends correctly
65
+ EndAlignment:
66
+ AlignWith: variable
67
+
68
+ # Indentation of when/else
69
+ CaseIndentation:
70
+ IndentWhenRelativeTo: end
71
+ IndentOneStep: false
72
+
73
+ Lambda:
74
+ Enabled: false
75
+
76
+ FileName:
77
+ Exclude:
78
+ - 'lib/omniauth-gplus.rb'
data/.travis.yml CHANGED
@@ -1,10 +1,26 @@
1
+ before_install:
2
+ - gem update bundler
3
+ - bundle --version
4
+ - gem update --system 2.1.11
5
+ - gem --version
1
6
  language: ruby
2
7
  rvm:
8
+ - 1.9.2
3
9
  - 1.9.3
4
10
  - 2.0.0
5
- - 2.1.0
6
- - ruby-head
7
- - rbx-19mode
8
- - rbx-2
11
+ - 2.1
12
+ - jruby
9
13
  - rbx
10
- - jruby-19mode
14
+ - rbx-2
15
+ - ruby-head
16
+ matrix:
17
+ include:
18
+ - rvm: jruby-19mode
19
+ env: JRUBY_OPTS="$JRUBY_OPTS --debug"
20
+ - rvm: jruby-head
21
+ env: JRUBY_OPTS="$JRUBY_OPTS --debug"
22
+ allow_failures:
23
+ - rvm: jruby-head
24
+ - rvm: ruby-head
25
+ - rvm: rbx
26
+ fast_finish: true
data/README.md CHANGED
@@ -17,6 +17,27 @@ omniauth-gplus
17
17
  It allows you to easily interact with the Google+ OAuth2 endpoint.
18
18
 
19
19
 
20
+ Installing
21
+ ----------
22
+
23
+ **Requirements**:
24
+ A GPlus API key/secret
25
+
26
+ You can either install manually:
27
+
28
+ ``` bash
29
+ $ gem install omniauth-gplus
30
+ ```
31
+
32
+ Or put it in your `Gemfile`:
33
+
34
+ ``` ruby
35
+ source 'https://rubygems.org'
36
+
37
+ gem 'omniauth-gplus', '~> 2.0'
38
+ ```
39
+
40
+
20
41
  Examples
21
42
  --------
22
43
 
@@ -55,6 +76,11 @@ provider :gplus, ENV['GPLUS_KEY'], ENV['GPLUS_SECRET'], scope: 'plus.login', req
55
76
 
56
77
  To see and learn about all of the available App Activity types, visit: https://developers.google.com/+/api/moment-types/
57
78
 
79
+ To get a refresh token please pass the following:
80
+
81
+ ```ruby
82
+ provider :gplus, ENV['GPLUS_KEY'], ENV['GPLUS_SECRET'], scope: 'plus.login', request_visible_actions: 'AddActivity,BuyActivity', access_type: 'offline'
83
+ ```
58
84
 
59
85
  The information schema looks like this:
60
86
 
@@ -82,56 +108,15 @@ extra do
82
108
  end
83
109
  ```
84
110
 
85
-
86
- Installing
87
- ----------
88
-
89
- **Requirements**:
90
-
91
- 1. Ruby 2.1, 2.0, 1.9 OR Rubinius 1.9 OR JRuby 1.9
92
- 2. A GPlus API key/secret
93
-
94
- You can either install manually:
95
-
96
- ``` bash
97
- $ gem install omniauth-gplus
98
- ```
99
-
100
- Or put it in your `Gemfile`:
101
-
102
- ``` ruby
103
- source 'https://rubygems.org'
104
-
105
- gem 'omniauth-gplus', '~> 2.0'
106
- ```
107
-
108
-
109
- Issues & Documentation
110
- ----------------------
111
-
112
- * [Documentation](https://github.com/samdunne/omniauth-gplus/wiki)
113
- * [Issues](https://github.com/samdunne/omniauth-gplus/issues)
114
-
115
- Absolutely feel free to contribute, please!
116
-
117
-
118
- Contributing
119
- ------------
120
-
121
- * **Fork** the repository
122
- * **Clone the repository** locally, or **edit via Github**
123
- * Create a **new branch** using the [Git Flow Standard](http://yakiloo.com/getting-started-git-flow/) conventions
124
- * Commit **often** and **when important**
125
- * **DO NOT CHANGE** ANY OF THESE (without making a new branch for *that* change):
126
- * `*.gemspec`
127
- * `Rakefile`
128
- * `.ruby-version`
129
- * `.ruby-gemset`
130
- * `.gitignore`
131
- * Any part of the git history
132
- * **Write tests** specifically for the changes you've made, if no test exist
133
- * **Push** your feature or hotfix branch to Github.
134
- * Make a **Pull Request**
111
+ Supported Rubies
112
+ ----------------
113
+ Actively tested with the following Ruby versions:
114
+ - MRI 2.1.0
115
+ - MRI 2.0.0
116
+ - MRI 1.9.3
117
+ - MRI 1.9.2
118
+ - JRuby 1.7.9
119
+ - Rubinius (latest stable)
135
120
 
136
121
 
137
122
  License
data/Rakefile CHANGED
@@ -8,24 +8,31 @@ begin
8
8
  Bundler.setup :default, :development
9
9
  rescue Bundler::BundlerError => error
10
10
  $stderr.puts error.message
11
- $stderr.puts "Run `bundle install` to install missing gems"
11
+ $stderr.puts 'Run `bundle install` to install missing gems.'
12
12
  exit error.status_code
13
13
  end
14
14
 
15
15
  Bundler::GemHelper.install_tasks
16
16
 
17
- desc "Run all of the tests"
17
+ desc 'Run all of the tests'
18
18
  Rake::TestTask.new do |config|
19
19
  config.libs << 'test'
20
20
  config.pattern = 'test/**/*_test*'
21
- # config.verbose = true
22
- # config.warning = true
23
21
  end
24
22
 
25
- desc "Generate all of the docs"
23
+ desc 'Generate all of the docs'
26
24
  YARD::Rake::YardocTask.new do |config|
27
25
  config.files = Dir['lib/**/*.rb']
28
26
  end
29
27
 
28
+ begin
29
+ require 'rubocop/rake_task'
30
+ Rubocop::RakeTask.new
31
+ rescue LoadError
32
+ task :rubocop do
33
+ $stderr.puts 'Rubocop is disabled'
34
+ end
35
+ end
36
+
30
37
  desc 'Default: run tests, and generate docs'
31
- task :default => [ :test, :yard ]
38
+ task :default => [:test, :yard, :rubocop]
@@ -1,5 +1,2 @@
1
- require "omniauth-oauth2"
2
- require_relative "omniauth/strategies/gplus"
3
- require_relative "omniauth/gplus/version"
4
-
5
- OmniAuth.config.add_camelization("gplus", "GPlus")
1
+ require 'omniauth/gplus'
2
+ OmniAuth.config.add_camelization('gplus', 'GPlus')
@@ -0,0 +1,2 @@
1
+ require 'omniauth/gplus/version'
2
+ require 'omniauth/strategies/gplus'
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module GPlus
3
- VERSION = "2.0.0.beta1"
3
+ VERSION = '2.0.0.beta2'
4
4
  end
5
5
  end
@@ -1,11 +1,15 @@
1
+ require 'omniauth/strategies/oauth2'
2
+
1
3
  module OmniAuth
2
4
  module Strategies
3
- class GPlus < OAuth2
4
- option :client_options, {
5
- site: 'https://www.googleapis.com/oauth2/v1',
6
- authorize_url: 'https://www.google.com/accounts/o8/oauth2/authorization',
7
- token_url: 'https://www.google.com/accounts/o8/oauth2/token'
8
- }
5
+ class GPlus < OmniAuth::Strategies::OAuth2
6
+ class NoAuthorizationCodeError < StandardError; end
7
+ class UnknownSignatureAlgorithmError < NotImplementedError; end
8
+
9
+ option :client_options,
10
+ :site => 'https://www.googleapis.com/oauth2/v1',
11
+ :authorize_url => 'https://www.google.com/accounts/o8/oauth2/authorization',
12
+ :token_url => 'https://www.google.com/accounts/o8/oauth2/token'
9
13
 
10
14
  option :authorize_options, [:scope, :request_visible_actions]
11
15
 
@@ -15,9 +19,7 @@ module OmniAuth
15
19
 
16
20
  option :uid_field, :uid
17
21
 
18
- uid do
19
- raw_info['id']
20
- end
22
+ uid { raw_info['id'] }
21
23
 
22
24
  info do
23
25
  {
@@ -27,7 +29,7 @@ module OmniAuth
27
29
  'last_name' => raw_info['family_name'],
28
30
  'image' => raw_info['picture'],
29
31
  'urls' => {
30
- "Google+" => raw_info['link']
32
+ 'Google+' => raw_info['link']
31
33
  }
32
34
  }
33
35
  end
@@ -44,9 +46,7 @@ module OmniAuth
44
46
  def authorize_params
45
47
  super.tap do |params|
46
48
  params['scope'] = format_scopes(params['scope'])
47
- if (params['request_visible_actions'])
48
- params['request_visible_actions'] = format_actions(params['request_visible_actions'])
49
- end
49
+ params['request_visible_actions'] = format_actions(params['request_visible_actions']) if params['request_visible_actions']
50
50
  custom_parameters(params)
51
51
  end
52
52
  end
@@ -54,7 +54,7 @@ module OmniAuth
54
54
  private
55
55
 
56
56
  def format_actions(actions)
57
- actions.split(/,\s*/).map(&method(:format_action)).join(" ")
57
+ actions.split(/,\s*/).collect(&method(:format_action)).join(' ')
58
58
  end
59
59
 
60
60
  def format_action(action)
@@ -62,7 +62,7 @@ module OmniAuth
62
62
  end
63
63
 
64
64
  def format_scopes(scopes)
65
- scopes.split(/,\s*/).map(&method(:format_scope)).join(" ")
65
+ scopes.split(/,\s*/).collect(&method(:format_scope)).join(' ')
66
66
  end
67
67
 
68
68
  def format_scope(scope)
@@ -70,13 +70,11 @@ module OmniAuth
70
70
  end
71
71
 
72
72
  def custom_parameters(params)
73
- ["scope", "client_options", "request_visible_actions"].each { |k| add_key_to_params(params, k) }
73
+ %w(scope client_options request_visible_actions access_type).each { |k| add_key_to_params(params, k) }
74
74
  end
75
75
 
76
76
  def add_key_to_params(params, key)
77
- if request.params[key]
78
- params[key] = request.params[key]
79
- end
77
+ params[key] = request.params[key] if request.params[key]
80
78
  end
81
79
 
82
80
  def raw_info
@@ -1,34 +1,36 @@
1
- lib = File.expand_path('../lib', __FILE__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
1
+ # -*- encoding: utf-8 -*-
2
+ $LOAD_PATH.push File.expand_path('../lib', __FILE__)
3
3
  require 'omniauth/gplus/version'
4
4
 
5
- Gem::Specification.new do |spec|
6
- spec.name = "omniauth-gplus"
7
- spec.version = OmniAuth::GPlus::VERSION
8
- spec.authors = ["Kurtis Rainbolt-Greene", "Sam Dunne"]
9
- spec.email = ["me@kurtisrainboltgreene.name", "sam@sam-dunne.com"]
10
- spec.summary = %q{A Google+ OAuth2 solution for Omniauth}
11
- spec.description = spec.summary
12
- spec.homepage = "http://samdunne.github.com/omniauth-gplus"
13
- spec.license = "MIT"
5
+ Gem::Specification.new do |s|
6
+ s.name = 'omniauth-gplus'
7
+ s.version = OmniAuth::GPlus::VERSION
8
+ s.authors = %w(Sam Dunne Kurtis Rainbolt-Greene )
9
+ s.email = %w(sam@sam-dunne.com me@kurtisrainboltgreene.name)
10
+ s.summary = 'A Google+ OAuth2 solution for Omniauth'
11
+ s.description = s.summary
12
+ s.homepage = 'http://samdunne.github.com/omniauth-gplus'
13
+ s.license = 'MIT'
14
14
 
15
- spec.files = `git ls-files`.split($/)
16
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
- spec.require_paths = ["lib"]
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.executables = `git ls-files -- bin/*`.split("\n").collect { |f| File.basename(f) }
18
+ s.require_paths = ['lib']
19
19
 
20
- spec.add_runtime_dependency "omniauth-oauth2", '~> 1.1'
21
- spec.add_development_dependency "bundler"
22
- spec.add_development_dependency "rake"
23
- spec.add_development_dependency "mocha"
24
- spec.add_development_dependency 'yard'
25
- spec.add_development_dependency 'kramdown'
26
- spec.add_development_dependency 'pry'
27
- spec.add_development_dependency 'coveralls'
20
+ s.add_runtime_dependency 'omniauth-oauth2', '~> 1.1'
21
+
22
+ s.add_development_dependency 'bundler'
23
+ s.add_development_dependency 'rake'
24
+ s.add_development_dependency 'mocha'
25
+ s.add_development_dependency 'yard'
26
+ s.add_development_dependency 'kramdown'
27
+ s.add_development_dependency 'pry'
28
+ s.add_development_dependency 'coveralls'
29
+ s.add_development_dependency 'rubocop'
28
30
 
29
31
  if RUBY_PLATFORM == 'rbx'
30
- spec.add_development_dependency 'racc'
31
- spec.add_development_dependency 'rubinius-coverage', github: 'rubinius/rubinius-coverage'
32
- spec.add_development_dependency 'rubysl'
32
+ s.add_development_dependency 'racc'
33
+ s.add_development_dependency 'rubinius-coverage', :github => 'rubinius/rubinius-coverage'
34
+ s.add_development_dependency 'rubysl'
33
35
  end
34
36
  end
data/rubocop-todo.yml ADDED
@@ -0,0 +1,40 @@
1
+ # This configuration was generated by `rubocop --auto-gen-config`
2
+ # on 2014-05-11 15:31:15 +0100 using RuboCop version 0.21.0.
3
+ # The point is for the user to remove these configuration records
4
+ # one by one as the offenses are removed from the code base.
5
+ # Note that changes in the inspected code, or installation of new
6
+ # versions of RuboCop, may require this file to be generated again.
7
+
8
+ # Offense count: 1
9
+ Documentation:
10
+ Enabled: true
11
+
12
+ # Offense count: 1
13
+ # Configuration parameters: Exclude.
14
+ FileName:
15
+ Enabled: true
16
+
17
+ # Offense count: 1
18
+ LineLength:
19
+ Max: 120
20
+
21
+ # Offense count: 1
22
+ # Cop supports --auto-correct.
23
+ # Configuration parameters: PreferredDelimiters.
24
+ PercentLiteralDelimiters:
25
+ Enabled: false
26
+
27
+ # Offense count: 2
28
+ RegexpLiteral:
29
+ MaxSlashes: 0
30
+
31
+ # Offense count: 1
32
+ # Cop supports --auto-correct.
33
+ SpecialGlobalVars:
34
+ Enabled: false
35
+
36
+ # Offense count: 17
37
+ # Cop supports --auto-correct.
38
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
39
+ StringLiterals:
40
+ Enabled: true
data/test/helper.rb CHANGED
@@ -3,12 +3,12 @@ Coveralls.wear!
3
3
 
4
4
  require 'omniauth-gplus'
5
5
  require 'minitest/autorun'
6
- require 'minitest/pride'
6
+ # require 'minitest/pride'
7
7
 
8
8
  OmniAuth.config.test_mode = true
9
9
 
10
10
  def application
11
- ->(env) { [200, {}, ["Hello World."]]}
11
+ ->(_env) { [200, {}, ['Hello World.']] }
12
12
  end
13
13
 
14
14
  def strategy
@@ -1,6 +1,7 @@
1
1
  require 'helper'
2
2
  require 'mocha/setup'
3
3
 
4
+ # Test class for omniauth-gplus
4
5
  class TestOmniAuthGPlus < MiniTest::Unit::TestCase
5
6
  def setup
6
7
  @request = mock('Request')
@@ -44,13 +45,13 @@ class TestOmniAuthGPlus < MiniTest::Unit::TestCase
44
45
 
45
46
  def test_state_state_is_not_included_in_request_params_when_present
46
47
  expected = 'some_state'
47
- @request.stubs(:params).returns({ 'state' => expected })
48
+ @request.stubs(:params).returns('state' => expected)
48
49
  refute_equal expected, strategy.authorize_params[:state]
49
50
  end
50
51
 
51
52
  def test_do_not_store_state_in_the_session_when_present
52
53
  expected = 'some_state'
53
- @request.stubs(:params).returns({ 'state' => expected })
54
+ @request.stubs(:params).returns('state' => expected)
54
55
  refute_empty strategy.authorize_params['state']
55
56
  refute_equal expected, strategy.authorize_params[:state]
56
57
  refute_empty strategy.session['omniauth.state']
metadata CHANGED
@@ -1,15 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-gplus
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.beta1
4
+ version: 2.0.0.beta2
5
5
  platform: ruby
6
6
  authors:
7
- - Kurtis Rainbolt-Greene
8
- - Sam Dunne
7
+ - Sam
8
+ - Dunne
9
+ - Kurtis
10
+ - Rainbolt-Greene
9
11
  autorequire:
10
12
  bindir: bin
11
13
  cert_chain: []
12
- date: 2014-05-11 00:00:00.000000000 Z
14
+ date: 2014-05-12 00:00:00.000000000 Z
13
15
  dependencies:
14
16
  - !ruby/object:Gem::Dependency
15
17
  name: omniauth-oauth2
@@ -123,16 +125,32 @@ dependencies:
123
125
  - - '>='
124
126
  - !ruby/object:Gem::Version
125
127
  version: '0'
128
+ - !ruby/object:Gem::Dependency
129
+ name: rubocop
130
+ requirement: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - '>='
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ type: :development
136
+ prerelease: false
137
+ version_requirements: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
126
142
  description: A Google+ OAuth2 solution for Omniauth
127
143
  email:
128
- - me@kurtisrainboltgreene.name
129
144
  - sam@sam-dunne.com
145
+ - me@kurtisrainboltgreene.name
130
146
  executables: []
131
147
  extensions: []
132
148
  extra_rdoc_files: []
133
149
  files:
134
150
  - .coveralls.yml
135
151
  - .gitignore
152
+ - .rubocop.yml
153
+ - .rubocop_todo.yml
136
154
  - .ruby-gemset
137
155
  - .ruby-version
138
156
  - .travis.yml
@@ -142,9 +160,11 @@ files:
142
160
  - README.md
143
161
  - Rakefile
144
162
  - lib/omniauth-gplus.rb
163
+ - lib/omniauth/gplus.rb
145
164
  - lib/omniauth/gplus/version.rb
146
165
  - lib/omniauth/strategies/gplus.rb
147
166
  - omniauth-gplus.gemspec
167
+ - rubocop-todo.yml
148
168
  - test/helper.rb
149
169
  - test/lib/omniauth/strategies/gplus_test.rb
150
170
  homepage: http://samdunne.github.com/omniauth-gplus