oauth_adapter 0.1.0 → 0.2.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: e9b5ea0cbc50581b20dc10c54ff7bfeaa9224521
4
- data.tar.gz: 1e1de253f26d6cfbb353740b25fb0af500fa6509
3
+ metadata.gz: a616dacd4ddabc39d77c6cb848d41f04f5618d24
4
+ data.tar.gz: 7ebca80ec8210f673428f682ea5b8822201483d1
5
5
  SHA512:
6
- metadata.gz: 4fafa28420da434b9c0087d728022ba3f95a1b247b2e0f31e6e36f84e32e0d72ddb7c7096a84602707cd7457a41051333bd3b8fce34c6de70f85a57eb5c9fbe1
7
- data.tar.gz: 634889ade29fc619c65b8bf6e913543a502ffd62728e4ae342117c6bd20d2ec90b6e96970c589d3063675e28cdcc1b8a5e0cc0e2ccbd555025858c02f9d299e0
6
+ metadata.gz: 2cc6a67f90ce6cf5414e479b5e0696c12395ea1529e5ada5d55f38c1d8f74998a693123b1509b3337918a5d02b7ded2106051d80813b36a17f258764d4ccba56
7
+ data.tar.gz: f3181d27a5bb008f87dc8d5ee52b38936e5834bba2127d0b39aba038be37cd882e306fc39360865dec56e105d4997bdd02f3c282d384aa36f6f481e610aa7e03
@@ -1,4 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 2.3.0
4
- before_install: gem install bundler -v 1.11.2
4
+ notifications:
5
+ email: false
data/Gemfile CHANGED
@@ -2,3 +2,6 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in oauth_adapter.gemspec
4
4
  gemspec
5
+
6
+ gem 'omniauth'
7
+ gem 'codecov', require: false
data/README.md CHANGED
@@ -1,8 +1,9 @@
1
- # OauthAdapter
1
+ # OAuthAdapter
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/oauth_adapter`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ [![Build Status](https://travis-ci.org/sinsoku/oauth_adapter.svg?branch=master)](https://travis-ci.org/sinsoku/oauth_adapter)
4
+ [![codecov](https://codecov.io/gh/sinsoku/oauth_adapter/branch/master/graph/badge.svg)](https://codecov.io/gh/sinsoku/oauth_adapter)
4
5
 
5
- TODO: Delete this and the text above, and describe your gem
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
- Or install it yourself as:
20
+ ## Configuration
20
21
 
21
- $ gem install oauth_adapter
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
- TODO: Write usage instructions here
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/[USERNAME]/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.
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
@@ -1,3 +1,3 @@
1
1
  module OauthAdapter
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
3
3
  end
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.1.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-01-11 00:00:00.000000000 Z
11
+ date: 2016-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth