omniauth-appdotnet 0.0.1 → 0.0.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.
@@ -4,7 +4,7 @@ module OmniAuth
|
|
4
4
|
module Strategies
|
5
5
|
class AppDotNet < OmniAuth::Strategies::OAuth2
|
6
6
|
option :client_options, {
|
7
|
-
:site => 'https://alpha.app.net/',
|
7
|
+
:site => 'https://alpha-api.app.net/',
|
8
8
|
:authorize_url => 'https://alpha.app.net/oauth/authenticate',
|
9
9
|
:token_url => 'https://alpha.app.net/oauth/access_token'
|
10
10
|
}
|
@@ -16,21 +16,24 @@ module OmniAuth
|
|
16
16
|
uid { user_data['id'] }
|
17
17
|
|
18
18
|
info do
|
19
|
+
# these fields will probably change rapidly as App.net api evolves
|
19
20
|
{
|
20
|
-
'email' => user_data['email'],
|
21
21
|
'name' => user_data['name'],
|
22
|
-
'
|
22
|
+
'username' => user_data['username'],
|
23
|
+
'image' => (user_data['avatar_image'] ? user_data['avatar_image']["url"] : nil),
|
24
|
+
'cover' => (user_data['cover_image'] ? user_data['cover_image']["url"] : nil),
|
25
|
+
'human' => user_data['type'] == "human",
|
26
|
+
'timezone' => user_data['timezone'],
|
23
27
|
'urls' => {
|
24
|
-
|
25
|
-
'AppDotNet' => user_data['app_dot_net_url'],
|
26
|
-
'Website' => user_data['online_bio_url']
|
28
|
+
'Profile' => "https://alpha.app.net/#{user_data['username']}"
|
27
29
|
},
|
28
30
|
}
|
29
31
|
end
|
30
32
|
|
31
33
|
def user_data
|
32
|
-
|
33
|
-
|
34
|
+
@user_data ||= begin
|
35
|
+
access_token.get("/stream/0/users/#{access_token.params["user_id"]}").parsed
|
36
|
+
end
|
34
37
|
end
|
35
38
|
|
36
39
|
end
|
@@ -17,5 +17,9 @@ describe OmniAuth::Strategies::AppDotNet do
|
|
17
17
|
it 'should have correct authorize url' do
|
18
18
|
subject.options.client_options.authorize_url.should eq('https://alpha.app.net/oauth/authenticate')
|
19
19
|
end
|
20
|
+
|
21
|
+
it 'should have correct token url' do
|
22
|
+
subject.options.client_options.token_url.should eq('https://alpha.app.net/oauth/access_token')
|
23
|
+
end
|
20
24
|
end
|
21
25
|
end
|