-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
45e154d
commit 3a91a56
Showing
20 changed files
with
440 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,47 @@ | ||
module Scrobbler2 | ||
class User < Base | ||
|
||
def initialize(username) | ||
@username = username | ||
def initialize() | ||
@query = {}#TODO eg. {:artist => artist, :track => track} | ||
end | ||
|
||
def info(options={}, query={}) | ||
return @info if @info && !options[:force] | ||
@info = self.class.get_with_auth("user.getinfo", query, options)["lfm"]["user"] | ||
end | ||
|
||
|
||
get_resource :events, :root => "events" | ||
|
||
get_resource :info, :root => "info" | ||
|
||
get_resource :friends, :root => "friends" | ||
|
||
get_resource :loved_tracks, :root => "loved_tracks" | ||
|
||
get_resource :neighbours, :root => "neighbours" | ||
|
||
get_resource :past_events, :root => "past_events" | ||
|
||
get_resource :playlists, :root => "playlists" | ||
|
||
get_resource :recent_tracks, :root => "recent_tracks" | ||
|
||
get_resource :recommended_artists, :root => "recommended_artists" | ||
|
||
get_resource :recommended_events, :root => "recommended_events" | ||
|
||
get_resource :shouts, :root => "shouts" | ||
|
||
get_resource :top_albums, :root => "top_albums" | ||
|
||
get_resource :top_artists, :root => "top_artists" | ||
|
||
get_resource :top_tags, :root => "top_tags" | ||
|
||
get_resource :top_tracks, :root => "top_tracks" | ||
|
||
get_resource :weekly_album_chart, :root => "weekly_album_chart" | ||
|
||
get_resource :weekly_artist_chart, :root => "weekly_artist_chart" | ||
|
||
get_resource :weekly_chart_list, :root => "weekly_chart_list" | ||
|
||
get_resource :weekly_track_chart, :root => "weekly_track_chart" | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require File.dirname(__FILE__) + '/../test_helper.rb' | ||
|
||
describe "events for user ..." do | ||
|
||
before(:all) do #We only want to hit the webservice once. | ||
@user = Scrobbler2::user.new "..." | ||
@events = @user.events | ||
end | ||
|
||
it "should be hash" do | ||
@events.should be_kind_of Hash | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require File.dirname(__FILE__) + '/../test_helper.rb' | ||
|
||
describe "friends for user ..." do | ||
|
||
before(:all) do #We only want to hit the webservice once. | ||
@user = Scrobbler2::user.new "..." | ||
@friends = @user.friends | ||
end | ||
|
||
it "should be hash" do | ||
@friends.should be_kind_of Hash | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require File.dirname(__FILE__) + '/../test_helper.rb' | ||
|
||
describe "loved_tracks for user ..." do | ||
|
||
before(:all) do #We only want to hit the webservice once. | ||
@user = Scrobbler2::user.new "..." | ||
@loved_tracks = @user.loved_tracks | ||
end | ||
|
||
it "should be hash" do | ||
@loved_tracks.should be_kind_of Hash | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require File.dirname(__FILE__) + '/../test_helper.rb' | ||
|
||
describe "neighbours for user ..." do | ||
|
||
before(:all) do #We only want to hit the webservice once. | ||
@user = Scrobbler2::user.new "..." | ||
@neighbours = @user.neighbours | ||
end | ||
|
||
it "should be hash" do | ||
@neighbours.should be_kind_of Hash | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require File.dirname(__FILE__) + '/../test_helper.rb' | ||
|
||
describe "past_events for user ..." do | ||
|
||
before(:all) do #We only want to hit the webservice once. | ||
@user = Scrobbler2::user.new "..." | ||
@past_events = @user.past_events | ||
end | ||
|
||
it "should be hash" do | ||
@past_events.should be_kind_of Hash | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require File.dirname(__FILE__) + '/../test_helper.rb' | ||
|
||
describe "playlists for user ..." do | ||
|
||
before(:all) do #We only want to hit the webservice once. | ||
@user = Scrobbler2::user.new "..." | ||
@playlists = @user.playlists | ||
end | ||
|
||
it "should be hash" do | ||
@playlists.should be_kind_of Hash | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require File.dirname(__FILE__) + '/../test_helper.rb' | ||
|
||
describe "recent_tracks for user ..." do | ||
|
||
before(:all) do #We only want to hit the webservice once. | ||
@user = Scrobbler2::user.new "..." | ||
@recent_tracks = @user.recent_tracks | ||
end | ||
|
||
it "should be hash" do | ||
@recent_tracks.should be_kind_of Hash | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require File.dirname(__FILE__) + '/../test_helper.rb' | ||
|
||
describe "recommended_artists for user ..." do | ||
|
||
before(:all) do #We only want to hit the webservice once. | ||
@user = Scrobbler2::user.new "..." | ||
@recommended_artists = @user.recommended_artists | ||
end | ||
|
||
it "should be hash" do | ||
@recommended_artists.should be_kind_of Hash | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require File.dirname(__FILE__) + '/../test_helper.rb' | ||
|
||
describe "recommended_events for user ..." do | ||
|
||
before(:all) do #We only want to hit the webservice once. | ||
@user = Scrobbler2::user.new "..." | ||
@recommended_events = @user.recommended_events | ||
end | ||
|
||
it "should be hash" do | ||
@recommended_events.should be_kind_of Hash | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require File.dirname(__FILE__) + '/../test_helper.rb' | ||
|
||
describe "shouts for user ..." do | ||
|
||
before(:all) do #We only want to hit the webservice once. | ||
@user = Scrobbler2::user.new "..." | ||
@shouts = @user.shouts | ||
end | ||
|
||
it "should be hash" do | ||
@shouts.should be_kind_of Hash | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require File.dirname(__FILE__) + '/../test_helper.rb' | ||
|
||
describe "top_albums for user ..." do | ||
|
||
before(:all) do #We only want to hit the webservice once. | ||
@user = Scrobbler2::user.new "..." | ||
@top_albums = @user.top_albums | ||
end | ||
|
||
it "should be hash" do | ||
@top_albums.should be_kind_of Hash | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require File.dirname(__FILE__) + '/../test_helper.rb' | ||
|
||
describe "top_artists for user ..." do | ||
|
||
before(:all) do #We only want to hit the webservice once. | ||
@user = Scrobbler2::user.new "..." | ||
@top_artists = @user.top_artists | ||
end | ||
|
||
it "should be hash" do | ||
@top_artists.should be_kind_of Hash | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require File.dirname(__FILE__) + '/../test_helper.rb' | ||
|
||
describe "top_tags for user ..." do | ||
|
||
before(:all) do #We only want to hit the webservice once. | ||
@user = Scrobbler2::user.new "..." | ||
@top_tags = @user.top_tags | ||
end | ||
|
||
it "should be hash" do | ||
@top_tags.should be_kind_of Hash | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require File.dirname(__FILE__) + '/../test_helper.rb' | ||
|
||
describe "top_tracks for user ..." do | ||
|
||
before(:all) do #We only want to hit the webservice once. | ||
@user = Scrobbler2::user.new "..." | ||
@top_tracks = @user.top_tracks | ||
end | ||
|
||
it "should be hash" do | ||
@top_tracks.should be_kind_of Hash | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require File.dirname(__FILE__) + '/../test_helper.rb' | ||
|
||
describe "weekly_album_chart for user ..." do | ||
|
||
before(:all) do #We only want to hit the webservice once. | ||
@user = Scrobbler2::user.new "..." | ||
@weekly_album_chart = @user.weekly_album_chart | ||
end | ||
|
||
it "should be hash" do | ||
@weekly_album_chart.should be_kind_of Hash | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require File.dirname(__FILE__) + '/../test_helper.rb' | ||
|
||
describe "weekly_artist_chart for user ..." do | ||
|
||
before(:all) do #We only want to hit the webservice once. | ||
@user = Scrobbler2::user.new "..." | ||
@weekly_artist_chart = @user.weekly_artist_chart | ||
end | ||
|
||
it "should be hash" do | ||
@weekly_artist_chart.should be_kind_of Hash | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require File.dirname(__FILE__) + '/../test_helper.rb' | ||
|
||
describe "weekly_chart_list for user ..." do | ||
|
||
before(:all) do #We only want to hit the webservice once. | ||
@user = Scrobbler2::user.new "..." | ||
@weekly_chart_list = @user.weekly_chart_list | ||
end | ||
|
||
it "should be hash" do | ||
@weekly_chart_list.should be_kind_of Hash | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require File.dirname(__FILE__) + '/../test_helper.rb' | ||
|
||
describe "weekly_track_chart for user ..." do | ||
|
||
before(:all) do #We only want to hit the webservice once. | ||
@user = Scrobbler2::user.new "..." | ||
@weekly_track_chart = @user.weekly_track_chart | ||
end | ||
|
||
it "should be hash" do | ||
@weekly_track_chart.should be_kind_of Hash | ||
end | ||
|
||
end |
Oops, something went wrong.