omniauth-line-notify 0.1.1 → 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/README.md +32 -8
- data/lib/omniauth-line-notify/version.rb +1 -1
- data/lib/omniauth/strategies/line-notify.rb +7 -14
- 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: c5de2780d8666603561fbb927c12357ee5dc9882
|
4
|
+
data.tar.gz: 1547f07b43f75ccba1af5ce3a8b21cb00e9fd550
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
34
|
+
Or, adding the middleware to Devise in config/initializers/devise.rb:
|
30
35
|
|
31
|
-
|
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/
|
59
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/blueplanet/omniauth-line-notify.
|
@@ -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
|
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
|
-
|
15
|
-
|
16
|
-
|
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
|
-
|
25
|
-
|
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.
|
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-
|
11
|
+
date: 2016-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|