omniauth-bike-index 0.1.0 → 1.0.0
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 +4 -4
- data/.travis.yml +5 -8
- data/Gemfile +1 -4
- data/README.md +6 -7
- data/Rakefile +4 -1
- data/lib/omniauth/bike_index/version.rb +1 -1
- data/lib/omniauth/strategies/bike_index.rb +3 -7
- data/spec/app.rb +1 -1
- data/spec/omniauth/strategies/bike_index_spec.rb +0 -1
- metadata +3 -4
- data/Guardfile +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1c9a5e41e30b52036f65770a0890439ad29b4fe
|
4
|
+
data.tar.gz: 0e557a7f410e21be8f3cabea92ac204acfa3737b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e83173b9ff0486ff302aef7069ef7314658e1dd94b2c7ca24954eb25ad5ca01d84d84813abc0c9f042bca123fccc80266b81b8c537a477ed1f53b68dea13400d
|
7
|
+
data.tar.gz: 0fa877dfc49dee02e22b4fa77b4d55c1c9b6c70d3c7d71125628d6fc8cc97118f5ce6b76e5aeaa5f1f00fad96f4e6aa0522b78ae058789214f5b77f558af4964
|
data/.travis.yml
CHANGED
@@ -2,16 +2,13 @@ bundler_args: --without development
|
|
2
2
|
gemfile:
|
3
3
|
- Gemfile
|
4
4
|
language: ruby
|
5
|
+
before_install:
|
6
|
+
- gem install bundler
|
7
|
+
- gem update bundler
|
5
8
|
rvm:
|
6
|
-
-
|
7
|
-
-
|
8
|
-
- 2.0.0
|
9
|
-
- 2.1.0
|
10
|
-
- rbx-2
|
11
|
-
- ruby-head
|
12
|
-
- jruby-19mode
|
9
|
+
- 2.2.4
|
10
|
+
- 2.3.0
|
13
11
|
- jruby-head
|
14
12
|
matrix:
|
15
13
|
allow_failures:
|
16
14
|
- rvm: jruby-head
|
17
|
-
- rvm: ruby-head
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
OmniAuth::BikeIndex
|
1
|
+
# OmniAuth::BikeIndex [](https://travis-ci.org/bikeindex/omniauth-bike-index)
|
2
2
|
==============
|
3
3
|
|
4
4
|
Bike Index OAuth2 Strategy for OmniAuth 1.0.
|
@@ -15,7 +15,7 @@ Once you've added your application and your routes, you'll be able to see your A
|
|
15
15
|
**Note**: Callback url has to be an exact match - if your url is `http://localhost:3001/users/auth/bike_index/callback` you _must_ enter that exactly - `http://localhost:3001/users/auth/` will not work.
|
16
16
|
|
17
17
|
|
18
|
-
Check out **[API
|
18
|
+
Check out the **[Bike Index API Documentation](https://bikeindex.org/documentation)** to see what can be done with authenticated users.
|
19
19
|
|
20
20
|
## Usage
|
21
21
|
|
@@ -36,17 +36,16 @@ Your `BIKEINDEX_APP_ID` and your `BIKEINDEX_APP_SECRET` are both application spe
|
|
36
36
|
|
37
37
|
Edit your routes.rb file to have:
|
38
38
|
|
39
|
-
`devise_for :users, :
|
39
|
+
`devise_for :users, controllers: { omniauth_callbacks: 'omniauth_callbacks' }`
|
40
40
|
|
41
41
|
And create a file called `omniauth_callbacks_controller.rb` which should have this inside:
|
42
42
|
|
43
43
|
```ruby
|
44
44
|
class OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
45
|
-
|
46
45
|
def bike_index
|
47
46
|
# Delete the code inside of this method and write your own.
|
48
47
|
# The code below is to show you where to access the data.
|
49
|
-
raise request.env[
|
48
|
+
raise request.env['omniauth.auth'].to_json
|
50
49
|
end
|
51
50
|
end
|
52
51
|
```
|
@@ -70,7 +69,7 @@ If you don't include a scope, the response will include a `uid` from Bike Index
|
|
70
69
|
|
71
70
|
If you include the `read_bikes` scope, the response will include an array of the ids the user has registered on the Index `bike_ids: [3414, 29367]`
|
72
71
|
|
73
|
-
You can use these IDs to access information about the bikes - e.g. [
|
72
|
+
You can use these IDs to access information about the bikes - e.g. [api/v3/bikes/3414](https://bikeindex.org/api/v3/bikes/3414) & [api/v3/bikes/29367](https://bikeindex.org/api/v3/bikes/29367)
|
74
73
|
|
75
74
|
If you include the `read_user` scope, the response will include the user's nickname, email and name. You will also see their twitter handle and avatar if they have added them. The keys for these items -
|
76
75
|
`nickname`, `email`, `name`, `twitter` & `image` - all accessible in the `request.env['omniauth.auth']`, e.g. `request.env['omniauth.auth'].info.email`
|
@@ -78,5 +77,5 @@ If you include the `read_user` scope, the response will include the user's nickn
|
|
78
77
|
|
79
78
|
## Auth Hash
|
80
79
|
|
81
|
-
You can also see the authetication hash (in JSON format) by going to the authentication url on the Bike Index with the user's access token - `https://bikeindex.org/api/
|
80
|
+
You can also see the authetication hash (in JSON format) by going to the authentication url on the Bike Index with the user's access token - `https://bikeindex.org/api/v3/me?access_token=<OAUTH_ACCESS_TOKEN>`
|
82
81
|
|
data/Rakefile
CHANGED
@@ -5,8 +5,7 @@ module OmniAuth
|
|
5
5
|
class BikeIndex < OmniAuth::Strategies::OAuth2
|
6
6
|
option :name, :bike_index
|
7
7
|
DEFAULT_SCOPE = 'public'
|
8
|
-
option :client_options, :
|
9
|
-
:authorize_url => '/oauth/authorize'
|
8
|
+
option :client_options, site: 'https://bikeindex.org', authorize_url: '/oauth/authorize'
|
10
9
|
|
11
10
|
uid { raw_info['id'] }
|
12
11
|
|
@@ -28,14 +27,11 @@ module OmniAuth
|
|
28
27
|
end
|
29
28
|
|
30
29
|
def raw_info
|
31
|
-
@raw_info ||= access_token.get('/api/
|
30
|
+
@raw_info ||= access_token.get('/api/v3/me').parsed || {}
|
32
31
|
end
|
33
32
|
|
34
33
|
def request_phase
|
35
|
-
options[:authorize_params] = {
|
36
|
-
:scope => (options['scope'] || DEFAULT_SCOPE)
|
37
|
-
}
|
38
|
-
|
34
|
+
options[:authorize_params] = { scope: (options['scope'] || DEFAULT_SCOPE) }
|
39
35
|
super
|
40
36
|
end
|
41
37
|
|
data/spec/app.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-bike-index
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seth Herr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth
|
@@ -76,7 +76,6 @@ files:
|
|
76
76
|
- ".gitignore"
|
77
77
|
- ".travis.yml"
|
78
78
|
- Gemfile
|
79
|
-
- Guardfile
|
80
79
|
- README.md
|
81
80
|
- Rakefile
|
82
81
|
- lib/omniauth-bike-index.rb
|
@@ -106,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
105
|
version: '0'
|
107
106
|
requirements: []
|
108
107
|
rubyforge_project:
|
109
|
-
rubygems_version: 2.4.
|
108
|
+
rubygems_version: 2.4.8
|
110
109
|
signing_key:
|
111
110
|
specification_version: 4
|
112
111
|
summary: Bike Index strategy for OmniAuth
|