omniauth-appdotnet 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module AppDotNet
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -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
- 'image' => user_data['image'],
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
- # todo: replace these
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
- access_token.options[:mode] = :query
33
- user_data ||= access_token.get('/1/me').parsed
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-appdotnet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: