bts-scrobbler2 0.0.4
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.
- data/README.rdoc +155 -0
- data/Rakefile +8 -0
- data/VERSION.yml +4 -0
- data/generators/acceptance_test/USAGE +9 -0
- data/generators/acceptance_test/acceptance_test_generator.rb +57 -0
- data/generators/acceptance_test/templates/acceptance_test.rb.erb +14 -0
- data/generators/resource/USAGE +8 -0
- data/generators/resource/resource_generator.rb +47 -0
- data/generators/resource/templates/resource.rb.erb +11 -0
- data/generators/resource/templates/spec.rb.erb +22 -0
- data/lib/scrobbler2.rb +23 -0
- data/lib/scrobbler2/album.rb +11 -0
- data/lib/scrobbler2/artist.rb +26 -0
- data/lib/scrobbler2/auth.rb +19 -0
- data/lib/scrobbler2/base.rb +100 -0
- data/lib/scrobbler2/event.rb +12 -0
- data/lib/scrobbler2/geo.rb +15 -0
- data/lib/scrobbler2/group.rb +14 -0
- data/lib/scrobbler2/library.rb +12 -0
- data/lib/scrobbler2/playlist.rb +10 -0
- data/lib/scrobbler2/tag.rb +18 -0
- data/lib/scrobbler2/track.rb +13 -0
- data/lib/scrobbler2/user.rb +29 -0
- data/lib/scrobbler2/venue.rb +12 -0
- data/test/acceptance/album/info_test.rb +56 -0
- data/test/acceptance/artist/add_tags_test.rb +14 -0
- data/test/acceptance/artist/events_test.rb +47 -0
- data/test/acceptance/artist/info_test.rb +53 -0
- data/test/acceptance/artist/shouts_test.rb +48 -0
- data/test/acceptance/artist/similar_artists_test.rb +20 -0
- data/test/acceptance/artist/tags_test.rb +24 -0
- data/test/acceptance/artist/top_albums_test.rb +34 -0
- data/test/acceptance/artist/top_fans.rb +19 -0
- data/test/acceptance/artist/top_tags.rb +18 -0
- data/test/acceptance/artist/top_tracks.rb +47 -0
- data/test/acceptance/auth/auth_test.rb +21 -0
- data/test/acceptance/event/info_test.rb +66 -0
- data/test/acceptance/event/shouts_test.rb +49 -0
- data/test/acceptance/geo/events_test.rb +14 -0
- data/test/acceptance/geo/top_artists_test.rb +16 -0
- data/test/acceptance/geo/top_tracks_test.rb +16 -0
- data/test/acceptance/group/members_test.rb +60 -0
- data/test/acceptance/group/weekly_album_chart_test.rb +61 -0
- data/test/acceptance/group/weekly_artist_chart_test.rb +54 -0
- data/test/acceptance/group/weekly_chart_list_test.rb +39 -0
- data/test/acceptance/group/weekly_track_chart_test.rb +61 -0
- data/test/acceptance/library/albums_test.rb +34 -0
- data/test/acceptance/library/artists_test.rb +33 -0
- data/test/acceptance/library/tracks_test.rb +33 -0
- data/test/acceptance/playlist/fetch_test.rb +68 -0
- data/test/acceptance/shared/album.rb +41 -0
- data/test/acceptance/shared/artist.rb +16 -0
- data/test/acceptance/shared/paged_result.rb +16 -0
- data/test/acceptance/shared/top_fans.rb +29 -0
- data/test/acceptance/shared/top_tags.rb +23 -0
- data/test/acceptance/shared/track.rb +23 -0
- data/test/acceptance/tag/similar_test.rb +15 -0
- data/test/acceptance/tag/top_albums_test.rb +37 -0
- data/test/acceptance/tag/top_artists_test.rb +31 -0
- data/test/acceptance/tag/top_tags_test.rb +32 -0
- data/test/acceptance/tag/top_tracks_test.rb +33 -0
- data/test/acceptance/tag/weekly_artist_chart.rb +54 -0
- data/test/acceptance/tag/weekly_chart_list.rb +39 -0
- data/test/acceptance/test_helper.rb +15 -0
- data/test/acceptance/track/info_test.rb +47 -0
- data/test/acceptance/track/similar_test.rb +22 -0
- data/test/acceptance/track/top_fans_test.rb +23 -0
- data/test/acceptance/track/top_tags_test.rb +24 -0
- data/test/acceptance/user/events_test.rb +27 -0
- data/test/acceptance/user/friends_test.rb +14 -0
- data/test/acceptance/user/info_test.rb +19 -0
- data/test/acceptance/user/loved_tracks_test.rb +14 -0
- data/test/acceptance/user/neighbours_test.rb +14 -0
- data/test/acceptance/user/past_events_test.rb +14 -0
- data/test/acceptance/user/playlists_test.rb +14 -0
- data/test/acceptance/user/recent_tracks_test.rb +14 -0
- data/test/acceptance/user/recommended_artists_test.rb +16 -0
- data/test/acceptance/user/recommended_events_test.rb +16 -0
- data/test/acceptance/user/shouts_test.rb +14 -0
- data/test/acceptance/user/top_albums_test.rb +14 -0
- data/test/acceptance/user/top_artists_test.rb +14 -0
- data/test/acceptance/user/top_tags_test.rb +14 -0
- data/test/acceptance/user/top_tracks_test.rb +14 -0
- data/test/acceptance/user/weekly_album_chart_test.rb +14 -0
- data/test/acceptance/user/weekly_artist_chart_test.rb +14 -0
- data/test/acceptance/user/weekly_chart_list_test.rb +14 -0
- data/test/acceptance/user/weekly_track_chart_test.rb +14 -0
- data/test/acceptance/venue/events_test.rb +14 -0
- data/test/acceptance/venue/past_events_test.rb +14 -0
- data/test/generators/test_acceptance_test_generator.rb +46 -0
- data/test/generators/test_generator_helper.rb +29 -0
- data/test/generators/test_resource_generator.rb +71 -0
- data/test/unit/album_spec.rb +17 -0
- data/test/unit/artist_spec.rb +62 -0
- data/test/unit/auth_spec.rb +22 -0
- data/test/unit/base_spec.rb +193 -0
- data/test/unit/event_spec.rb +23 -0
- data/test/unit/geo_spec.rb +36 -0
- data/test/unit/group_spec.rb +38 -0
- data/test/unit/library_spec.rb +27 -0
- data/test/unit/playlist_spec.rb +18 -0
- data/test/unit/spec_helper.rb +7 -0
- data/test/unit/tag_spec.rb +50 -0
- data/test/unit/track_spec.rb +33 -0
- data/test/unit/user_spec.rb +148 -0
- data/test/unit/venue_spec.rb +29 -0
- metadata +260 -0
@@ -0,0 +1,39 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper.rb'
|
2
|
+
|
3
|
+
describe "Weekly chart list for group 'stubborn tiny lights'" do
|
4
|
+
|
5
|
+
before(:all) do #We only want to hit the webservice once.
|
6
|
+
@group = Scrobbler2::Group.new "stubborn tiny lights"
|
7
|
+
@list = @group.weekly_chart_list
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should be hash" do
|
11
|
+
@list.should be_kind_of Hash
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should have group 'stubborn tiny lights'" do
|
15
|
+
@list["group"].should == "stubborn tiny lights"
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
it "should have a list of charts" do
|
20
|
+
@list.should have_key('chart')
|
21
|
+
@list['chart'].should be_kind_of(Array)
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "chart" do
|
25
|
+
before(:each) do
|
26
|
+
@chart = @list['chart'][0]
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should have from" do
|
30
|
+
@chart.should have_key 'from'
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should have to" do
|
34
|
+
@chart.should have_key 'to'
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper.rb'
|
2
|
+
|
3
|
+
describe "Weekly track chart for group 'stubborn tiny lights'" do
|
4
|
+
|
5
|
+
before(:all) do #We only want to hit the webservice once.
|
6
|
+
@group = Scrobbler2::Group.new "stubborn tiny lights"
|
7
|
+
@chart = @group.weekly_track_chart
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should be hash" do
|
11
|
+
@chart.should be_kind_of Hash
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should have group 'stubborn tiny lights'" do
|
15
|
+
@chart["group"].should == "stubborn tiny lights"
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should have from" do
|
19
|
+
@chart.should have_key("from")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should have to" do
|
23
|
+
@chart.should have_key("to")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should have a list of trackss" do
|
27
|
+
@chart.should have_key('track')
|
28
|
+
@chart['track'].should be_kind_of(Array)
|
29
|
+
end
|
30
|
+
|
31
|
+
describe "track" do
|
32
|
+
before(:each) do
|
33
|
+
@track = @chart['track'][0]
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should have artist" do
|
37
|
+
@track.should have_key 'artist'
|
38
|
+
@track['artist'].should be_kind_of(Hash)
|
39
|
+
@track['artist'].should have_key('mbid')
|
40
|
+
@track['artist'].should have_key('#text')
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should have name" do
|
44
|
+
@track.should have_key 'name'
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should have mbid" do
|
48
|
+
@track.should have_key 'mbid'
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should have playcount" do
|
52
|
+
@track.should have_key 'playcount'
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should have url" do
|
56
|
+
@track.should have_key 'url'
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper.rb'
|
2
|
+
|
3
|
+
describe "Albums for library 'gingerhendrix'" do
|
4
|
+
|
5
|
+
before(:all) do #We only want to hit the webservice once.
|
6
|
+
@library = Scrobbler2::Library.new 'gingerhendrix'
|
7
|
+
@it = @library.albums
|
8
|
+
end
|
9
|
+
|
10
|
+
it { @it.should be_kind_of Hash }
|
11
|
+
|
12
|
+
it_should_behave_like "PagedResult"
|
13
|
+
|
14
|
+
it "should have user 'gingerhendrix'" do
|
15
|
+
@it["user"].should == "gingerhendrix"
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should have a list of albums" do
|
19
|
+
@it.should have_key('album')
|
20
|
+
@it['album'].should be_kind_of(Array)
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "Album" do
|
24
|
+
before(:each) do
|
25
|
+
@album = @it['album'][0]
|
26
|
+
end
|
27
|
+
|
28
|
+
it_should_behave_like "Album"
|
29
|
+
|
30
|
+
it { @album.should have_key 'playcount' }
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper.rb'
|
2
|
+
|
3
|
+
describe "Artists for library 'gingerhendrix'" do
|
4
|
+
|
5
|
+
before(:all) do #We only want to hit the webservice once.
|
6
|
+
@library = Scrobbler2::Library.new 'gingerhendrix'
|
7
|
+
@it = @library.artists
|
8
|
+
end
|
9
|
+
|
10
|
+
it { @it.should be_kind_of Hash }
|
11
|
+
|
12
|
+
it "should have user 'gingerhendrix'" do
|
13
|
+
@it["user"].should == "gingerhendrix"
|
14
|
+
end
|
15
|
+
|
16
|
+
it_should_behave_like "PagedResult"
|
17
|
+
|
18
|
+
it "should have a list of artists" do
|
19
|
+
@it.should have_key('artist')
|
20
|
+
@it['artist'].should be_kind_of(Array)
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "artist" do
|
24
|
+
before(:each) do
|
25
|
+
@artist = @it['artist'][0]
|
26
|
+
end
|
27
|
+
|
28
|
+
it_should_behave_like "Artist"
|
29
|
+
it { @artist.should have_key 'playcount' }
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper.rb'
|
2
|
+
|
3
|
+
describe "Tracks for library 'gingerhendrix'" do
|
4
|
+
|
5
|
+
before(:all) do #We only want to hit the webservice once.
|
6
|
+
@library = Scrobbler2::Library.new 'gingerhendrix'
|
7
|
+
@it = @library.tracks
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should be hash" do
|
11
|
+
@it.should be_kind_of Hash
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should have user 'gingerhendrix'" do
|
15
|
+
@it["user"].should == "gingerhendrix"
|
16
|
+
end
|
17
|
+
|
18
|
+
it_should_behave_like "PagedResult"
|
19
|
+
|
20
|
+
it "should have a list of tracks" do
|
21
|
+
@it.should have_key('track')
|
22
|
+
@it['track'].should be_kind_of(Array)
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "track" do
|
26
|
+
|
27
|
+
before(:each) { @track = @it['track'][0] }
|
28
|
+
|
29
|
+
it { @track.should have_key 'playcount' }
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper.rb'
|
2
|
+
|
3
|
+
describe "Playlist lastfm://playlist/album/2026126" do
|
4
|
+
|
5
|
+
before(:all) do #We only want to hit the webservice once.
|
6
|
+
@playlist = Scrobbler2::Playlist.new 'lastfm://playlist/album/2026126'
|
7
|
+
@info = @playlist.fetch
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should be hash" do
|
11
|
+
@info.should be_kind_of Hash
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should have title 'Cher - Believe'" do
|
15
|
+
@info["title"].should == "Cher - Believe"
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should have creator" do
|
19
|
+
@info.should have_key 'creator'
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should have date" do
|
23
|
+
@info.should have_key 'date'
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should have trackList" do
|
27
|
+
@info.should have_key 'trackList'
|
28
|
+
@info['trackList'].should be_kind_of Hash
|
29
|
+
@info['trackList'].should have_key 'track'
|
30
|
+
@info['trackList']['track'].should be_kind_of Array
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "track" do
|
34
|
+
before(:each) do
|
35
|
+
@track = @info['trackList']['track'][0]
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should have title" do
|
39
|
+
@track.should have_key 'title'
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should have identifier" do
|
43
|
+
@track.should have_key 'identifier'
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should have album" do
|
47
|
+
@track.should have_key 'album'
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should have creator" do
|
51
|
+
@track.should have_key 'creator'
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should have duration" do
|
55
|
+
@track.should have_key 'duration'
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should have info" do
|
59
|
+
@track.should have_key 'info'
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should have image" do
|
63
|
+
@track.should have_key 'image'
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
|
2
|
+
describe "Album", :shared => true do
|
3
|
+
it "should have name" do
|
4
|
+
@album.should have_key 'name'
|
5
|
+
end
|
6
|
+
|
7
|
+
it "should have mbid" do
|
8
|
+
@album.should have_key 'mbid'
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should have url" do
|
12
|
+
@album.should have_key 'url'
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should have artist" do
|
16
|
+
@album.should have_key 'artist'
|
17
|
+
@album['artist'].should be_kind_of(Hash)
|
18
|
+
@album['artist'].should have_key('mbid')
|
19
|
+
@album['artist'].should have_key('name')
|
20
|
+
@album['artist'].should have_key('url')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
describe "Album with simple artist and title", :shared => true do
|
26
|
+
it "should have title" do
|
27
|
+
@album.should have_key 'title'
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should have mbid" do
|
31
|
+
@album.should have_key 'mbid'
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should have url" do
|
35
|
+
@album.should have_key 'url'
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should have artist" do
|
39
|
+
@album.should have_key 'artist'
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
describe "Artist", :shared => true do
|
3
|
+
|
4
|
+
it "should have name" do
|
5
|
+
@artist.should have_key 'name'
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should have mbid" do
|
9
|
+
@artist.should have_key 'mbid'
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should have url" do
|
13
|
+
@artist.should have_key 'url'
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
describe "PagedResult", :shared => true do
|
3
|
+
|
4
|
+
it "should have page" do
|
5
|
+
@it.should have_key("page")
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should have perPage" do
|
9
|
+
@it.should have_key("perPage")
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should have totalPages" do
|
13
|
+
@it.should have_key("totalPages")
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
|
2
|
+
describe "Top Fans", :shared => true do
|
3
|
+
|
4
|
+
it "should have array of users" do
|
5
|
+
@fans.should have_key('user')
|
6
|
+
@fans['user'].should be_a_kind_of(Array)
|
7
|
+
@fans['user'].length.should > 0
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "a fan" do
|
11
|
+
|
12
|
+
before(:each) do
|
13
|
+
@fan = @fans['user'][0]
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should have a name" do
|
17
|
+
@fan.should have_key('name')
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should have a url" do
|
21
|
+
@fan.should have_key('url')
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should have a weight" do
|
25
|
+
@fan.should have_key('weight')
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
|
2
|
+
describe "Top Tags", :shared => true do
|
3
|
+
it "should have array of tags" do
|
4
|
+
@tags.should have_key('tag')
|
5
|
+
@tags['tag'].should be_a_kind_of(Array)
|
6
|
+
@tags['tag'].length.should > 0
|
7
|
+
end
|
8
|
+
|
9
|
+
describe "a tag" do
|
10
|
+
|
11
|
+
before(:each) do
|
12
|
+
@tag = @tags['tag'][0]
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should have a url" do
|
16
|
+
@tag.should have_key('url')
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should have a name" do
|
20
|
+
@tag.should have_key('name')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
|
2
|
+
describe "Track", :shared => true do
|
3
|
+
|
4
|
+
it "should have artist" do
|
5
|
+
@track.should have_key 'artist'
|
6
|
+
@track['artist'].should be_kind_of(Hash)
|
7
|
+
@track['artist'].should have_key('mbid')
|
8
|
+
@track['artist'].should have_key('name')
|
9
|
+
@track['artist'].should have_key('url')
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should have name" do
|
13
|
+
@track.should have_key 'name'
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should have mbid" do
|
17
|
+
@track.should have_key 'mbid'
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should have url" do
|
21
|
+
@track.should have_key 'url'
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper.rb'
|
2
|
+
|
3
|
+
describe "Similar tags for Disco" do
|
4
|
+
|
5
|
+
before(:all) do #We only want to hit the webservice once.
|
6
|
+
@tag = Scrobbler2::Tag.new "Disco"
|
7
|
+
@similar = @tag.similar
|
8
|
+
#puts "Similar: \n\n #{@similar.inspect} \n\n"
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should be an array of artists" do
|
12
|
+
pending "Currently Borken xml->hash conversion doesn't like nodes with attributes and children with the same name"
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|