omniauth-napster 0.0.0 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -9
- data/Gemfile +0 -2
- data/{LICENSE.txt → LICENSE} +5 -5
- data/README.md +75 -16
- data/Rakefile +0 -5
- data/lib/omniauth-napster.rb +2 -0
- data/lib/omniauth/napster.rb +2 -4
- data/lib/omniauth/strategies/napster.rb +36 -0
- data/omniauth-napster.gemspec +19 -31
- data/spec/omniauth/napster_spec.rb +6 -0
- data/spec/omniauth/strategies/napster_spec.rb +21 -0
- data/spec/spec_helper.rb +8 -0
- metadata +28 -38
- data/.travis.yml +0 -4
- data/bin/console +0 -14
- data/bin/setup +0 -7
- data/lib/omniauth/napster/version.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb41ca84885aa059bf5e4d142ba7562d75d7a31a
|
4
|
+
data.tar.gz: e3777f41739b129e8aac19e835e660725aea06d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a1095637477513335d4e5381b7c22e7e00af3ae90c9e1b080cd0b29cb38ece1b6254003d5c0dfa1059d2e63ad7e8f9ea9ecfc6645cb5c1af5a8217e92482ed0
|
7
|
+
data.tar.gz: abfd0e41190f8ab63d41cadc2e81ce2e8c7faec2adc05a2bd2219abf20968adb0bd36ab5b488e02c595c98a901a06d901149284f9885ab7ea5f455e4bb699ea1
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/{LICENSE.txt → LICENSE}
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2016
|
3
|
+
Copyright (c) 2016 Rhapsody International
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
@@ -9,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
9
|
copies of the Software, and to permit persons to whom the Software is
|
10
10
|
furnished to do so, subject to the following conditions:
|
11
11
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
14
|
|
15
15
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
16
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
17
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,41 +1,100 @@
|
|
1
|
-
|
1
|
+
<!--
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/omniauth-napster.svg)](https://badge.fury.io/rb/omniauth-napster)
|
3
|
+
-->
|
2
4
|
|
3
|
-
|
5
|
+
# Napster Music OmniAuth Strategy
|
4
6
|
|
5
|
-
|
7
|
+
This gem provides the [OmniAuth](https://github.com/intridea/omniauth) strategy for the [Napster API](https://developer.napster.com).
|
6
8
|
|
7
9
|
## Installation
|
8
10
|
|
9
11
|
Add this line to your application's Gemfile:
|
10
12
|
|
11
|
-
```
|
12
|
-
gem 'omniauth-napster'
|
13
|
-
```
|
13
|
+
```$ gem 'omniauth-napster'```
|
14
14
|
|
15
15
|
And then execute:
|
16
16
|
|
17
|
-
|
17
|
+
```$ bundle```
|
18
18
|
|
19
19
|
Or install it yourself as:
|
20
20
|
|
21
|
-
|
21
|
+
```$ gem install omniauth-napster```
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
You'll need to register your app with Napster. Visit https://developer.napster.com/developer/apps/new to get started.
|
26
26
|
|
27
|
-
|
27
|
+
Using this gem is similar to other OmniAuth strategies. Add your app credentials to `config/initializers/omniauth.rb`:
|
28
28
|
|
29
|
-
|
29
|
+
```ruby
|
30
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
31
|
+
provider :napster, ENV['NAPSTER_API_KEY'], ENV['NAPSTER_API_SECRET']
|
32
|
+
end
|
33
|
+
```
|
30
34
|
|
31
|
-
|
35
|
+
Or with Devise in `config/initializers/devise.rb`:
|
32
36
|
|
33
|
-
|
37
|
+
```ruby
|
38
|
+
config.omniauth :napster, ENV['NAPSTER_API_KEY'], ENV['NAPSTER_API_SECRET']
|
39
|
+
```
|
34
40
|
|
35
|
-
|
41
|
+
## Auth Hash Schema
|
36
42
|
|
43
|
+
Here's an example auth hash, available in `request.env['omniauth.auth']`:
|
44
|
+
```
|
45
|
+
{
|
46
|
+
"provider":"napster",
|
47
|
+
"uid":"295DC739BEDA4BB8E050960A380358BC",
|
48
|
+
"info": {
|
49
|
+
"uid":"295DC739BEDA4BB8E050960A380358BC",
|
50
|
+
"name":"Testy Testerson",
|
51
|
+
"username":"NAPIcat",
|
52
|
+
"image":"http://direct.rhapsody.com/imageserver/v2/external/aHR0cHM6Ly9yaGFwc29keS1uYXBpLnMzLmFtYXpvbmF3cy5jb20vbWVtYmVyLzI5NURDNzM5QkVEQTRCQjhFMDUwOTYwQTM4MDM1OEJDL2F2YXRhci9vcmlnaW5hbA%3D%3D/images/108x108.jpg"
|
53
|
+
},
|
54
|
+
"credentials": {
|
55
|
+
"token":"NTQ3NjI5NDktNWIyZC00MDVlLTg2MDMtZDhhMGQ2YTYzMTk3",
|
56
|
+
"refresh_token":"0b4bdad8-1c82-44d0-8cdb-dd8d2b6e6331",
|
57
|
+
"expires_at":1463103543,
|
58
|
+
"expires":true
|
59
|
+
},
|
60
|
+
"extra": {
|
61
|
+
"raw_info": {
|
62
|
+
"me": {
|
63
|
+
"id": "295DC739BEDA4BB8E050960A380358BC",
|
64
|
+
"realName": "Testy Testerson",
|
65
|
+
"screenName": "NAPIcat",
|
66
|
+
"bio": "The cat is back!",
|
67
|
+
"location":"Seattle, WA",
|
68
|
+
"visibility": "public",
|
69
|
+
"type": "member",
|
70
|
+
"href": "http://api.rhapsody.com/members/295DC739BEDA4BB8E050960A380358BC",
|
71
|
+
"favoriteAlbumsCount": 0,
|
72
|
+
"favoriteArtistsCount": 0,
|
73
|
+
"favoriteTracksCount": 0,
|
74
|
+
"playlistsTotalCount": 0,
|
75
|
+
"playlistsPublishedCount": 0,
|
76
|
+
"stationsCount": 0,
|
77
|
+
"radioCount": 0,
|
78
|
+
"followingCount": 2,
|
79
|
+
"followerCount": 10,
|
80
|
+
"avatar": "http://direct.rhapsody.com/imageserver/v2/external/aHR0cHM6Ly9yaGFwc29keS1uYXBpLnMzLmFtYXpvbmF3cy5jb20vbWVtYmVyLzI5NURDNzM5QkVEQTRCQjhFMDUwOTYwQTM4MDM1OEJDL2F2YXRhci9vcmlnaW5hbA%3D%3D/images/108x108.jpg",
|
81
|
+
"avatarId": "aHR0cHM6Ly9yaGFwc29keS1uYXBpLnMzLmFtYXpvbmF3cy5jb20vbWVtYmVyLzI5NURDNzM5QkVEQTRCQjhFMDUwOTYwQTM4MDM1OEJDL2F2YXRhci9vcmlnaW5hbA%3D%3D",
|
82
|
+
"defaultAvatar": "false",
|
83
|
+
"avatarVersion": 1465508896140
|
84
|
+
}
|
85
|
+
}
|
86
|
+
}
|
87
|
+
}
|
88
|
+
```
|
37
89
|
|
38
|
-
##
|
90
|
+
## More
|
39
91
|
|
40
|
-
|
92
|
+
This gem is brought to you by the NAPI (Napster API) development team. Please [reach out to us](https://groups.google.com/forum/#!forum/rhapsody-api) if you have any questions.
|
93
|
+
|
94
|
+
## Contributing
|
41
95
|
|
96
|
+
1. Fork it
|
97
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
98
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
99
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
100
|
+
5. Create a new Pull Request
|
data/Rakefile
CHANGED
data/lib/omniauth/napster.rb
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class Napster < OmniAuth::Strategies::OAuth2
|
6
|
+
include OmniAuth::Strategy
|
7
|
+
option :name, 'napster'
|
8
|
+
|
9
|
+
option :client_options, {
|
10
|
+
:site => 'https://api.napster.com',
|
11
|
+
:token_url => '/oauth/access_token'
|
12
|
+
}
|
13
|
+
|
14
|
+
uid{ raw_info['me']['id'] }
|
15
|
+
|
16
|
+
info do
|
17
|
+
{
|
18
|
+
:uid => raw_info['me']['id'],
|
19
|
+
:name => raw_info['me']['realName'],
|
20
|
+
:username => raw_info['me']['screenName'],
|
21
|
+
:image => raw_info['me']['avatar']
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
extra do
|
26
|
+
{
|
27
|
+
'raw_info' => raw_info
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def raw_info
|
32
|
+
@raw_info ||= access_token.get('/me').parsed
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/omniauth-napster.gemspec
CHANGED
@@ -1,33 +1,21 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
require 'omniauth/napster/version'
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require 'omniauth/napster'
|
5
4
|
|
6
|
-
Gem::Specification.new do |
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
-
end
|
24
|
-
|
25
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
-
spec.bindir = "exe"
|
27
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
-
spec.require_paths = ["lib"]
|
29
|
-
|
30
|
-
spec.add_development_dependency "bundler", "~> 1.10"
|
31
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
32
|
-
spec.add_development_dependency "rspec"
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "omniauth-napster"
|
7
|
+
s.version = OmniAuth::Napster::VERSION
|
8
|
+
s.authors = ["Richard Luck"]
|
9
|
+
s.email = ["rluck@rhapsody.com"]
|
10
|
+
s.description = %q{This gem provides the OmniAuth strategy for connecting to the Napster API.}
|
11
|
+
s.summary = %q{OmniAuth strategy for Napster Music Service}
|
12
|
+
s.homepage = "https://github.com/Napster/omniauth-napster.git"
|
13
|
+
s.required_ruby_version = '~> 2.0'
|
14
|
+
s.license = 'MIT'
|
15
|
+
s.files = `git ls-files`.split($/)
|
16
|
+
s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
s.add_runtime_dependency 'omniauth-oauth2', '~> 1.3'
|
20
|
+
s.add_development_dependency 'rspec', '~> 3.0'
|
33
21
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
describe 'OmniAuth::Strategies::Napster' do
|
3
|
+
subject do
|
4
|
+
OmniAuth::Strategies::Napster.new({})
|
5
|
+
end
|
6
|
+
|
7
|
+
context "client options" do
|
8
|
+
it 'should have correct name' do
|
9
|
+
expect(subject.options.name).to eq("napster")
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should have correct site' do
|
13
|
+
expect(subject.options.client_options.site).to eq('https://api.napster.com')
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should have correct token url' do
|
17
|
+
expect(subject.options.client_options.token_url).to eq('/oauth/access_token')
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,58 +1,45 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-napster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Luck
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: omniauth-oauth2
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
20
|
-
type: :
|
19
|
+
version: '1.3'
|
20
|
+
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '3.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
41
|
-
|
42
|
-
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
description: omniauth-napster
|
40
|
+
version: '3.0'
|
41
|
+
description: This gem provides the OmniAuth strategy for connecting to the Napster
|
42
|
+
API.
|
56
43
|
email:
|
57
44
|
- rluck@rhapsody.com
|
58
45
|
executables: []
|
@@ -61,30 +48,30 @@ extra_rdoc_files: []
|
|
61
48
|
files:
|
62
49
|
- ".gitignore"
|
63
50
|
- ".rspec"
|
64
|
-
- ".travis.yml"
|
65
51
|
- Gemfile
|
66
|
-
- LICENSE
|
52
|
+
- LICENSE
|
67
53
|
- README.md
|
68
54
|
- Rakefile
|
69
|
-
-
|
70
|
-
- bin/setup
|
55
|
+
- lib/omniauth-napster.rb
|
71
56
|
- lib/omniauth/napster.rb
|
72
|
-
- lib/omniauth/napster
|
57
|
+
- lib/omniauth/strategies/napster.rb
|
73
58
|
- omniauth-napster.gemspec
|
74
|
-
|
59
|
+
- spec/omniauth/napster_spec.rb
|
60
|
+
- spec/omniauth/strategies/napster_spec.rb
|
61
|
+
- spec/spec_helper.rb
|
62
|
+
homepage: https://github.com/Napster/omniauth-napster.git
|
75
63
|
licenses:
|
76
64
|
- MIT
|
77
|
-
metadata:
|
78
|
-
allowed_push_host: https://rubygems.org
|
65
|
+
metadata: {}
|
79
66
|
post_install_message:
|
80
67
|
rdoc_options: []
|
81
68
|
require_paths:
|
82
69
|
- lib
|
83
70
|
required_ruby_version: !ruby/object:Gem::Requirement
|
84
71
|
requirements:
|
85
|
-
- - "
|
72
|
+
- - "~>"
|
86
73
|
- !ruby/object:Gem::Version
|
87
|
-
version: '0'
|
74
|
+
version: '2.0'
|
88
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
76
|
requirements:
|
90
77
|
- - ">="
|
@@ -92,8 +79,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
79
|
version: '0'
|
93
80
|
requirements: []
|
94
81
|
rubyforge_project:
|
95
|
-
rubygems_version: 2.
|
82
|
+
rubygems_version: 2.5.1
|
96
83
|
signing_key:
|
97
84
|
specification_version: 4
|
98
|
-
summary:
|
99
|
-
test_files:
|
85
|
+
summary: OmniAuth strategy for Napster Music Service
|
86
|
+
test_files:
|
87
|
+
- spec/omniauth/napster_spec.rb
|
88
|
+
- spec/omniauth/strategies/napster_spec.rb
|
89
|
+
- spec/spec_helper.rb
|
data/.travis.yml
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "omniauth/napster"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|
data/bin/setup
DELETED