spof 0.0.7 → 0.0.8

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: 5bbe79932270b033c3f97f8746a01851fb3df73d
4
- data.tar.gz: 738704ac1289fb279c443c39236ad7569ff58969
3
+ metadata.gz: 1a35b6a571636f4fa0f17131191a7f4fd8779b0f
4
+ data.tar.gz: 4b1600c1295c4cb8fc10625a1c07d78b63e1afcc
5
5
  SHA512:
6
- metadata.gz: c9c6325b48909bc842ca41f1734cb2d4185425a5cd39253cb879f48de4efce46fcf6de888b11703e8a40ab484bcb2141665c921ea7aeb89e085b87a7f3a19a14
7
- data.tar.gz: fdfc6e8845acc1649140cc0b731e6f86c3c76d14c60b5314eb73dfeb0f9476f03e8e4289ffde6778f4967e46f85b0e6692e1b194d63a3611aca1574c18b6dfc8
6
+ metadata.gz: edafdee10e5b03195b38566def224c7c878e81647fb7490c3b5fbf1ea7a2bfebc32a15d00b786e40f62b3fe9b42d198c42bb07665406b4d8abe6832e2bae6795
7
+ data.tar.gz: efd78e4f12d10c70c9c14ae58b3aa82ec4a988a3b9382ef36f07b3153b8d4a3b34dcb361ed8814dd67f34d5f78dffe0d24e5d2c3cdf11b76de0e27bf3c4012ca
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ *.swp
data/.travis.yml CHANGED
@@ -1,7 +1,7 @@
1
- language: ruby
2
- rvm:
3
- - 2.0.0
4
- - 1.9.3
5
- - 1.9.2
6
- - jruby-19mode
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 1.9.3
5
+ - 1.9.2
6
+ - jruby-19mode
7
7
  - rbx-19mode
data/LICENSE CHANGED
@@ -1,19 +1,19 @@
1
- Copyright (c) 2013 Ignacio Contreras Pinilla
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of
4
- this software and associated documentation files (the "Software"), to deal in
5
- the Software without restriction, including without limitation the rights to
6
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
- of the Software, and to permit persons to whom the Software is furnished to do
8
- so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in all
11
- copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1
+ Copyright (c) 2013 Ignacio Contreras Pinilla
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
+ of the Software, and to permit persons to whom the Software is furnished to do
8
+ so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
19
  SOFTWARE.
data/README.md CHANGED
@@ -1,53 +1,77 @@
1
- Spof
2
- ====
3
-
4
- Ruby wrapper for the Spotify Search & Lookup API. Under development.
5
-
6
- [![Build Status](https://travis-ci.org/ignaciocontreras/spof.png?branch=master)](https://travis-ci.org/ignaciocontreras/spof)
7
-
8
- [![Gem Version](https://badge.fury.io/rb/spof.png)](http://badge.fury.io/rb/spof)
9
-
10
- [![Stories in Ready](https://badge.waffle.io/ignaciocontreras/spof.png?label=ready)](https://waffle.io/ignaciocontreras/spof)
11
-
12
-
13
- Usage
14
- -----
15
-
16
- ```ruby
17
- require 'spof'
18
- ```
19
-
20
- ### Search
21
-
22
-
23
- ```ruby
24
- r = Spof::Search.artist('nine inch nails') # or album or track
25
-
26
- # a page can be specified
27
- r = Spof::Search.track('life on mars', page = 2)
28
- ```
29
-
30
- ### Lookup
31
-
32
- ```ruby
33
- r = Spof::Lookup.get('spotify:uri:album:xy...z')
34
-
35
- # extras can be specified
36
- r = Spof::Lookup.get('spotify:uri:album:xy...z', :track)
37
-
38
- # convenience methods Lookup.album/artist/track check the provided extras
39
- r = Spof::Lookup.artist('spotify:uri:artist:ab...c', :trackdetail)
40
- # raises Spof::SpofError, "Illegal extra"
41
- ```
42
-
43
-
44
- For both `Lookup` and `Search` methods, the result contains the parsed JSON response. For now it's like:
45
-
46
- ```ruby
47
- r = JSON.parse(spotify_api_json_response, :symbolize_names => true) # hash with symbols as keys
48
- ```
49
-
50
- License
51
- -------
52
-
53
- See LICENSE file.
1
+ Spof
2
+ ====
3
+
4
+ Ruby wrapper for the Spotify Search & Lookup API. Under development.
5
+
6
+ [![Build Status](https://travis-ci.org/ignaciocontreras/spof.png?branch=master)](https://travis-ci.org/ignaciocontreras/spof)
7
+
8
+ [![Gem Version](https://badge.fury.io/rb/spof.png)](http://badge.fury.io/rb/spof)
9
+
10
+ [![Stories in Ready](https://badge.waffle.io/ignaciocontreras/spof.png?label=ready)](https://waffle.io/ignaciocontreras/spof)
11
+
12
+
13
+ Usage
14
+ -----
15
+
16
+ ```ruby
17
+ require 'spof'
18
+ ```
19
+
20
+ ### Search
21
+
22
+
23
+ ```ruby
24
+ Spof::Search.artist('nine inch nails') # or album or track
25
+ ```
26
+
27
+ Returns:
28
+ ```
29
+ {
30
+ :info => {
31
+ :num_results => 1,
32
+ :limit => 100,
33
+ :offset => 0,
34
+ :query => "nine inch nails",
35
+ :type => "artist",
36
+ :page => 1
37
+ },
38
+ :artists => [
39
+ { :href =>"spotify:artist:0X380XXQSNBYuleKzav5UO", :name => "Nine Inch Nails", :popularity => "0.64"}
40
+ ]
41
+ }
42
+ ```
43
+
44
+ ### Lookup
45
+
46
+ ```ruby
47
+ r = Spof::Lookup.get('spotify:uri:album:xy...z')
48
+
49
+ # extras can be specified
50
+ r = Spof::Lookup.get('spotify:uri:album:xy...z', :track)
51
+
52
+ # convenience methods Lookup.album/artist/track check the provided extras
53
+ r = Spof::Lookup.artist('spotify:uri:artist:ab...c', :trackdetail)
54
+ # raises Spof::SpofError, "Illegal extra"
55
+ ```
56
+
57
+
58
+ For both `Lookup` and `Search` methods, the result contains the parsed JSON response. For now it's like:
59
+
60
+ ```ruby
61
+ r = JSON.parse(spotify_api_json_response, :symbolize_names => true) # hash with symbols as keys
62
+ ```
63
+
64
+ ### Wrapper
65
+
66
+ ```ruby
67
+ w = Spof::Wrapper.new
68
+ w.artist.search('nine inch nails') # album/artist/track. First page album results
69
+ # => [{:href=>"spotify:artist:0X380XXQSNBYuleKzav5UO", :name=>"Nine Inch Nails", :popularity=>"0.64"}]
70
+ w.all.album.search('nine inch nails')
71
+ # => list of all found albums
72
+ ```
73
+
74
+ License
75
+ -------
76
+
77
+ See LICENSE file.
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require "rake/testtask"
3
3
 
4
4
  Rake::TestTask.new(:test) do |test|
5
5
  test.libs << 'test'
6
- test.test_files = FileList['test/*.rb']
6
+ test.test_files = FileList['test/test_*.rb']
7
7
  end
8
8
 
9
9
  desc "Run tests"
data/lib/spof.rb CHANGED
@@ -1,24 +1,24 @@
1
- require "spof/version"
2
- require "search"
3
- require "lookup"
4
- require "wrapper"
5
-
6
- require "net/http"
7
- require "json"
8
-
9
- module Spof
10
-
11
- @@testing = false
12
-
13
- def self.config(options = {})
14
- @@testing = options[:testing] || false
15
- end
16
-
17
- def self.testing?
18
- @@testing
19
- end
20
-
21
- class SpofError < StandardError
22
- end
23
-
1
+ require "spof/version"
2
+ require "search"
3
+ require "lookup"
4
+ require "wrapper"
5
+
6
+ require "net/http"
7
+ require "json"
8
+
9
+ module Spof
10
+
11
+ @@testing = false
12
+
13
+ def self.config(options = {})
14
+ @@testing = options[:testing] || false
15
+ end
16
+
17
+ def self.testing?
18
+ @@testing
19
+ end
20
+
21
+ class SpofError < StandardError
22
+ end
23
+
24
24
  end
data/lib/spof/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Spof
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
data/spof.gemspec CHANGED
@@ -1,23 +1,23 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'spof/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "spof"
8
- spec.version = Spof::VERSION
9
- spec.authors = ["Ignacio Contreras"]
10
- spec.email = ["ignacio@ignacio.cat"]
11
- spec.description = %q{Spotify Search & Lookup API Ruby wrapper}
12
- spec.summary = %q{Spotify Search & Lookup}
13
- spec.homepage = "http://github.com/ignaciocontreras/spof"
14
- spec.license = "MIT"
15
-
16
- spec.files = `git ls-files`.split($/)
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
20
-
21
- spec.add_development_dependency "bundler", "~> 1.2"
22
- spec.add_development_dependency "rake"
23
- end
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'spof/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "spof"
8
+ spec.version = Spof::VERSION
9
+ spec.authors = ["Ignacio Contreras Pinilla"]
10
+ spec.email = ["ignacio@ignacio.cat"]
11
+ spec.description = %q{Spotify Search & Lookup API Ruby wrapper}
12
+ spec.summary = %q{Spotify Search & Lookup}
13
+ spec.homepage = "http://github.com/ignc/spof"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.2"
22
+ spec.add_development_dependency "rake"
23
+ end
@@ -1,117 +1,117 @@
1
- require 'spof'
2
- require 'test/unit'
3
-
4
-
5
- class TestBasic < Test::Unit::TestCase
6
-
7
- def setup
8
- Spof.config({
9
- :testing => true
10
- })
11
- end
12
-
13
- def test_search_album_request_ok
14
- expected = 'http://ws.spotify.com/search/1/album.json?q=nine+inch+nails&page=1'
15
- actual = Spof::Search.album('nine inch nails')
16
- assert_equal expected, actual
17
- end
18
-
19
- def test_search_artist_request_ok
20
- expected = 'http://ws.spotify.com/search/1/artist.json?q=david+bowie&page=1'
21
- actual = Spof::Search.artist('david bowie')
22
- assert_equal expected, actual
23
- end
24
-
25
- def test_search_track_request_ok
26
- expected = 'http://ws.spotify.com/search/1/track.json?q=life+on+mars&page=1'
27
- actual = Spof::Search.track('life on mars')
28
- assert_equal expected, actual
29
- end
30
-
31
- def test_lookup_get_album_request_ok
32
- expected = 'http://ws.spotify.com/lookup/1/?uri=spotify:album:40pUoRK9pOn3tMoXY02fUB'
33
- real = Spof::Lookup.get('spotify:album:40pUoRK9pOn3tMoXY02fUB')
34
- assert expected, real
35
- end
36
-
37
- def test_lookup_get_artist_request_ok
38
- expected = 'http://ws.spotify.com/lookup/1/?uri=spotify:artist:0oSGxfWSnnOXhD2fKuz2Gy'
39
- real = Spof::Lookup.get('spotify:artist:0oSGxfWSnnOXhD2fKuz2Gy')
40
- assert expected, real
41
- end
42
-
43
- def test_lookup_get_track_request_ok
44
- expected = 'http://ws.spotify.com/lookup/1/?uri=spotify:track:2Z9vxEQVzEdj5Ph9JLUzDo'
45
- real = Spof::Lookup.get('spotify:track:2Z9vxEQVzEdj5Ph9JLUzDo')
46
- assert expected, real
47
- end
48
-
49
- def test_lookup_album_request_no_extras_ok
50
- expected = 'http://ws.spotify.com/lookup/1/?uri=spotify:album:40pUoRK9pOn3tMoXY02fUB'
51
- real = Spof::Lookup.album('spotify:album:40pUoRK9pOn3tMoXY02fUB')
52
- assert expected, real
53
- end
54
-
55
- def test_lookup_artist_request_no_extras_ok
56
- expected = 'http://ws.spotify.com/lookup/1/?uri=spotify:artist:0oSGxfWSnnOXhD2fKuz2Gy'
57
- real = Spof::Lookup.artist('spotify:artist:0oSGxfWSnnOXhD2fKuz2Gy')
58
- assert expected, real
59
- end
60
-
61
- def test_lookup_track_request_no_extras_ok
62
- expected = 'http://ws.spotify.com/lookup/1/?uri=spotify:track:2Z9vxEQVzEdj5Ph9JLUzDo'
63
- real = Spof::Lookup.track('spotify:track:2Z9vxEQVzEdj5Ph9JLUzDo')
64
- assert expected, real
65
- end
66
-
67
- def test_lookup_album_request_track_extra_ok
68
- expected = 'http://ws.spotify.com/lookup/1/?uri=spotify:album:40pUoRK9pOn3tMoXY02fUB&extras=track'
69
- real = Spof::Lookup.album('spotify:album:40pUoRK9pOn3tMoXY02fUB', :track)
70
- assert expected, real
71
- end
72
-
73
- def test_lookup_album_request_trackdetail_extra_ok
74
- expected = 'http://ws.spotify.com/lookup/1/?uri=spotify:album:40pUoRK9pOn3tMoXY02fUB&extras=trackdetail'
75
- real = Spof::Lookup.album('spotify:album:40pUoRK9pOn3tMoXY02fUB', :trackdetail)
76
- assert expected, real
77
- end
78
-
79
- def test_lookup_artist_request_album_extra_ok
80
- expected = 'http://ws.spotify.com/lookup/1/?uri=spotify:artist:0oSGxfWSnnOXhD2fKuz2Gy&extras=album'
81
- real = Spof::Lookup.artist('spotify:artist:0oSGxfWSnnOXhD2fKuz2Gy', :album)
82
- assert expected, real
83
- end
84
-
85
- def test_lookup_artist_request_albumdetail_extra_ok
86
- expected = 'http://ws.spotify.com/lookup/1/?uri=spotify:artist:0oSGxfWSnnOXhD2fKuz2Gy&extras=albumdetail'
87
- real = Spof::Lookup.artist('spotify:artist:0oSGxfWSnnOXhD2fKuz2Gy', :albumdetail)
88
- assert expected, real
89
- end
90
-
91
- def test_lookup_album_request_both_extras_ok
92
- expected = 'http://ws.spotify.com/lookup/1/?uri=spotify:album:40pUoRK9pOn3tMoXY02fUB&extras=track,trackdetail'
93
- real = Spof::Lookup.album('spotify:album:40pUoRK9pOn3tMoXY02fUB', :track, :trackdetail)
94
- assert expected, real
95
- end
96
-
97
- def test_lookup_artist_request_both_extras_ok
98
- expected = 'http://ws.spotify.com/lookup/1/?uri=spotify:artist:0oSGxfWSnnOXhD2fKuz2Gy&extras=album,albumdetail'
99
- real = Spof::Lookup.artist('spotify:artist:0oSGxfWSnnOXhD2fKuz2Gy', :album, :albumdetail)
100
- assert expected, real
101
- end
102
-
103
- def test_lookup_album_illegal_extra_error
104
-
105
- assert_raise (Spof::SpofError) {
106
- Spof::Lookup.album('spotify:album:40pUoRK9pOn3tMoXY02fUB', :track, :illegal)
107
- }
108
-
109
- end
110
-
111
- def test_lookup_artist_illegal_extra_error
112
- assert_raise (Spof::SpofError) {
113
- Spof::Lookup.artist('spotify:artist:0oSGxfWSnnOXhD2fKuz2Gy', :album, :illegal)
114
- }
115
- end
116
-
1
+ require 'spof'
2
+ require 'test/unit'
3
+
4
+
5
+ class TestBasic < Test::Unit::TestCase
6
+
7
+ def setup
8
+ Spof.config({
9
+ :testing => true
10
+ })
11
+ end
12
+
13
+ def test_search_album_request_ok
14
+ expected = 'http://ws.spotify.com/search/1/album.json?q=nine+inch+nails&page=1'
15
+ actual = Spof::Search.album('nine inch nails')
16
+ assert_equal expected, actual
17
+ end
18
+
19
+ def test_search_artist_request_ok
20
+ expected = 'http://ws.spotify.com/search/1/artist.json?q=david+bowie&page=1'
21
+ actual = Spof::Search.artist('david bowie')
22
+ assert_equal expected, actual
23
+ end
24
+
25
+ def test_search_track_request_ok
26
+ expected = 'http://ws.spotify.com/search/1/track.json?q=life+on+mars&page=1'
27
+ actual = Spof::Search.track('life on mars')
28
+ assert_equal expected, actual
29
+ end
30
+
31
+ def test_lookup_get_album_request_ok
32
+ expected = 'http://ws.spotify.com/lookup/1/?uri=spotify:album:40pUoRK9pOn3tMoXY02fUB'
33
+ real = Spof::Lookup.get('spotify:album:40pUoRK9pOn3tMoXY02fUB')
34
+ assert expected, real
35
+ end
36
+
37
+ def test_lookup_get_artist_request_ok
38
+ expected = 'http://ws.spotify.com/lookup/1/?uri=spotify:artist:0oSGxfWSnnOXhD2fKuz2Gy'
39
+ real = Spof::Lookup.get('spotify:artist:0oSGxfWSnnOXhD2fKuz2Gy')
40
+ assert expected, real
41
+ end
42
+
43
+ def test_lookup_get_track_request_ok
44
+ expected = 'http://ws.spotify.com/lookup/1/?uri=spotify:track:2Z9vxEQVzEdj5Ph9JLUzDo'
45
+ real = Spof::Lookup.get('spotify:track:2Z9vxEQVzEdj5Ph9JLUzDo')
46
+ assert expected, real
47
+ end
48
+
49
+ def test_lookup_album_request_no_extras_ok
50
+ expected = 'http://ws.spotify.com/lookup/1/?uri=spotify:album:40pUoRK9pOn3tMoXY02fUB'
51
+ real = Spof::Lookup.album('spotify:album:40pUoRK9pOn3tMoXY02fUB')
52
+ assert expected, real
53
+ end
54
+
55
+ def test_lookup_artist_request_no_extras_ok
56
+ expected = 'http://ws.spotify.com/lookup/1/?uri=spotify:artist:0oSGxfWSnnOXhD2fKuz2Gy'
57
+ real = Spof::Lookup.artist('spotify:artist:0oSGxfWSnnOXhD2fKuz2Gy')
58
+ assert expected, real
59
+ end
60
+
61
+ def test_lookup_track_request_no_extras_ok
62
+ expected = 'http://ws.spotify.com/lookup/1/?uri=spotify:track:2Z9vxEQVzEdj5Ph9JLUzDo'
63
+ real = Spof::Lookup.track('spotify:track:2Z9vxEQVzEdj5Ph9JLUzDo')
64
+ assert expected, real
65
+ end
66
+
67
+ def test_lookup_album_request_track_extra_ok
68
+ expected = 'http://ws.spotify.com/lookup/1/?uri=spotify:album:40pUoRK9pOn3tMoXY02fUB&extras=track'
69
+ real = Spof::Lookup.album('spotify:album:40pUoRK9pOn3tMoXY02fUB', :track)
70
+ assert expected, real
71
+ end
72
+
73
+ def test_lookup_album_request_trackdetail_extra_ok
74
+ expected = 'http://ws.spotify.com/lookup/1/?uri=spotify:album:40pUoRK9pOn3tMoXY02fUB&extras=trackdetail'
75
+ real = Spof::Lookup.album('spotify:album:40pUoRK9pOn3tMoXY02fUB', :trackdetail)
76
+ assert expected, real
77
+ end
78
+
79
+ def test_lookup_artist_request_album_extra_ok
80
+ expected = 'http://ws.spotify.com/lookup/1/?uri=spotify:artist:0oSGxfWSnnOXhD2fKuz2Gy&extras=album'
81
+ real = Spof::Lookup.artist('spotify:artist:0oSGxfWSnnOXhD2fKuz2Gy', :album)
82
+ assert expected, real
83
+ end
84
+
85
+ def test_lookup_artist_request_albumdetail_extra_ok
86
+ expected = 'http://ws.spotify.com/lookup/1/?uri=spotify:artist:0oSGxfWSnnOXhD2fKuz2Gy&extras=albumdetail'
87
+ real = Spof::Lookup.artist('spotify:artist:0oSGxfWSnnOXhD2fKuz2Gy', :albumdetail)
88
+ assert expected, real
89
+ end
90
+
91
+ def test_lookup_album_request_both_extras_ok
92
+ expected = 'http://ws.spotify.com/lookup/1/?uri=spotify:album:40pUoRK9pOn3tMoXY02fUB&extras=track,trackdetail'
93
+ real = Spof::Lookup.album('spotify:album:40pUoRK9pOn3tMoXY02fUB', :track, :trackdetail)
94
+ assert expected, real
95
+ end
96
+
97
+ def test_lookup_artist_request_both_extras_ok
98
+ expected = 'http://ws.spotify.com/lookup/1/?uri=spotify:artist:0oSGxfWSnnOXhD2fKuz2Gy&extras=album,albumdetail'
99
+ real = Spof::Lookup.artist('spotify:artist:0oSGxfWSnnOXhD2fKuz2Gy', :album, :albumdetail)
100
+ assert expected, real
101
+ end
102
+
103
+ def test_lookup_album_illegal_extra_error
104
+
105
+ assert_raise (Spof::SpofError) {
106
+ Spof::Lookup.album('spotify:album:40pUoRK9pOn3tMoXY02fUB', :track, :illegal)
107
+ }
108
+
109
+ end
110
+
111
+ def test_lookup_artist_illegal_extra_error
112
+ assert_raise (Spof::SpofError) {
113
+ Spof::Lookup.artist('spotify:artist:0oSGxfWSnnOXhD2fKuz2Gy', :album, :illegal)
114
+ }
115
+ end
116
+
117
117
  end
@@ -1,41 +1,41 @@
1
- require 'spof'
2
- require 'test/unit'
3
-
4
- class TestBasicWrapper < Test::Unit::TestCase
5
-
6
- def setup
7
- @w = Spof::Wrapper.new :testing => false # testing actual responses!
8
- end
9
-
10
- def test_search_album_response
11
- expected = Spof::Search.album('space oddity')[:albums]
12
- real = @w.album.search('space oddity')
13
- assert_equal expected, real
14
- end
15
-
16
- def test_search_artist_response
17
- expected = Spof::Search.artist('david bowie')[:artists]
18
- real = @w.artist.search('david bowie')
19
- assert_equal expected, real
20
- end
21
-
22
- def test_search_track_response
23
- expected = Spof::Search.track('life on mars')[:tracks]
24
- real = @w.track.search('life on mars')
25
- assert_equal expected, real
26
- end
27
-
28
- def test_all_search_response
29
- expected = []
30
- page = 0
31
- loop do
32
- res = Spof::Search.album('nine inch nails', page)[:albums]
33
- page += 1
34
- expected |= res
35
- break if res.empty?
36
- end
37
- real = @w.album.all.search('nine inch nails')
38
- assert_equal expected, real
39
- end
40
-
1
+ require 'spof'
2
+ require 'test/unit'
3
+
4
+ class TestBasicWrapper < Test::Unit::TestCase
5
+
6
+ def setup
7
+ @w = Spof::Wrapper.new :testing => false # testing actual responses!
8
+ end
9
+
10
+ def test_search_album_response
11
+ expected = Spof::Search.album('space oddity')[:albums]
12
+ real = @w.album.search('space oddity')
13
+ assert_equal expected, real
14
+ end
15
+
16
+ def test_search_artist_response
17
+ expected = Spof::Search.artist('david bowie')[:artists]
18
+ real = @w.artist.search('david bowie')
19
+ assert_equal expected, real
20
+ end
21
+
22
+ def test_search_track_response
23
+ expected = Spof::Search.track('life on mars')[:tracks]
24
+ real = @w.track.search('life on mars')
25
+ assert_equal expected, real
26
+ end
27
+
28
+ def test_all_search_response
29
+ expected = []
30
+ page = 0
31
+ loop do
32
+ res = Spof::Search.album('nine inch nails', page)[:albums]
33
+ page += 1
34
+ expected |= res
35
+ break if res.empty?
36
+ end
37
+ real = @w.album.all.search('nine inch nails')
38
+ assert_equal expected, real
39
+ end
40
+
41
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spof
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
- - Ignacio Contreras
7
+ - Ignacio Contreras Pinilla
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-01 00:00:00.000000000 Z
11
+ date: 2013-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -60,7 +60,7 @@ files:
60
60
  - test/test_search_and_lookup.rb
61
61
  - test/test_wrapper.rb
62
62
  - test/test_wrapper_basic_search.rb
63
- homepage: http://github.com/ignaciocontreras/spof
63
+ homepage: http://github.com/ignc/spof
64
64
  licenses:
65
65
  - MIT
66
66
  metadata: {}