oauth_adapter 0.1.0 → 0.2.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 +2 -1
- data/Gemfile +3 -0
- data/README.md +41 -7
- data/lib/oauth_adapter/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a616dacd4ddabc39d77c6cb848d41f04f5618d24
|
4
|
+
data.tar.gz: 7ebca80ec8210f673428f682ea5b8822201483d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cc6a67f90ce6cf5414e479b5e0696c12395ea1529e5ada5d55f38c1d8f74998a693123b1509b3337918a5d02b7ded2106051d80813b36a17f258764d4ccba56
|
7
|
+
data.tar.gz: f3181d27a5bb008f87dc8d5ee52b38936e5834bba2127d0b39aba038be37cd882e306fc39360865dec56e105d4997bdd02f3c282d384aa36f6f481e610aa7e03
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
-
#
|
1
|
+
# OAuthAdapter
|
2
2
|
|
3
|
-
|
3
|
+
[](https://travis-ci.org/sinsoku/oauth_adapter)
|
4
|
+
[](https://codecov.io/gh/sinsoku/oauth_adapter)
|
4
5
|
|
5
|
-
|
6
|
+
It provides a simple method to use the OAuth libraries.
|
6
7
|
|
7
8
|
## Installation
|
8
9
|
|
@@ -16,13 +17,46 @@ And then execute:
|
|
16
17
|
|
17
18
|
$ bundle
|
18
19
|
|
19
|
-
|
20
|
+
## Configuration
|
20
21
|
|
21
|
-
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
OAuthAdapter.configure do
|
25
|
+
provider :twitter, ENV['TWITTER_KEY'], ENV['TWITTER_SECRET'], 'https://api.twitter.com'
|
26
|
+
provider :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET'], 'https://api.github.com'
|
27
|
+
end
|
28
|
+
```
|
29
|
+
|
30
|
+
### OmniAuth Support
|
31
|
+
|
32
|
+
If you use with [intridea/omniauth](https://github.com/intridea/omniauth), you may omit the configuration by requiring 'oauth_adapter/omniauth'. This is an example at `config/initializers/omniauth.rb`:
|
33
|
+
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
require 'oauth_adapter/omniauth'
|
37
|
+
|
38
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
39
|
+
provider :developer unless Rails.env.production?
|
40
|
+
provider :twitter, ENV['TWITTER_KEY'], ENV['TWITTER_SECRET']
|
41
|
+
provider :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET']
|
42
|
+
end
|
43
|
+
```
|
22
44
|
|
23
45
|
## Usage
|
24
46
|
|
25
|
-
|
47
|
+
You will get either appropriate object of OAuth or OAuth2.
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
OAuthAdapter.get_access_token(provider: :github, token: '<access_token>')
|
51
|
+
#=> #<OAuth2::AccessToken:0x007f9d763e5b50...
|
52
|
+
OAuthAdapter.get_access_token(provider: :twitter, token: '<access_token>', secret: '<token_secret>')
|
53
|
+
#=> #<OAuth::AccessToken:0x007f9d763d5430...
|
54
|
+
```
|
55
|
+
|
56
|
+
If you want to know how to use the `AccessToken` object, you should read to the documentation for each libraries.
|
57
|
+
|
58
|
+
- [oauth-xx/oauth](https://github.com/oauth-xx/oauth-ruby)
|
59
|
+
- [intridea/oauth2](https://github.com/intridea/oauth2).
|
26
60
|
|
27
61
|
## Development
|
28
62
|
|
@@ -32,7 +66,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
66
|
|
33
67
|
## Contributing
|
34
68
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
69
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/sinsoku/oauth_adapter. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
70
|
|
37
71
|
|
38
72
|
## License
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oauth_adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sinsoku
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oauth
|