lastfm 0.6.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -11,7 +11,7 @@ A Ruby interface for Last.fm Web Services v2.0
11
11
 
12
12
  # open 'http://www.last.fm/api/auth/?api_key=xxxxxxxxxxx&token=xxxxxxxx' and grant the application
13
13
 
14
- lastfm.session = lastfm.auth.get_session(token)
14
+ lastfm.session = lastfm.auth.get_session(token)['key']
15
15
 
16
16
  lastfm.track.love('Hujiko Pro', 'acid acid 7riddim')
17
17
  lastfm.track.scrobble('Hujiko Pro', 'acid acid 7riddim')
@@ -43,9 +43,14 @@ It supports methods which require {authentication}[http://www.last.fm/api/authen
43
43
  * {track.share}[http://www.lastfm.jp/api/show?service=305]
44
44
  * {track.updateNowPlaying}[http://www.lastfm.jp/api/show?service=454]
45
45
 
46
+ === Album
47
+
48
+ * {album.getInfo}[http://www.last.fm/api/show?service=290]
49
+
46
50
  === Artist
47
51
 
48
52
  * {artist.getEvents}[http://www.lastfm.jp/api/show?service=117]
53
+ * {artist.getInfo}[http://www.last.fm/api/show?service=267]
49
54
 
50
55
  === User
51
56
 
@@ -85,9 +90,10 @@ It supports methods which require {authentication}[http://www.last.fm/api/authen
85
90
  * {pipedreambomb}[https://github.com/pipedreambomb]
86
91
  * {dbolson}[https://github.com/dbolson]
87
92
  * {webs}[https://github.com/webs]
93
+ * {magnolia-fan}[https://github.com/magnolia-fan]
88
94
 
89
95
  == Note on Patches/Pull Requests
90
-
96
+
91
97
  * Fork the project.
92
98
  * Make your feature addition or bug fix.
93
99
  * Add tests for it. This is important so I don't break it in a
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.0
1
+ 1.0.1
data/lib/lastfm.rb CHANGED
@@ -9,6 +9,7 @@ require 'lastfm/method_category/base'
9
9
  require 'lastfm/method_category/auth'
10
10
  require 'lastfm/method_category/track'
11
11
  require 'lastfm/method_category/artist'
12
+ require 'lastfm/method_category/album'
12
13
  require 'lastfm/method_category/user'
13
14
  require 'lastfm/method_category/geo'
14
15
  require 'lastfm/method_category/library'
@@ -40,6 +41,10 @@ class Lastfm
40
41
  def artist
41
42
  MethodCategory::Artist.new(self)
42
43
  end
44
+
45
+ def album
46
+ MethodCategory::Album.new(self)
47
+ end
43
48
 
44
49
  def user
45
50
  MethodCategory::User.new(self)
@@ -57,6 +62,12 @@ class Lastfm
57
62
  params[:method] = method
58
63
  params[:api_key] = @api_key
59
64
 
65
+ params.each do |k, v|
66
+ if v.nil?
67
+ params.delete(k)
68
+ end
69
+ end
70
+
60
71
  # http://www.lastfm.jp/group/Last.fm+Web+Services/forum/21604/_/497978
61
72
  #params[:format] = format
62
73
 
@@ -0,0 +1,11 @@
1
+ class Lastfm
2
+ module MethodCategory
3
+ class Album < Base
4
+ regular_method :get_info, [:artist, :album], [] do |response|
5
+ result = response.xml['album']
6
+ result['releasedate'].lstrip!
7
+ result
8
+ end
9
+ end
10
+ end
11
+ end
@@ -1,6 +1,9 @@
1
1
  class Lastfm
2
2
  module MethodCategory
3
3
  class Artist < Base
4
+ regular_method :get_info, [:artist], [] do |response|
5
+ response.xml['artist']
6
+ end
4
7
  regular_method :get_events, [:artist], [] do |response|
5
8
  response.xml['events']['event']
6
9
  end
@@ -6,7 +6,7 @@ class Lastfm
6
6
  end
7
7
 
8
8
  method_for_authentication :get_session, [:token], [] do |response|
9
- response.xml['session']['key']
9
+ response.xml['session']
10
10
  end
11
11
  end
12
12
  end
@@ -6,8 +6,8 @@ class Lastfm
6
6
  write_method :ban, [:artist, :track]
7
7
  write_method :love, [:artist, :track]
8
8
  write_method :share, [:artist, :track, :recipient], [[:message, nil]]
9
- write_method :scrobble, [:artist, :track], [[:album, nil], [:timestamp, Time.now.utc.to_i]]
10
- write_method :update_now_playing, [:artist, :track]
9
+ write_method :scrobble, [:artist, :track], [[:timestamp, Time.now.utc.to_i], [:album, nil], [:trackNumber, nil], [:mbid, nil], [:duration, nil], [:albumArtist, nil]]
10
+ write_method :update_now_playing, [:artist, :track], [[:album, nil], [:trackNumber, nil], [:mbid, nil], [:duration, nil], [:albumArtist, nil]]
11
11
 
12
12
  regular_method :get_info, [:artist, :track], [[:username, nil]] do |response|
13
13
  response.xml['track']
@@ -8,7 +8,7 @@ class Lastfm
8
8
  regular_method :get_friends, [:user], [[:recenttracks, nil], [:limit, nil], [:page, nil]] do |response|
9
9
  response.xml['friends']['user']
10
10
  end
11
-
11
+
12
12
  regular_method :get_neighbours, [:user], [[:recenttracks, nil], [:limit, nil], [:page, nil]] do |response|
13
13
  neighbours = response.xml['neighbours']['user']
14
14
  #ignore first "user" as this is an attribute, not an object
@@ -0,0 +1,174 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <lfm status="ok">
3
+ <album>
4
+ <name>Believe</name>
5
+ <artist>Cher</artist>
6
+ <id>2026126</id>
7
+ <mbid>61bf0388-b8a9-48f4-81d1-7eb02706dfb0</mbid>
8
+ <url>http://www.last.fm/music/Cher/Believe</url>
9
+ <releasedate> 6 Apr 1999, 00:00</releasedate>
10
+ <image size="small">http://userserve-ak.last.fm/serve/34s/42806845.png</image>
11
+ <image size="medium">http://userserve-ak.last.fm/serve/64s/42806845.png</image>
12
+ <image size="large">http://userserve-ak.last.fm/serve/174s/42806845.png</image>
13
+ <image size="extralarge">http://userserve-ak.last.fm/serve/300x300/42806845.png</image>
14
+ <image size="mega">http://userserve-ak.last.fm/serve/_/42806845/Believe++600++600+PNG.png</image>
15
+ <listeners>179749</listeners>
16
+ <playcount>838056</playcount>
17
+ <tracks>
18
+ <track rank="1">
19
+ <name>Believe</name>
20
+ <duration>239</duration>
21
+ <mbid></mbid>
22
+ <url>http://www.last.fm/music/Cher/_/Believe</url>
23
+ <streamable fulltrack="0">1</streamable>
24
+ <artist>
25
+ <name>Cher</name>
26
+ <mbid>bfcc6d75-a6a5-4bc6-8282-47aec8531818</mbid>
27
+ <url>http://www.last.fm/music/Cher</url>
28
+ </artist>
29
+ </track> <track rank="2">
30
+ <name>The Power</name>
31
+ <duration>235</duration>
32
+ <mbid></mbid>
33
+ <url>http://www.last.fm/music/Cher/_/The+Power</url>
34
+ <streamable fulltrack="0">0</streamable>
35
+ <artist>
36
+ <name>Cher</name>
37
+ <mbid>bfcc6d75-a6a5-4bc6-8282-47aec8531818</mbid>
38
+ <url>http://www.last.fm/music/Cher</url>
39
+ </artist>
40
+ </track> <track rank="3">
41
+ <name>Runaway</name>
42
+ <duration>285</duration>
43
+ <mbid></mbid>
44
+ <url>http://www.last.fm/music/Cher/_/Runaway</url>
45
+ <streamable fulltrack="0">0</streamable>
46
+ <artist>
47
+ <name>Cher</name>
48
+ <mbid>bfcc6d75-a6a5-4bc6-8282-47aec8531818</mbid>
49
+ <url>http://www.last.fm/music/Cher</url>
50
+ </artist>
51
+ </track> <track rank="4">
52
+ <name>All Or Nothing</name>
53
+ <duration>237</duration>
54
+ <mbid></mbid>
55
+ <url>http://www.last.fm/music/Cher/_/All+Or+Nothing</url>
56
+ <streamable fulltrack="0">1</streamable>
57
+ <artist>
58
+ <name>Cher</name>
59
+ <mbid>bfcc6d75-a6a5-4bc6-8282-47aec8531818</mbid>
60
+ <url>http://www.last.fm/music/Cher</url>
61
+ </artist>
62
+ </track> <track rank="5">
63
+ <name>Strong Enough</name>
64
+ <duration>223</duration>
65
+ <mbid></mbid>
66
+ <url>http://www.last.fm/music/Cher/_/Strong+Enough</url>
67
+ <streamable fulltrack="0">1</streamable>
68
+ <artist>
69
+ <name>Cher</name>
70
+ <mbid>bfcc6d75-a6a5-4bc6-8282-47aec8531818</mbid>
71
+ <url>http://www.last.fm/music/Cher</url>
72
+ </artist>
73
+ </track> <track rank="6">
74
+ <name>Dov'è l'amore</name>
75
+ <duration>257</duration>
76
+ <mbid></mbid>
77
+ <url>http://www.last.fm/music/Cher/_/Dov%27%C3%A8+l%27amore</url>
78
+ <streamable fulltrack="0">0</streamable>
79
+ <artist>
80
+ <name>Cher</name>
81
+ <mbid>bfcc6d75-a6a5-4bc6-8282-47aec8531818</mbid>
82
+ <url>http://www.last.fm/music/Cher</url>
83
+ </artist>
84
+ </track> <track rank="7">
85
+ <name>Takin' Back My Heart</name>
86
+ <duration>271</duration>
87
+ <mbid></mbid>
88
+ <url>http://www.last.fm/music/Cher/_/Takin%27+Back+My+Heart</url>
89
+ <streamable fulltrack="0">0</streamable>
90
+ <artist>
91
+ <name>Cher</name>
92
+ <mbid>bfcc6d75-a6a5-4bc6-8282-47aec8531818</mbid>
93
+ <url>http://www.last.fm/music/Cher</url>
94
+ </artist>
95
+ </track> <track rank="8">
96
+ <name>Taxi Taxi</name>
97
+ <duration>302</duration>
98
+ <mbid></mbid>
99
+ <url>http://www.last.fm/music/Cher/_/Taxi+Taxi</url>
100
+ <streamable fulltrack="0">0</streamable>
101
+ <artist>
102
+ <name>Cher</name>
103
+ <mbid>bfcc6d75-a6a5-4bc6-8282-47aec8531818</mbid>
104
+ <url>http://www.last.fm/music/Cher</url>
105
+ </artist>
106
+ </track> <track rank="9">
107
+ <name>Love Is the Groove</name>
108
+ <duration>270</duration>
109
+ <mbid></mbid>
110
+ <url>http://www.last.fm/music/Cher/_/Love+Is+the+Groove</url>
111
+ <streamable fulltrack="0">0</streamable>
112
+ <artist>
113
+ <name>Cher</name>
114
+ <mbid>bfcc6d75-a6a5-4bc6-8282-47aec8531818</mbid>
115
+ <url>http://www.last.fm/music/Cher</url>
116
+ </artist>
117
+ </track> <track rank="10">
118
+ <name>We All Sleep Alone</name>
119
+ <duration>233</duration>
120
+ <mbid></mbid>
121
+ <url>http://www.last.fm/music/Cher/_/We+All+Sleep+Alone</url>
122
+ <streamable fulltrack="0">1</streamable>
123
+ <artist>
124
+ <name>Cher</name>
125
+ <mbid>bfcc6d75-a6a5-4bc6-8282-47aec8531818</mbid>
126
+ <url>http://www.last.fm/music/Cher</url>
127
+ </artist>
128
+ </track> </tracks>
129
+ <toptags>
130
+ <tag>
131
+ <name>pop</name>
132
+ <url>http://www.last.fm/tag/pop</url>
133
+ </tag>
134
+ <tag>
135
+ <name>90s</name>
136
+ <url>http://www.last.fm/tag/90s</url>
137
+ </tag>
138
+ <tag>
139
+ <name>dance</name>
140
+ <url>http://www.last.fm/tag/dance</url>
141
+ </tag>
142
+ <tag>
143
+ <name>1998</name>
144
+ <url>http://www.last.fm/tag/1998</url>
145
+ </tag>
146
+ <tag>
147
+ <name>albums i own</name>
148
+ <url>http://www.last.fm/tag/albums%20i%20own</url>
149
+ </tag>
150
+ </toptags>
151
+ <wiki>
152
+ <published>Sat, 6 Mar 2010 16:48:03 +0000</published>
153
+ <summary><![CDATA[Believe is the twenty-third studio album by American singer-actress Cher, released on November 10, 1998 by Warner Bros. Records. The RIAA certified it Quadruple Platinum on December 23, 1999, recognizing four million shipments in the United States; Worldwide, the album has sold more than 20 million copies, making it the biggest-selling album of her career. In 1999 the album received three Grammy Awards nominations including &quot;Record of the Year&quot;, &quot;Best Pop Album&quot; and winning &quot;Best Dance Recording&quot; for the single &quot;Believe&quot;. ]]></summary>
154
+ <content><![CDATA[Believe is the twenty-third studio album by American singer-actress Cher, released on November 10, 1998 by Warner Bros. Records. The RIAA certified it Quadruple Platinum on December 23, 1999, recognizing four million shipments in the United States; Worldwide, the album has sold more than 20 million copies, making it the biggest-selling album of her career. In 1999 the album received three Grammy Awards nominations including &quot;Record of the Year&quot;, &quot;Best Pop Album&quot; and winning &quot;Best Dance Recording&quot; for the single &quot;Believe&quot;.
155
+
156
+ It was released by Warner Bros. Records at the end of 1998. The album was executive produced by Rob Dickens. Upon its debut, critical reception was generally positive. Believe became Cher's most commercially-successful release, reached number one and Top 10 all over the world. In the United States, the album was released on November 10, 1998, and reached number four on the Billboard 200 chart, where it was certified four times platinum.
157
+
158
+ The album featured a change in Cher's music; in addition, Believe presented a vocally stronger Cher and a massive use of vocoder and Auto-Tune. In 1999, the album received 3 Grammy Awards nominations for &quot;Record of the Year&quot;, &quot;Best Pop Album&quot; and winning &quot;Best Dance Recording&quot;. Throughout 1999 and into 2000 Cher was nominated and winning many awards for the album including a Billboard Music Award for &quot;Female Vocalist of the Year&quot;, Lifelong Contribution Awards and a Star on the Walk of Fame shared with former Sonny Bono. The boost in Cher's popularity led to a very successful Do You Believe? Tour.
159
+
160
+ The album was dedicated to Sonny Bono, Cher's former husband who died earlier that year from a skiing accident.
161
+
162
+ Cher also recorded a cover version of &quot;Love Is in the Air&quot; during early sessions for this album. Although never officially released, the song has leaked on file sharing networks.
163
+
164
+ Singles
165
+
166
+
167
+ &quot;Believe&quot;
168
+ &quot;Strong Enough&quot;
169
+ &quot;All or Nothing&quot;
170
+ &quot;Dov'è L'Amore&quot;
171
+
172
+ User-contributed text is available under the Creative Commons By-SA License and may also be available under the GNU FDL.]]></content>
173
+ </wiki>
174
+ </album></lfm>
@@ -0,0 +1,108 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <lfm status="ok">
3
+ <artist>
4
+ <name>Cher</name>
5
+ <mbid>bfcc6d75-a6a5-4bc6-8282-47aec8531818</mbid>
6
+ <url>http://www.last.fm/music/Cher</url>
7
+ <image size="small">http://userserve-ak.last.fm/serve/34/63111289.png</image>
8
+ <image size="medium">http://userserve-ak.last.fm/serve/64/63111289.png</image>
9
+ <image size="large">http://userserve-ak.last.fm/serve/126/63111289.png</image>
10
+ <image size="extralarge">http://userserve-ak.last.fm/serve/252/63111289.png</image>
11
+ <image size="mega">http://userserve-ak.last.fm/serve/500/63111289/Cher.png</image>
12
+ <streamable>1</streamable>
13
+ <stats>
14
+ <listeners>665718</listeners>
15
+ <playcount>6419503</playcount>
16
+ </stats>
17
+
18
+ <similar>
19
+ <artist>
20
+ <name>Sonny &amp; Cher</name>
21
+ <url>http://www.last.fm/music/Sonny%2B%2526%2BCher</url>
22
+ <image size="small">http://userserve-ak.last.fm/serve/34/244080.jpg</image>
23
+ <image size="medium">http://userserve-ak.last.fm/serve/64/244080.jpg</image>
24
+ <image size="large">http://userserve-ak.last.fm/serve/126/244080.jpg</image>
25
+ <image size="extralarge">http://userserve-ak.last.fm/serve/252/244080.jpg</image>
26
+ <image size="mega">http://userserve-ak.last.fm/serve/_/244080/Sonny++Cher.jpg</image>
27
+ </artist>
28
+ <artist>
29
+ <name>Madonna</name>
30
+ <url>http://www.last.fm/music/Madonna</url>
31
+ <image size="small">http://userserve-ak.last.fm/serve/34/41422453.png</image>
32
+ <image size="medium">http://userserve-ak.last.fm/serve/64/41422453.png</image>
33
+ <image size="large">http://userserve-ak.last.fm/serve/126/41422453.png</image>
34
+ <image size="extralarge">http://userserve-ak.last.fm/serve/252/41422453.png</image>
35
+ <image size="mega">http://userserve-ak.last.fm/serve/_/41422453/Madonna+PNG.png</image>
36
+ </artist>
37
+ <artist>
38
+ <name>Cyndi Lauper</name>
39
+ <url>http://www.last.fm/music/Cyndi+Lauper</url>
40
+ <image size="small">http://userserve-ak.last.fm/serve/34/6967243.jpg</image>
41
+ <image size="medium">http://userserve-ak.last.fm/serve/64/6967243.jpg</image>
42
+ <image size="large">http://userserve-ak.last.fm/serve/126/6967243.jpg</image>
43
+ <image size="extralarge">http://userserve-ak.last.fm/serve/252/6967243.jpg</image>
44
+ <image size="mega">http://userserve-ak.last.fm/serve/500/6967243/Cyndi+Lauper+cl_kt03_5x6a_640.jpg</image>
45
+ </artist>
46
+ <artist>
47
+ <name>Kylie Minogue</name>
48
+ <url>http://www.last.fm/music/Kylie+Minogue</url>
49
+ <image size="small">http://userserve-ak.last.fm/serve/34/62311929.png</image>
50
+ <image size="medium">http://userserve-ak.last.fm/serve/64/62311929.png</image>
51
+ <image size="large">http://userserve-ak.last.fm/serve/126/62311929.png</image>
52
+ <image size="extralarge">http://userserve-ak.last.fm/serve/252/62311929.png</image>
53
+ <image size="mega">http://userserve-ak.last.fm/serve/_/62311929/Kylie+Minogue+Kylie.png</image>
54
+ </artist>
55
+ <artist>
56
+ <name>Céline Dion</name>
57
+ <url>http://www.last.fm/music/C%C3%A9line+Dion</url>
58
+ <image size="small">http://userserve-ak.last.fm/serve/34/39611203.png</image>
59
+ <image size="medium">http://userserve-ak.last.fm/serve/64/39611203.png</image>
60
+ <image size="large">http://userserve-ak.last.fm/serve/126/39611203.png</image>
61
+ <image size="extralarge">http://userserve-ak.last.fm/serve/252/39611203.png</image>
62
+ <image size="mega">http://userserve-ak.last.fm/serve/500/39611203/Cline+Dion+PNG4.png</image>
63
+ </artist>
64
+ </similar>
65
+ <tags>
66
+ <tag>
67
+ <name>pop</name>
68
+ <url>http://www.last.fm/tag/pop</url>
69
+ </tag>
70
+ <tag>
71
+ <name>female vocalists</name>
72
+ <url>http://www.last.fm/tag/female%20vocalists</url>
73
+ </tag>
74
+ <tag>
75
+ <name>80s</name>
76
+ <url>http://www.last.fm/tag/80s</url>
77
+ </tag>
78
+ <tag>
79
+ <name>dance</name>
80
+ <url>http://www.last.fm/tag/dance</url>
81
+ </tag>
82
+ <tag>
83
+ <name>rock</name>
84
+ <url>http://www.last.fm/tag/rock</url>
85
+ </tag>
86
+ </tags>
87
+ <bio>
88
+ <published>Sat, 11 Dec 2010 23:49:01 +0000</published>
89
+ <summary><![CDATA[Cher (born Cherilyn Sarkisian on May 20, 1946, later adopted by Gilbert LaPierre.) is an American singer, actress, songwriter, author and entertainer. Among her many career accomplishments in music, television and film, she has won an Academy Award, a Grammy Award, an Emmy Award and three Golden Globe Awards among others. Referred to as the Goddess of Pop, Cher first rose to prominence in 1965 as one half of the pop/rock duo Sonny &amp; Cher.]]></summary>
90
+ <content><![CDATA[Cher (born Cherilyn Sarkisian on May 20, 1946, later adopted by Gilbert LaPierre.) is an American singer, actress, songwriter, author and entertainer. Among her many career accomplishments in music, television and film, she has won an Academy Award, a Grammy Award, an Emmy Award and three Golden Globe Awards among others.
91
+
92
+ Referred to as the Goddess of Pop, Cher first rose to prominence in 1965 as one half of the pop/rock duo Sonny &amp; Cher. She also established herself as a solo recording artist, releasing 25 albums, contributing to numerous compilations, and tallying 34 Billboard Top 40 entries over her career, both solo and with Sonny. These include eighteen Top 10 singles and five number one singles (four solo). Cher has had 16 top ten hits in the UK between 1965 and 2003, four of which reached number one (two solo, one with Sonny, one as part of a charity single).
93
+
94
+ In a career surpassing 40 years, Cher has been described as an enduring pop icon and one of the most popular female artists in music history. Since her debut in 1964, Cher has sold as a solo artist over 180 million records worldwide and an estimated 70 million singles and with duo Sonny and Cher over 80 million records becoming one of the biggest-selling artists of all time.
95
+
96
+ She became a television star in the 1970s and a film actress in the 1980s. In 1987, she won the Academy Award for Best Actress for her role in the romantic comedy Moonstruck.
97
+
98
+ During 2007, in the seventh volume of Chrome Hearts, Cher once again confirmed that she is working on her twenty-sixth studio album. No recordings have taken place as of yet, and no release date had been scheduled.
99
+
100
+ It is rumoured that Cher will collaborate with Lady Gaga in a song for her next album Born This Way. This album is expected to be released in Spring 2011.
101
+
102
+ On February 7, 2008 Cher, at 61, announced that she had reached a deal to perform 200 shows over three years live at the Colosseum at Caesar's Palace in Las Vegas. Her new show, entitled Cher at the Colosseum, debuted on May 6, 2008. The show reportedly includes 18 dancers, 4 aerialists, and multiple costumes designed by Bob Mackie. Choreography will be directed by Doriana Sanchez who also worked with Cher on her past three major tours. Her show will perform four nights a week for a month, and a second leg of the show will continue in August. Cher will share the stage on a rotating basis with contemporaries Bette Midler (whose The Showgirl Must Go On opened on February 20, 2008) and Elton John (whose The Red Piano which opened in 2004, will continues its run of about 50 shows a year).
103
+
104
+ Cher made her musical debut and first film role in a decade in <em>Burlesque</em>, starring alongside Christina Aguilera, who also made her musical and film debut. The film was released in November 2010.
105
+
106
+ User-contributed text is available under the Creative Commons By-SA License and may also be available under the GNU FDL.]]></content>
107
+ </bio>
108
+ </artist></lfm>
data/spec/lastfm_spec.rb CHANGED
@@ -141,7 +141,9 @@ XML
141
141
  </session>
142
142
  </lfm>
143
143
  XML
144
- @lastfm.auth.get_session('xxxyyyzzz').should eql('zzzyyyxxx')
144
+ session = @lastfm.auth.get_session('xxxyyyzzz')
145
+ session['name'].should eql('MyLastFMUsername')
146
+ session['key'].should eql('zzzyyyxxx')
145
147
  end
146
148
  end
147
149
 
@@ -312,11 +314,15 @@ XML
312
314
  @lastfm.should_receive(:request).with('track.scrobble', {
313
315
  :artist => 'foo artist',
314
316
  :track => 'foo track',
315
- :album => nil,
316
- :timestamp => time
317
+ :album => 'foo album',
318
+ :mbid => '0383dadf-2a4e-4d10-a46a-e9e041da8eb3',
319
+ :timestamp => time,
320
+ :trackNumber => 1,
321
+ :duration => nil,
322
+ :albumArtist => nil,
317
323
  }, :post, true, true).and_return(@ok_response)
318
324
 
319
- @lastfm.track.scrobble('foo artist', 'foo track', nil, time)
325
+ @lastfm.track.scrobble('foo artist', 'foo track', time, 'foo album', 1, '0383dadf-2a4e-4d10-a46a-e9e041da8eb3', nil, nil)
320
326
  end
321
327
 
322
328
 
@@ -324,9 +330,14 @@ XML
324
330
  @lastfm.should_receive(:request).with('track.updateNowPlaying', {
325
331
  :artist => 'foo artist',
326
332
  :track => 'foo track',
333
+ :album => 'foo album',
334
+ :mbid => '0383dadf-2a4e-4d10-a46a-e9e041da8eb3',
335
+ :trackNumber => 1,
336
+ :duration => nil,
337
+ :albumArtist => nil,
327
338
  }, :post, true, true).and_return(@ok_response)
328
339
 
329
- @lastfm.track.update_now_playing('foo artist', 'foo track')
340
+ @lastfm.track.update_now_playing('foo artist', 'foo track', 'foo album', 1, '0383dadf-2a4e-4d10-a46a-e9e041da8eb3', nil, nil)
330
341
  end
331
342
  end
332
343
 
@@ -335,6 +346,18 @@ XML
335
346
  @lastfm.artist.should be_an_instance_of(Lastfm::MethodCategory::Artist)
336
347
  end
337
348
 
349
+ it 'should get info' do
350
+ @lastfm.should_receive(:request).with('artist.getInfo', {
351
+ :artist => 'Cher'
352
+ }).and_return(make_response('artist_get_info'))
353
+
354
+ artist = @lastfm.artist.get_info('Cher')
355
+ artist['name'].should eql('Cher')
356
+ artist['mbid'].should eql('bfcc6d75-a6a5-4bc6-8282-47aec8531818')
357
+ artist['url'].should eql('http://www.last.fm/music/Cher')
358
+ artist['image'].size.should eql(5)
359
+ end
360
+
338
361
  it 'should get events' do
339
362
  @lastfm.should_receive(:request).with('artist.getEvents', {
340
363
  :artist => 'Cher'
@@ -358,6 +381,32 @@ XML
358
381
  end
359
382
  end
360
383
 
384
+ describe '#album' do
385
+ it 'should return an instance of Lastfm::Album' do
386
+ @lastfm.album.should be_an_instance_of(Lastfm::MethodCategory::Album)
387
+ end
388
+
389
+ it 'should get info' do
390
+ @lastfm.should_receive(:request).with('album.getInfo', {
391
+ :artist => 'Cher', :album => 'Believe'
392
+ }).and_return(make_response('album_get_info'))
393
+
394
+ album = @lastfm.album.get_info('Cher', 'Believe')
395
+ album['name'].should eql('Believe')
396
+ album['artist'].should eql('Cher')
397
+ album['id'].should eql('2026126')
398
+ album['mbid'].should eql('61bf0388-b8a9-48f4-81d1-7eb02706dfb0')
399
+ album['url'].should eql('http://www.last.fm/music/Cher/Believe')
400
+ album['image'].size.should eql(5)
401
+ album['releasedate'].should eql('6 Apr 1999, 00:00')
402
+ album['tracks']['track'].size.should eql(10)
403
+ album['tracks']['track'][0]['name'].should eql('Believe')
404
+ album['tracks']['track'][0]['duration'].should eql('239')
405
+ album['tracks']['track'][0]['url'].should eql('http://www.last.fm/music/Cher/_/Believe')
406
+ end
407
+
408
+ end
409
+
361
410
  describe '#geo' do
362
411
  it 'should return an instance of Lastfm::Geo' do
363
412
  @lastfm.geo.should be_an_instance_of(Lastfm::MethodCategory::Geo)
@@ -412,7 +461,7 @@ XML
412
461
  friends[0]['name'].should eql('polaroide')
413
462
  end
414
463
  end
415
-
464
+
416
465
  describe '#get_neighbours' do
417
466
  it 'should get user\'s neighbours' do
418
467
  @lastfm.should_receive(:request).with('user.getNeighbours', {
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lastfm
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
5
- prerelease:
4
+ prerelease: false
6
5
  segments:
6
+ - 1
7
7
  - 0
8
- - 6
9
- - 0
10
- version: 0.6.0
8
+ - 1
9
+ version: 1.0.1
11
10
  platform: ruby
12
11
  authors:
13
12
  - youpy
@@ -15,18 +14,16 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2011-06-27 00:00:00 +09:00
17
+ date: 2012-01-11 00:00:00 +09:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: rspec
23
22
  prerelease: false
24
23
  requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
24
  requirements:
27
25
  - - ">="
28
26
  - !ruby/object:Gem::Version
29
- hash: 15
30
27
  segments:
31
28
  - 2
32
29
  - 0
@@ -38,11 +35,9 @@ dependencies:
38
35
  name: httparty
39
36
  prerelease: false
40
37
  requirement: &id002 !ruby/object:Gem::Requirement
41
- none: false
42
38
  requirements:
43
39
  - - ">="
44
40
  - !ruby/object:Gem::Version
45
- hash: 3
46
41
  segments:
47
42
  - 0
48
43
  version: "0"
@@ -52,11 +47,9 @@ dependencies:
52
47
  name: xml-simple
53
48
  prerelease: false
54
49
  requirement: &id003 !ruby/object:Gem::Requirement
55
- none: false
56
50
  requirements:
57
51
  - - ">="
58
52
  - !ruby/object:Gem::Version
59
- hash: 3
60
53
  segments:
61
54
  - 0
62
55
  version: "0"
@@ -66,11 +59,9 @@ dependencies:
66
59
  name: activesupport
67
60
  prerelease: false
68
61
  requirement: &id004 !ruby/object:Gem::Requirement
69
- none: false
70
62
  requirements:
71
63
  - - ">="
72
64
  - !ruby/object:Gem::Version
73
- hash: 1
74
65
  segments:
75
66
  - 3
76
67
  - 0
@@ -96,6 +87,7 @@ files:
96
87
  - VERSION
97
88
  - lastfm.gemspec
98
89
  - lib/lastfm.rb
90
+ - lib/lastfm/method_category/album.rb
99
91
  - lib/lastfm/method_category/artist.rb
100
92
  - lib/lastfm/method_category/auth.rb
101
93
  - lib/lastfm/method_category/base.rb
@@ -105,7 +97,9 @@ files:
105
97
  - lib/lastfm/method_category/user.rb
106
98
  - lib/lastfm/response.rb
107
99
  - lib/lastfm/util.rb
100
+ - spec/fixtures/album_get_info.xml
108
101
  - spec/fixtures/artist_get_events.xml
102
+ - spec/fixtures/artist_get_info.xml
109
103
  - spec/fixtures/geo_get_events.xml
110
104
  - spec/fixtures/library_get_artists.xml
111
105
  - spec/fixtures/ng.xml
@@ -136,32 +130,25 @@ rdoc_options: []
136
130
  require_paths:
137
131
  - lib
138
132
  required_ruby_version: !ruby/object:Gem::Requirement
139
- none: false
140
133
  requirements:
141
134
  - - ">="
142
135
  - !ruby/object:Gem::Version
143
- hash: 3
144
136
  segments:
145
137
  - 0
146
138
  version: "0"
147
139
  required_rubygems_version: !ruby/object:Gem::Requirement
148
- none: false
149
140
  requirements:
150
141
  - - ">="
151
142
  - !ruby/object:Gem::Version
152
- hash: 3
153
143
  segments:
154
144
  - 0
155
145
  version: "0"
156
146
  requirements: []
157
147
 
158
148
  rubyforge_project:
159
- rubygems_version: 1.5.0
149
+ rubygems_version: 1.3.6
160
150
  signing_key:
161
151
  specification_version: 3
162
152
  summary: A Ruby interface for Last.fm Web Services
163
- test_files:
164
- - spec/lastfm_spec.rb
165
- - spec/method_category_spec.rb
166
- - spec/response_spec.rb
167
- - spec/spec_helper.rb
153
+ test_files: []
154
+