omniauth-uber 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop-https---raw-githubusercontent-com-tmilewski-rubocop-defaults-master-rubocop-yml +58 -0
- data/.rubocop.yml +5 -80
- data/.travis.yml +10 -10
- data/Gemfile +4 -4
- data/README.md +29 -10
- data/Rakefile +2 -2
- data/lib/omniauth/strategies/uber.rb +13 -13
- data/lib/omniauth/uber/version.rb +1 -1
- data/omniauth-uber.gemspec +3 -2
- data/spec/app.rb +2 -2
- data/spec/omniauth/strategies/uber_spec.rb +2 -1
- data/spec/spec_helper.rb +1 -1
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2115b8f7ca794091028aea53c1a0eb2f212a5107
|
4
|
+
data.tar.gz: febdd4eee0a60f5f7e9b64f47eaf3f6c00dc6bf1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e94401be58e4ebe82bcb493c043ae968bf882b2a96dbddb53de1cb2f416ff5bc8a617e8d7780cb755a1cfec9c0e4195c261154cd45da8a9fe5bb0ff709b69e2
|
7
|
+
data.tar.gz: bea9bf156f8b5d503cec1985de66501af6b4a8536c83a23e51619966a888bf600578a2ee8c5bffcfccc5bf6ec9c4698cfbb9de2a316d0f28f99abf88528b8fe0
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# see https://github.com/bbatsov/rubocop/blob/master/config/default.yml
|
2
|
+
# for default configuration
|
3
|
+
|
4
|
+
AllCops:
|
5
|
+
TargetRubyVersion: 2.4
|
6
|
+
DisplayCopNames: true
|
7
|
+
Exclude:
|
8
|
+
- 'db/schema.rb'
|
9
|
+
- 'bin/*'
|
10
|
+
- 'vendor/**/*'
|
11
|
+
|
12
|
+
Rails:
|
13
|
+
Enabled: true
|
14
|
+
|
15
|
+
Documentation:
|
16
|
+
Enabled: false
|
17
|
+
|
18
|
+
Metrics/LineLength:
|
19
|
+
Max: 125
|
20
|
+
Exclude:
|
21
|
+
- 'db/migrate/*'
|
22
|
+
- 'config/initializers/devise.rb'
|
23
|
+
|
24
|
+
Metrics/MethodLength:
|
25
|
+
CountComments: false
|
26
|
+
Max: 10
|
27
|
+
Exclude:
|
28
|
+
- 'db/migrate/*'
|
29
|
+
|
30
|
+
Metrics/ModuleLength:
|
31
|
+
CountComments: false
|
32
|
+
Max: 100
|
33
|
+
|
34
|
+
Metrics/AbcSize:
|
35
|
+
# The ABC size is a calculated magnitude, so this number can be a Fixnum or a Float.
|
36
|
+
# http://c2.com/cgi/wiki?AbcMetric
|
37
|
+
Max: 15
|
38
|
+
|
39
|
+
Metrics/CyclomaticComplexity:
|
40
|
+
# http://www.rubydoc.info/github/bbatsov/rubocop/Rubocop/Cop/Style/CyclomaticComplexity
|
41
|
+
Max: 6
|
42
|
+
|
43
|
+
Metrics/PerceivedComplexity:
|
44
|
+
# http://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Metrics/PerceivedComplexity
|
45
|
+
Max: 7
|
46
|
+
|
47
|
+
Metrics/ClassLength:
|
48
|
+
CountComments: false
|
49
|
+
Max: 100
|
50
|
+
|
51
|
+
Style/MultilineMethodCallIndentation:
|
52
|
+
EnforcedStyle: indented
|
53
|
+
|
54
|
+
Style/FrozenStringLiteralComment:
|
55
|
+
Enabled: false
|
56
|
+
|
57
|
+
Style/ClassAndModuleChildren:
|
58
|
+
Enabled: false
|
data/.rubocop.yml
CHANGED
@@ -1,84 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
- 'Gemfile'
|
4
|
-
- 'Rakefile'
|
5
|
-
- 'omniauth-venmo.gemspec'
|
6
|
-
Exclude:
|
7
|
-
- 'lib/omniauth-venmo.rb'
|
8
|
-
|
9
|
-
# Avoid long parameter lists
|
10
|
-
ParameterLists:
|
11
|
-
Max: 4
|
12
|
-
CountKeywordArgs: true
|
13
|
-
|
14
|
-
MethodLength:
|
15
|
-
CountComments: false
|
16
|
-
Max: 14
|
17
|
-
|
18
|
-
# Avoid more than `Max` levels of nesting.
|
19
|
-
BlockNesting:
|
20
|
-
Max: 2
|
21
|
-
|
22
|
-
# Align with the style guide.
|
23
|
-
CollectionMethods:
|
24
|
-
PreferredMethods:
|
25
|
-
map: 'collect'
|
26
|
-
reduce: 'inject'
|
27
|
-
find: 'detect'
|
28
|
-
find_all: 'select'
|
29
|
-
|
30
|
-
# Limit line length
|
31
|
-
LineLength:
|
32
|
-
Enabled: false
|
33
|
-
|
34
|
-
# Disable documentation checking until a class needs to be documented once
|
35
|
-
Documentation:
|
36
|
-
Enabled: false
|
37
|
-
|
38
|
-
# Enforce Ruby 1.8-compatible hash syntax
|
39
|
-
HashSyntax:
|
40
|
-
EnforcedStyle: hash_rockets
|
41
|
-
|
42
|
-
# No spaces inside hash literals
|
43
|
-
SpaceInsideHashLiteralBraces:
|
44
|
-
EnforcedStyle: no_space
|
45
|
-
|
46
|
-
# Allow dots at the end of lines
|
47
|
-
DotPosition:
|
48
|
-
Enabled: false
|
1
|
+
inherit_from:
|
2
|
+
- https://raw.githubusercontent.com/tmilewski/rubocop-defaults/master/rubocop.yml
|
49
3
|
|
50
|
-
|
51
|
-
Encoding:
|
52
|
-
Enabled: false
|
53
|
-
|
54
|
-
# Enforce outdenting of access modifiers (i.e. public, private, protected)
|
55
|
-
AccessModifierIndentation:
|
56
|
-
EnforcedStyle: outdent
|
57
|
-
|
58
|
-
EmptyLinesAroundAccessModifier:
|
59
|
-
Enabled: true
|
60
|
-
|
61
|
-
# Align ends correctly
|
62
|
-
EndAlignment:
|
63
|
-
AlignWith: variable
|
64
|
-
|
65
|
-
# Indentation of when/else
|
66
|
-
CaseIndentation:
|
67
|
-
IndentWhenRelativeTo: end
|
68
|
-
IndentOneStep: false
|
69
|
-
|
70
|
-
Lambda:
|
71
|
-
Enabled: false
|
72
|
-
|
73
|
-
HandleExceptions:
|
74
|
-
Enabled: false
|
75
|
-
|
76
|
-
RaiseArgs:
|
77
|
-
EnforcedStyle: compact
|
78
|
-
|
79
|
-
TrailingComma:
|
4
|
+
Style/FileName:
|
80
5
|
Enabled: false
|
81
6
|
|
82
|
-
|
7
|
+
AllCops:
|
83
8
|
Exclude:
|
84
|
-
- '
|
9
|
+
- 'tmp/**/*'
|
data/.travis.yml
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
bundler_args: --without development
|
2
|
-
|
3
|
-
|
2
|
+
before_install: gem update bundler
|
3
|
+
cache: bundler
|
4
|
+
env:
|
5
|
+
global:
|
6
|
+
- JRUBY_OPTS="$JRUBY_OPTS --debug"
|
4
7
|
language: ruby
|
5
8
|
rvm:
|
6
|
-
-
|
7
|
-
-
|
8
|
-
- 2.
|
9
|
-
- 2.1.0
|
10
|
-
- rbx-2
|
9
|
+
- 2.2.6
|
10
|
+
- 2.3.3
|
11
|
+
- 2.4.1
|
11
12
|
- ruby-head
|
12
|
-
- jruby-19mode
|
13
|
-
- jruby-head
|
14
13
|
matrix:
|
15
14
|
allow_failures:
|
16
|
-
- rvm: jruby-head
|
17
15
|
- rvm: ruby-head
|
16
|
+
fast_finish: true
|
17
|
+
sudo: false
|
data/Gemfile
CHANGED
@@ -3,14 +3,14 @@ source 'https://rubygems.org'
|
|
3
3
|
gem 'rake'
|
4
4
|
|
5
5
|
group :development do
|
6
|
-
gem 'rubocop'
|
6
|
+
gem 'rubocop', '>= 0.48.1'
|
7
7
|
end
|
8
8
|
|
9
9
|
group :test do
|
10
|
-
gem 'coveralls', :
|
10
|
+
gem 'coveralls', require: false
|
11
11
|
gem 'rack-test'
|
12
|
-
gem 'rspec', '~>
|
13
|
-
gem 'simplecov', :
|
12
|
+
gem 'rspec', '~> 3.6.0'
|
13
|
+
gem 'simplecov', require: false
|
14
14
|
end
|
15
15
|
|
16
16
|
gemspec
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
omniauth-uber
|
2
2
|
==============
|
3
3
|
|
4
|
-
[![Gem Version](https://badge.fury.io/rb/omniauth-uber.
|
5
|
-
[![Build Status](https://travis-ci.org/
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/omniauth-uber.svg)](http://badge.fury.io/rb/omniauth-uber)
|
5
|
+
[![Build Status](https://travis-ci.org/omniauth/omniauth-uber.svg?branch=master)](https://travis-ci.org/omniauth/omniauth-uber)
|
6
6
|
|
7
7
|
Uber OAuth2 Strategy for OmniAuth 1.x and supports the OAuth 2.0 server-side flow.
|
8
8
|
|
@@ -21,7 +21,7 @@ Then `bundle install`.
|
|
21
21
|
|
22
22
|
## Usage
|
23
23
|
|
24
|
-
`OmniAuth::Strategies::Uber` is simply
|
24
|
+
`OmniAuth::Strategies::Uber` is simply Rack middleware. Read the OmniAuth 1.0 docs for detailed instructions: https://github.com/intridea/omniauth.
|
25
25
|
|
26
26
|
Here's a quick example, adding the middleware to a Rails app in `config/initializers/omniauth.rb`:
|
27
27
|
|
@@ -35,14 +35,20 @@ end
|
|
35
35
|
|
36
36
|
Currently, there is only one configuration option that needs to be set:
|
37
37
|
|
38
|
-
* `scope`: A comma-separated list of permissions you want to request from the user. The available permissions are as follows: `
|
38
|
+
* `scope`: A comma-separated list of permissions you want to request from the user. The available permissions are as follows: `profile`, `history`. Default: `profile`
|
39
39
|
|
40
40
|
```ruby
|
41
41
|
Rails.application.config.middleware.use OmniAuth::Builder do
|
42
42
|
provider :uber, ENV['UBER_CLIENT_ID'], ENV['UBER_CLIENT_SECRET'], :scope => 'profile,history'
|
43
43
|
end
|
44
|
+
|
44
45
|
```
|
45
46
|
|
47
|
+
## Scope Details
|
48
|
+
|
49
|
+
* `profile`: Access the basic profile information on a user's Uber account including their first name, email address, and profile picture.
|
50
|
+
* `history`: Pull trip data including the locations, times, and product type of a user's historical pickups and drop-offs.
|
51
|
+
|
46
52
|
## Auth Hash
|
47
53
|
|
48
54
|
Here's an example *Auth Hash* available in `request.env['omniauth.auth']`:
|
@@ -50,20 +56,33 @@ Here's an example *Auth Hash* available in `request.env['omniauth.auth']`:
|
|
50
56
|
```ruby
|
51
57
|
{
|
52
58
|
:provider => 'uber',
|
53
|
-
:uid =>
|
54
|
-
:info => {
|
59
|
+
:uid => 'xxxxxx-yyyyy-zzzz-aaaa-bbbbbbbbbb',
|
60
|
+
:info => {
|
61
|
+
:email => 'foo@bar.com',
|
62
|
+
:first_name => 'Tom',
|
63
|
+
:last_name => 'Milewski',
|
64
|
+
:picture => 'https://d1w2poirtb3as9.cloudfront.net/default.jpeg',
|
65
|
+
:promo_code => 'xxxxx',
|
66
|
+
},
|
55
67
|
:credentials => {
|
56
68
|
:token => 'ABCDEF...',
|
69
|
+
:refresh_token => 'ABCDEF...',
|
57
70
|
:expires => true
|
58
71
|
},
|
59
|
-
:extra => {
|
72
|
+
:extra => {
|
73
|
+
:email => 'foo@bar.com',
|
74
|
+
:first_name => 'Tom',
|
75
|
+
:last_name => 'Milewski',
|
76
|
+
:picture => 'https://d1w2poirtb3as9.cloudfront.net/default.jpeg',
|
77
|
+
:promo_code => 'xxxxx',
|
78
|
+
:uuid => 'xxxxxx-yyyyy-zzzz-aaaa-bbbbbbbbbb'
|
60
79
|
}
|
61
80
|
}
|
62
81
|
```
|
63
82
|
|
64
83
|
## Supported Ruby Versions
|
65
|
-
`omniauth-uber` is tested under 1.
|
66
|
-
(
|
84
|
+
`omniauth-uber` is tested under 1.9.2, 1.9.3, 2.0.0, 2.1.0, MRI Ruby HEAD, JRuby (1.9 mode and HEAD), and Rubinius
|
85
|
+
(2.0 mode).
|
67
86
|
|
68
87
|
## Versioning
|
69
88
|
This library aims to adhere to [Semantic Versioning 2.0.0][semver]. Violations
|
@@ -83,7 +102,7 @@ Constraint][pvc] with two digits of precision. For example:
|
|
83
102
|
|
84
103
|
## License
|
85
104
|
|
86
|
-
Copyright (c)
|
105
|
+
Copyright (c) 2014 by Tom Milewski
|
87
106
|
|
88
107
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
89
108
|
|
data/Rakefile
CHANGED
@@ -3,7 +3,7 @@ require 'bundler/gem_tasks'
|
|
3
3
|
require 'rspec/core/rake_task'
|
4
4
|
RSpec::Core::RakeTask.new(:spec)
|
5
5
|
|
6
|
-
task :
|
6
|
+
task test: :spec
|
7
7
|
|
8
8
|
begin
|
9
9
|
require 'rubocop/rake_task'
|
@@ -14,4 +14,4 @@ rescue LoadError
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
task :
|
17
|
+
task default: %i[spec rubocop]
|
@@ -3,27 +3,27 @@ require 'omniauth-oauth2'
|
|
3
3
|
module OmniAuth
|
4
4
|
module Strategies
|
5
5
|
class Uber < OmniAuth::Strategies::OAuth2
|
6
|
-
DEFAULT_SCOPE = 'profile'
|
6
|
+
DEFAULT_SCOPE = 'profile'.freeze
|
7
7
|
|
8
|
-
option :client_options, :
|
9
|
-
:
|
10
|
-
:
|
8
|
+
option :client_options, site: 'https://api.uber.com',
|
9
|
+
authorize_url: 'https://login.uber.com/oauth/authorize',
|
10
|
+
token_url: 'https://login.uber.com/oauth/token'
|
11
11
|
|
12
12
|
uid { raw_info['uuid'] }
|
13
13
|
|
14
14
|
info do
|
15
15
|
{
|
16
|
-
:
|
17
|
-
:
|
18
|
-
:
|
19
|
-
:
|
20
|
-
:
|
16
|
+
first_name: raw_info['first_name'],
|
17
|
+
last_name: raw_info['last_name'],
|
18
|
+
email: raw_info['email'],
|
19
|
+
picture: raw_info['picture'],
|
20
|
+
promo_code: raw_info['promo_code']
|
21
21
|
}
|
22
22
|
end
|
23
23
|
|
24
24
|
extra do
|
25
25
|
{
|
26
|
-
:
|
26
|
+
raw_info: raw_info
|
27
27
|
}
|
28
28
|
end
|
29
29
|
|
@@ -33,9 +33,9 @@ module OmniAuth
|
|
33
33
|
|
34
34
|
def request_phase
|
35
35
|
options[:authorize_params] = {
|
36
|
-
:
|
37
|
-
:
|
38
|
-
:
|
36
|
+
client_id: options['client_id'],
|
37
|
+
response_type: 'code',
|
38
|
+
scopes: (options['scope'] || DEFAULT_SCOPE)
|
39
39
|
}
|
40
40
|
|
41
41
|
super
|
data/omniauth-uber.gemspec
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
|
2
3
|
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
|
3
4
|
require 'omniauth/uber/version'
|
4
5
|
|
@@ -20,6 +21,6 @@ Gem::Specification.new do |s|
|
|
20
21
|
s.add_runtime_dependency 'omniauth', '~> 1.2'
|
21
22
|
s.add_runtime_dependency 'omniauth-oauth2', '~> 1.1'
|
22
23
|
|
23
|
-
s.add_development_dependency 'dotenv', '
|
24
|
-
s.add_development_dependency 'sinatra', '
|
24
|
+
s.add_development_dependency 'dotenv', '>= 2.0'
|
25
|
+
s.add_development_dependency 'sinatra', '>= 2.0'
|
25
26
|
end
|
data/spec/app.rb
CHANGED
@@ -3,7 +3,8 @@ require 'spec_helper'
|
|
3
3
|
describe OmniAuth::Strategies::Uber do
|
4
4
|
subject do
|
5
5
|
@subject ||= begin
|
6
|
-
|
6
|
+
@options ||= {}
|
7
|
+
args = ['client_id', 'client_secret', @options].compact
|
7
8
|
OmniAuth::Strategies::Uber.new(*args)
|
8
9
|
end
|
9
10
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-uber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Milewski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth
|
@@ -42,30 +42,30 @@ dependencies:
|
|
42
42
|
name: dotenv
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
47
|
+
version: '2.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
|
-
version: '0'
|
54
|
+
version: '2.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: sinatra
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
61
|
+
version: '2.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
|
-
version: '0'
|
68
|
+
version: '2.0'
|
69
69
|
description: Uber strategy for OmniAuth v1.2
|
70
70
|
email:
|
71
71
|
- tmilewski@gmail.com
|
@@ -74,6 +74,7 @@ extensions: []
|
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
76
|
- ".gitignore"
|
77
|
+
- ".rubocop-https---raw-githubusercontent-com-tmilewski-rubocop-defaults-master-rubocop-yml"
|
77
78
|
- ".rubocop.yml"
|
78
79
|
- ".travis.yml"
|
79
80
|
- Gemfile
|
@@ -106,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
107
|
version: '0'
|
107
108
|
requirements: []
|
108
109
|
rubyforge_project:
|
109
|
-
rubygems_version: 2.
|
110
|
+
rubygems_version: 2.6.11
|
110
111
|
signing_key:
|
111
112
|
specification_version: 4
|
112
113
|
summary: Uber strategy for OmniAuth
|
@@ -114,4 +115,3 @@ test_files:
|
|
114
115
|
- spec/app.rb
|
115
116
|
- spec/omniauth/strategies/uber_spec.rb
|
116
117
|
- spec/spec_helper.rb
|
117
|
-
has_rdoc:
|