omniauth-slack 2.1.2 → 2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a06a665cd9165067e6e52446714beafda6b38a84
4
- data.tar.gz: dc3037e97c68103cc4066f2ee3d77112021b2c76
3
+ metadata.gz: f79b8e67dacdd3e9030fe66dd61bcbc78d1544da
4
+ data.tar.gz: d0026c7cab03f2fefc77828b67ac3e981939280b
5
5
  SHA512:
6
- metadata.gz: 1c357611664892c40b920d7b9fc6b407f41e9c2d9b1ae6fb002ff5e49664fe1830f7a387e2e44f64d73cf27b0b61fde97cbf1b753eccccb61a45d7a941e5e8ee
7
- data.tar.gz: 1e75caaec8fc5208827e1a150be0c9db6ee9ecaca6d88fa2ce55911c4fedec906fe5f1c61df9803923715e7928b2f377298597f744d7d408835d8c9446cfc64a
6
+ metadata.gz: 4cc4341e62ce85da1d4d7bed36f3e8f858851309e1812518466520b215ec86173413f50bcf161dba3e4c1a7b476f3fe1455248524b596bd68f34dd6f7c4dd187
7
+ data.tar.gz: ab19de0c2cb9cec37898cfb0f9a42cccf3f544a98ba954e29d651ee60f3f422e5d0c301f1eb06dca2d3c97fd8bbebdb4dfd2c753fd85ca00689ad14e62090028
data/.gitignore CHANGED
@@ -16,3 +16,5 @@ test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
18
  .idea/
19
+ .ruby-version
20
+ .ruby-gemset
@@ -3,14 +3,13 @@ require 'omniauth/strategies/oauth2'
3
3
  module OmniAuth
4
4
  module Strategies
5
5
  class Slack < OmniAuth::Strategies::OAuth2
6
+ option :name, 'slack'
6
7
 
7
- option :name, "slack"
8
-
9
- option :authorize_options, [ :scope, :team ]
8
+ option :authorize_options, [:scope, :team]
10
9
 
11
10
  option :client_options, {
12
- site: "https://slack.com",
13
- token_url: "/api/oauth.access"
11
+ site: 'https://slack.com',
12
+ token_url: '/api/oauth.access'
14
13
  }
15
14
 
16
15
  option :auth_token_params, {
@@ -43,7 +42,16 @@ module OmniAuth
43
42
  end
44
43
 
45
44
  extra do
46
- {:raw_info => raw_info, :user_info => user_info, :team_info => team_info}
45
+ {
46
+ raw_info: raw_info,
47
+ user_info: user_info,
48
+ team_info: team_info,
49
+ web_hook_info: web_hook_info
50
+ }
51
+ end
52
+
53
+ def raw_info
54
+ @raw_info ||= access_token.get('/api/auth.test').parsed
47
55
  end
48
56
 
49
57
  def user_info
@@ -51,11 +59,19 @@ module OmniAuth
51
59
  end
52
60
 
53
61
  def team_info
54
- @team_info ||= access_token.get("/api/team.info").parsed
62
+ @team_info ||= access_token.get('/api/team.info').parsed
55
63
  end
56
64
 
57
- def raw_info
58
- @raw_info ||= access_token.get("/api/auth.test").parsed
65
+ def web_hook_info
66
+ return {} unless incoming_webhook_allowed?
67
+ access_token.params['incoming_webhook']
68
+ end
69
+
70
+ def incoming_webhook_allowed?
71
+ return false unless options['scope']
72
+ webhooks_scopes = ['incoming-webhook']
73
+ scopes = options['scope'].split(',')
74
+ (scopes & webhooks_scopes).any?
59
75
  end
60
76
  end
61
77
  end
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Slack
3
- VERSION = "2.1.2"
3
+ VERSION = "2.2.0"
4
4
  end
5
5
  end
@@ -1,2 +1,2 @@
1
1
  require 'omniauth-slack/version'
2
- require 'omniauth/strategies/slack'
2
+ require 'omniauth/strategies/slack'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-slack
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - kimura