omniauth-intercom 0.1.1 → 0.1.2

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: e4b9a3e6d43aab0e16d421199e711811a99af80b
4
- data.tar.gz: 851ce2cc70ec3088218d8057952166421e2275dc
3
+ metadata.gz: cfacd27e923da6ff12e6fa19596a8da33b0b536c
4
+ data.tar.gz: d5d22d9023725fb0c148b3626eac0de441fe1a0b
5
5
  SHA512:
6
- metadata.gz: 291e5181db1f500963bbb928c3bd555a63c1cbf56fd9cd6896a52a16f53d1284a4949e8c746defd9c666669006b6e1022530187314760087cc83f3168c9b03d1
7
- data.tar.gz: 2c6831280024a72c47d917e79735934450da7707ff5a0e89a729a50482cb2a176868564db7aeb759f8de98ec4791c574f984fe738f35102c94a8d6d7552ffcef
6
+ metadata.gz: 0585d860eb475bf66ce0099de68143d8d60e9a94098992a6d4ca645937b2029828f9c4c24435cc51d13e232d79f18071c3c80f73a30e8b9321611e7ceab0c24d
7
+ data.tar.gz: 300f09777d0919b3a88cf1994dbc02886a37f2d11695a1ecce568b4f2dca54aaeba665c458f5f6742c524dd223af78e499320577cf1c854b1a4e5bdd242ad6a7
data/CHANGELOG.md CHANGED
@@ -4,8 +4,14 @@ Features:
4
4
 
5
5
  - Omniauth2 basic auth (@Skaelv)
6
6
 
7
- ## 0.1.0 (2016-05-03)
7
+ ## 0.1.1 (2016-05-03)
8
8
 
9
9
  Features:
10
10
 
11
11
  - Add support for signup (@Skaelv)
12
+
13
+ ## 0.1.2 (2016-06-14)
14
+
15
+ Features:
16
+
17
+ - add support for avatar (thanks @bnorton)
data/README.md CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  # OmniAuth Intercom
3
2
 
4
3
  Intercom OAuth2 Strategy for OmniAuth.
@@ -29,7 +28,7 @@ end
29
28
  To start the authentication process with Intercom you simply need to access `/auth/intercom` route.
30
29
  You can start the authentication process directly with the signup page by accessing `/auth/intercom?signup=1`
31
30
 
32
- **Important** You need the `read_admins` permissions to use this middleware.
31
+ **Important** You need the `read_single_admin` permissions to use this middleware.
33
32
  **Important** Your `redirect_url` should be `/auth/intercom/callback`
34
33
 
35
34
  ## Auth Hash
@@ -56,8 +55,9 @@ Here's an example *Auth Hash* available in `request.env['omniauth.auth']`:
56
55
  :id => '342324',
57
56
  :app => {
58
57
  :id_code => 'abc123', # Company app_id
59
- :type: 'app'
60
- }
58
+ :type => 'app',
59
+ :secure => true # Secure mode enabled for this app
60
+ },
61
61
  :avatar => {
62
62
  :image_url => "https://static.intercomassets.com/avatars/343616/square_128/me.jpg?1454165491"
63
63
  }
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Intercom
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
@@ -2,35 +2,30 @@ require 'omniauth-oauth2'
2
2
  module OmniAuth
3
3
  module Strategies
4
4
  class Intercom < OmniAuth::Strategies::OAuth2
5
- # Give your strategy a name.
6
- option :name, "intercom"
5
+ option :name, 'intercom'
7
6
 
8
- # This is where you pass the options you would pass when
9
- # initializing your consumer from the OAuth gem.
10
7
  option :client_options, {
11
8
  :site => 'https://api.intercom.io',
12
- # :site => 'http://localhost:4000',
13
9
  :authorize_url => 'https://app.intercom.io/oauth',
14
10
  :token_url => 'https://api.intercom.io/auth/eagle/token'
15
11
  }
16
12
 
17
- # These are called after authentication has succeeded. If
18
- # possible, you should try to set the UID without making
19
- # additional calls (if the user id is returned with the token
20
- # or as a URI parameter). This may not be possible with all
21
- # providers.
22
- uid{ raw_info['id'] }
13
+ uid { raw_info['id'] }
23
14
 
24
15
  info do
25
16
  {
26
17
  :name => raw_info['name'],
27
- :email => raw_info['email']
28
- }
18
+ :email => raw_info['email'],
19
+ }.tap do |info|
20
+ avatar = raw_info['avatar'] && raw_info['avatar']['image_url']
21
+
22
+ info[:image] = avatar if avatar
23
+ end
29
24
  end
30
25
 
31
26
  extra do
32
27
  {
33
- 'raw_info' => raw_info
28
+ :raw_info => raw_info
34
29
  }
35
30
  end
36
31
 
@@ -41,16 +36,13 @@ module OmniAuth
41
36
  end
42
37
 
43
38
  def request_phase
44
- authorize_url
39
+ options.client_options[:authorize_url] += '/signup' if request.params.fetch('signup', false)
40
+
45
41
  super
46
42
  end
47
43
 
48
44
  protected
49
45
 
50
- def authorize_url
51
- options.client_options[:authorize_url] += '/signup' if request.params.fetch('signup', false)
52
- end
53
-
54
46
  def accept_headers
55
47
  access_token.client.connection.headers['Authorization'] = access_token.client.connection.basic_auth(access_token.token, '')
56
48
  access_token.client.connection.headers['Accept'] = "application/vnd.intercom.3+json"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-intercom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Antoine
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-06 00:00:00.000000000 Z
11
+ date: 2016-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth-oauth2