lastfm 1.13.0 → 1.13.1

Sign up to get free protection for your applications and to get access to all the features.
data/lastfm.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |gem|
12
12
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
13
13
  gem.name = %q{lastfm}
14
14
  gem.require_paths = ["lib"]
15
- gem.version = "1.13.0"
15
+ gem.version = "1.13.1"
16
16
 
17
17
  gem.add_dependency "xml-simple"
18
18
  gem.add_dependency "httparty"
@@ -7,6 +7,8 @@ class Lastfm
7
7
 
8
8
  def initialize(body)
9
9
  @xml = XmlSimple.xml_in(body, 'ForceArray' => ['image', 'tag', 'user', 'event', 'correction'])
10
+ rescue REXML::ParseException
11
+ @xml = XmlSimple.xml_in(body.encode(Encoding.find("ISO-8859-1"), :undef => :replace), 'ForceArray' => ['image', 'tag', 'user', 'event', 'correction'])
10
12
  end
11
13
 
12
14
  def success?
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0"?>
2
+ <lfm status="ok">
3
+ <recenttracks user="RJ" page="1" perPage="10" totalPages="3019">
4
+ <track>
5
+ <artist mbid="">￾䬀愀瀀 匀氀愀瀀</artist>
6
+ <name>￾匀琀爀漀戀攀 䰀椀最栀琀猀 ㈀ 䤀戀椀稀愀 ⠀䐀攀愀搀洀愀甀㔀 瘀猀 䔀氀氀椀攀 䜀漀甀氀搀椀渀最 瘀猀 匀眀攀搀椀猀栀 䠀漀甀猀攀 䴀愀昀椀愀 瘀猀 䘀攀爀最椀攀 瘀猀 䰀椀氀 䨀漀渀⤀</name>
7
+ <streamable>0</streamable>
8
+ <mbid></mbid>
9
+ <album mbid="">￾䔀愀爀洀椀氀欀⸀挀漀洀 ⴀ ⌀䴀愀猀栀甀瀀䴀漀渀搀愀礀</album>
10
+ <url>http://www.last.fm/music/%EF%BF%BE%E4%AC%80%E6%84%80%E7%80%80%E2%80%80%E5%8C%80%E6%B0%80%E6%84%80%E7%80%80/_/%EF%BF%BE%E5%8C%80%E7%90%80%E7%88%80%E6%BC%80%E6%88%80%E6%94%80%E2%80%80%E4%B0%80%E6%A4%80%E6%9C%80%E6%A0%80%E7%90%80%E7%8C%80%E2%80%80%E3%88%80%E2%80%80%E4%A4%80%E6%88%80%E6%A4%80%E7%A8%80%E6%84%80%E2%80%80%E2%A0%80%E4%90%80%E6%94%80%E6%84%80%E6%90%80%E6%B4%80%E6%84%80%E7%94%80%E3%94%80%E2%80%80%E7%98%80%E7%8C%80%E2%80%80%E4%94%80%E6%B0%80%E6%B0%80%E6%A4%80%E6%94%80%E2%80%80%E4%9C%80%E6%BC%80%E7%94%80%E6%B0%80%E6%90%80%E6%A4%80%E6%B8%80%E6%9C%80%E2%80%80%E7%98%80%E7%8C%80%E2%80%80%E5%8C%80%E7%9C%80%E6%94%80%E6%90%80%E6%A4%80%E7%8C%80%E6%A0%80%E2%80%80%E4%A0%80%E6%BC%80%E7%94%80%E7%8C%80%E6%94%80%E2%80%80%E4%B4%80%E6%84%80%E6%98%80%E6%A4%80%E6%84%80%E2%80%80%E7%98%80%E7%8C%80%E2%80%80%E4%98%80%E6%94%80%E7%88%80%E6%9C%80%E6%A4%80%E6%94%80%E2%80%80%E7%98%80%E7%8C%80%E2%80%80%E4%B0%80%E6%A4%80%E6%B0%80%E2%80%80%E4%A8%80%E6%BC%80%E6%B8%80%E2%A4%80</url>
11
+ <image size="small"></image>
12
+ <image size="medium"></image>
13
+ <image size="large"></image>
14
+ <image size="extralarge"></image>
15
+ <date uts="1338664693">2 Jun 2012, 19:18</date>
16
+ </track>
17
+ </recenttracks>
18
+ </lfm>
@@ -210,6 +210,17 @@ describe '#user' do
210
210
  tracks[1]['artist']['content'].should == 'Kylie Minogue'
211
211
  tracks.size.should == 2
212
212
  end
213
+
214
+ it 'should not error when a user\'s recent tracks includes malformed data' do
215
+ @lastfm.should_receive(:request).with('user.getRecentTracks', {
216
+ :user => 'test',
217
+ :page => nil,
218
+ :limit => nil,
219
+ :to => nil,
220
+ :from => nil
221
+ }).and_return(make_response('user_get_recent_tracks_malformed'))
222
+ tracks = @lastfm.user.get_recent_tracks(:user => 'test')
223
+ end
213
224
  end
214
225
 
215
226
  describe '#get_top_tags' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lastfm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.0
4
+ version: 1.13.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-24 00:00:00.000000000 Z
12
+ date: 2012-11-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: xml-simple
@@ -157,6 +157,7 @@ files:
157
157
  - spec/fixtures/user_get_personal_tags_artists.xml
158
158
  - spec/fixtures/user_get_personal_tags_tracks.xml
159
159
  - spec/fixtures/user_get_recent_tracks.xml
160
+ - spec/fixtures/user_get_recent_tracks_malformed.xml
160
161
  - spec/fixtures/user_get_top_albums.xml
161
162
  - spec/fixtures/user_get_top_artists.xml
162
163
  - spec/fixtures/user_get_top_tags.xml
@@ -194,7 +195,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
194
195
  version: '0'
195
196
  segments:
196
197
  - 0
197
- hash: 1026746517880820910
198
+ hash: 3020588867676167718
198
199
  required_rubygems_version: !ruby/object:Gem::Requirement
199
200
  none: false
200
201
  requirements:
@@ -203,10 +204,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
203
204
  version: '0'
204
205
  segments:
205
206
  - 0
206
- hash: 1026746517880820910
207
+ hash: 3020588867676167718
207
208
  requirements: []
208
209
  rubyforge_project:
209
- rubygems_version: 1.8.24
210
+ rubygems_version: 1.8.23
210
211
  signing_key:
211
212
  specification_version: 3
212
213
  summary: A ruby interface for Last.fm web services version 2.0
@@ -247,6 +248,7 @@ test_files:
247
248
  - spec/fixtures/user_get_personal_tags_artists.xml
248
249
  - spec/fixtures/user_get_personal_tags_tracks.xml
249
250
  - spec/fixtures/user_get_recent_tracks.xml
251
+ - spec/fixtures/user_get_recent_tracks_malformed.xml
250
252
  - spec/fixtures/user_get_top_albums.xml
251
253
  - spec/fixtures/user_get_top_artists.xml
252
254
  - spec/fixtures/user_get_top_tags.xml