omniauth-line-notify 0.1.1 → 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: 26de388096f990e8c66798ef1a64b9bbfd7e07f5
4
- data.tar.gz: a92699479e27dbf591d47b3467339d597f9920b4
3
+ metadata.gz: c5de2780d8666603561fbb927c12357ee5dc9882
4
+ data.tar.gz: 1547f07b43f75ccba1af5ce3a8b21cb00e9fd550
5
5
  SHA512:
6
- metadata.gz: 97fdf8225b8e443d316b17b32034d18a80c078fb02e17e8cacff32bcad1f593eed3c58198d248503c0940db4a05b43d86e2fc145529f69652f6efbed60c8e098
7
- data.tar.gz: 422efac24466e503259d8fb775e66eceba17411ddb6175dbf9402e487260eb3025480ee440d90cb817b64d1a5a03150091bcea95e9b1f9a1082aeeb2e7611945
6
+ metadata.gz: 385ca905613f662a9825b38bc30a14a58e47b9cc4015db189c7283036f8df68b710f8ce8db1945dc41ee2e3fe09cd060724a5a5e5e992c9bbdea5200cfa6103b
7
+ data.tar.gz: df1d5c045c0251df1ade3cf291705303ef622ba308162cef188c17f0d3218bf883df729bbd27b71796a1d46dd5f32649ba64b193a3e7912ba9978b47731d4b23
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  # Omniauth::Line::Notify
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/omniauth/line/notify`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ LINE Notify Strategy for OmniAuth.
4
+ Supports OAuth 2.0 server-side flows. Read the LINE Notify docs for more details: https://notify-bot.line.me/static/pdf/line-notify-api.pdf
6
5
 
7
6
  ## Installation
8
7
 
@@ -22,14 +21,39 @@ Or install it yourself as:
22
21
 
23
22
  ## Usage
24
23
 
25
- TODO: Write usage instructions here
24
+ OmniAuth::Strategies::LineNotify is simply a Rack middleware. Read the OmniAuth docs for detailed instructions: https://github.com/intridea/omniauth.
25
+
26
+ Here's a quick example, adding the middleware to a Rails app in config/initializers/omniauth.rb:
26
27
 
27
- ## Development
28
+ ```ruby
29
+ Rails.application.config.middleware.use OmniAuth::Builder do
30
+ provider :facebook, ENV['FACEBOOK_KEY'], ENV['FACEBOOK_SECRET']
31
+ end
32
+ ```
28
33
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
34
+ Or, adding the middleware to Devise in config/initializers/devise.rb:
30
35
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
36
+ ```ruby
37
+ config.omniauth :line_notify, ENV['LINE_NOTIFY_CLIEDNT_ID'], ENV['LINE_NOTIFY_APP_SECRET'], scope: 'notify'
38
+ ```
39
+
40
+ ## Auth Hash
41
+
42
+ Here's an example Auth Hash available in request.env['omniauth.auth']:
43
+
44
+ ```ruby
45
+ {
46
+ provider: 'line_notify',
47
+ uid: nil,
48
+ info: {},
49
+ credentials: {
50
+ token: 'ABCDEF...', # OAuth 2.0 access_token, which you may wish to store
51
+ expires: false
52
+ },
53
+ extra: {}
54
+ }
55
+ ```
32
56
 
33
57
  ## Contributing
34
58
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/omniauth-line-notify.
59
+ Bug reports and pull requests are welcome on GitHub at https://github.com/blueplanet/omniauth-line-notify.
@@ -1,3 +1,3 @@
1
1
  module OmniAuthLineNotify
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -6,26 +6,19 @@ module OmniAuth
6
6
  class LineNotify < OmniAuth::Strategies::OAuth2
7
7
  option :name, 'line_notify'
8
8
 
9
- option :client_options, {:site => 'https://notify­bot.line.me',
9
+ option :client_options, {:site => 'https://notify-bot.line.me/',
10
10
  :authorize_url => '/oauth/authorize',
11
11
  :token_url => '/oauth/token',
12
12
  :proxy => ENV['http_proxy'] ? URI(ENV['http_proxy']) : nil}
13
13
 
14
- uid { raw_info['mid'] }
15
-
16
- info do
17
- {
18
- name: raw_info['displayName'],
19
- image: raw_info['pictureUrl'],
20
- description: raw_info['statusMessage']
21
- }
14
+ def authorize_params
15
+ super.tap do |params|
16
+ params[:scope] = 'notify'
17
+ end
22
18
  end
23
19
 
24
- # Require: Access token with PROFILE permission issued.
25
- def raw_info
26
- @raw_info ||= JSON.load(access_token.get('v1/profile').body)
27
- rescue ::Errno::ETIMEDOUT
28
- raise ::Timeout::Error
20
+ def callback_url
21
+ full_host + script_name + callback_path
29
22
  end
30
23
  end
31
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-line-notify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - blueplanet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-05 00:00:00.000000000 Z
11
+ date: 2016-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json