omniauth-spotify 0.0.3 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b2659f8740a5d3e0f09bce1e8ad3bf1e2c2c9a45
4
- data.tar.gz: f42cafb62985cc8489e16cc2cfda45da9506af77
3
+ metadata.gz: 92fcbd43deb2d092e6869684c3e22d49dfc0b0c6
4
+ data.tar.gz: 17b662e1772165306566e144511d8a0874d5ddc0
5
5
  SHA512:
6
- metadata.gz: c1b5c9738b417d9f9c584e6653ed8c503abf5e401b454ccc1091f0a65606abb253e0841f1a5447495fb797b1095d0c81ada87f8658bfc5c3f212b257e3c00af0
7
- data.tar.gz: 76a41a5297bb958178ab9587674560cdc97c4c10f0cf95e51ead97d8938857ba533a568e8525b51f25b2a804a892d2c3538420e3c7bd490f9c4449576b4bd7f7
6
+ metadata.gz: 920ea8dd25fc9ebd6c59a15b7ea2b3ecb8646d271fcb8a5cf03119a025afff2ebaa5964cade094d2a2235f6b0c3492985b80aa4742bd523df6b08def30e81985
7
+ data.tar.gz: f82d9246935d1a2e092b7d613cde46c3156aadd6559b9933954196729af3755f9e6203e911a5bc3cd0ee34364222b671dfd6a0e2bfef9915a14dff83ef5207e4
data/README.md CHANGED
@@ -42,13 +42,24 @@ config.omniauth :spotify, 'app_id', 'app_secret', scope: 'playlist-read-private
42
42
 
43
43
  Here's an example auth hash, available in `request.env['omniauth.auth']`:
44
44
 
45
+ Some of this fields depend on what scopes you ask, namely
46
+
47
+ * `user-read-email` affects the presence of the `email` field
48
+ * `user-read-private` affects the value of `name` (if the scope is
49
+ missing it will reflect `username`) and the presence of
50
+ `image`
51
+
45
52
  ```ruby
46
53
  {
47
54
  :provider => "spotify",
48
55
  :uid => "1111111111",
49
56
  :info => {
50
57
  :name => "Claudio Poli",
51
- :email => "claudio@icorete.ch"
58
+ :nickname => 'SomeName',
59
+ :email => "claudio@icorete.ch",
60
+ :urls => {:spotify => "https://open.spotify.com/user/1111111111"},
61
+ :image => 'https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xfp1/t1.0-1/s320x320/301234_1962753760624_625151598_n.jpg'
62
+
52
63
  },
53
64
  :credentials => {
54
65
  :token => "xxxx",
@@ -23,8 +23,13 @@ module OmniAuth
23
23
 
24
24
  info do
25
25
  {
26
- :name => raw_info['display_name'],
27
- :email => raw_info['email']
26
+ # display_name may be empty if user does not request
27
+ # 'user-read-private'
28
+ :name => raw_info['display_name'] || raw_info['id'],
29
+ :nickname => raw_info['id'],
30
+ :email => raw_info['email'],
31
+ :urls => raw_info['external_urls'],
32
+ :image => image_url
28
33
  }
29
34
  end
30
35
 
@@ -34,6 +39,14 @@ module OmniAuth
34
39
  }
35
40
  end
36
41
 
42
+ def image_url
43
+ if images = raw_info['images']
44
+ if first = images.first
45
+ first['url']
46
+ end
47
+ end
48
+ end
49
+
37
50
  def raw_info
38
51
  @raw_info ||= access_token.get('me').parsed
39
52
  end
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Spotify
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.5"
4
4
  end
5
5
  end
@@ -17,6 +17,5 @@ Gem::Specification.new do |gem|
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
19
 
20
- gem.add_dependency 'omniauth', '~> 1.0'
21
20
  gem.add_dependency 'omniauth-oauth2', '~> 1.1'
22
21
  end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-spotify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claudio Poli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-17 00:00:00.000000000 Z
11
+ date: 2014-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: omniauth
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: omniauth-oauth2
29
15
  requirement: !ruby/object:Gem::Requirement