firstfm 0.5.0 → 0.5.1
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/Gemfile.lock +10 -10
- data/README.rdoc +2 -0
- data/VERSION.yml +1 -1
- data/firstfm.gemspec +2 -2
- data/lib/firstfm/artist.rb +1 -1
- data/lib/firstfm/track.rb +1 -1
- data/test/test_track.rb +1 -0
- metadata +3 -3
data/Gemfile.lock
CHANGED
@@ -1,25 +1,25 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
chronic (0.
|
5
|
-
crack (0.3.
|
4
|
+
chronic (0.9.0)
|
5
|
+
crack (0.3.2)
|
6
6
|
fakeweb (1.3.0)
|
7
7
|
git (1.2.5)
|
8
|
-
httparty (0.
|
9
|
-
multi_json
|
8
|
+
httparty (0.10.0)
|
9
|
+
multi_json (~> 1.0)
|
10
10
|
multi_xml
|
11
|
-
jeweler (1.8.
|
11
|
+
jeweler (1.8.4)
|
12
12
|
bundler (~> 1.0)
|
13
13
|
git (>= 1.2.5)
|
14
14
|
rake
|
15
15
|
rdoc
|
16
|
-
json (1.6
|
17
|
-
multi_json (1.0
|
18
|
-
multi_xml (0.
|
19
|
-
rake (0.
|
16
|
+
json (1.7.6)
|
17
|
+
multi_json (1.5.0)
|
18
|
+
multi_xml (0.5.2)
|
19
|
+
rake (10.0.3)
|
20
20
|
rdoc (3.12)
|
21
21
|
json (~> 1.4)
|
22
|
-
will_paginate (3.0.
|
22
|
+
will_paginate (3.0.4)
|
23
23
|
|
24
24
|
PLATFORMS
|
25
25
|
ruby
|
data/README.rdoc
CHANGED
data/VERSION.yml
CHANGED
data/firstfm.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "firstfm"
|
8
|
-
s.version = "0.5.
|
8
|
+
s.version = "0.5.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Aleksandr Lossenko"]
|
12
|
-
s.date = "2013-01-
|
12
|
+
s.date = "2013-01-17"
|
13
13
|
s.description = "Firstfm is a ruby wrapper for the Last.fm APIs ( http://www.last.fm/api ). My main focus is to import events from Last.FM, but with time I will try to add support for all API methods."
|
14
14
|
s.email = "aleksandr.lossenko@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/firstfm/artist.rb
CHANGED
@@ -22,7 +22,7 @@ module Firstfm
|
|
22
22
|
name_params = self.mbid.nil? ? {:artist => self.name} : {:mbid => self.mbid}
|
23
23
|
response = self.class.get("/2.0/", {:query => {:method => 'artist.getInfo', :api_key => Firstfm.config.api_key}.merge(name_params)})
|
24
24
|
tags_array = (response["lfm"] and response["lfm"]["artist"] and response["lfm"]["artist"]["tags"] and response["lfm"]["artist"]["tags"]["tag"]) || []
|
25
|
-
tags_array.map {|t| t["name"] }
|
25
|
+
tags_array.is_a?(Array) ? tags_array.map {|t| t["name"] } : []
|
26
26
|
end
|
27
27
|
|
28
28
|
def self.get_tags(artist)
|
data/lib/firstfm/track.rb
CHANGED
@@ -34,7 +34,7 @@ module Firstfm
|
|
34
34
|
track.mbid = hash["mbid"]
|
35
35
|
track.url = hash["url"]
|
36
36
|
track.listeners = hash["listeners"].to_i
|
37
|
-
track.streamable = hash["streamable"] == "1"
|
37
|
+
track.streamable = (hash["streamable"]["__content__"] ? hash["streamable"]["__content__"] == "1" : hash["streamable"] == "1")
|
38
38
|
track.images = hash["image"]
|
39
39
|
track.artist = hash["artist"].is_a?(Hash) ? Artist.init_from_hash(hash["artist"]) : Artist.new(:name => hash["artist"])
|
40
40
|
end
|
data/test/test_track.rb
CHANGED
@@ -10,6 +10,7 @@ class TestTrack < Test::Unit::TestCase
|
|
10
10
|
assert_equal 1, tracks.current_page
|
11
11
|
assert_equal 56384, tracks.total_entries
|
12
12
|
track = tracks.first
|
13
|
+
#raise track.inspect
|
13
14
|
assert_equal "Believe Me Natalie", track.name
|
14
15
|
assert_equal 494607, track.listeners
|
15
16
|
assert_equal "http://www.last.fm/music/The+Killers/_/Believe+Me+Natalie", track.url
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: firstfm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.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: 2013-01-
|
12
|
+
date: 2013-01-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
@@ -198,7 +198,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
198
198
|
version: '0'
|
199
199
|
segments:
|
200
200
|
- 0
|
201
|
-
hash:
|
201
|
+
hash: 324821844491852933
|
202
202
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
203
203
|
none: false
|
204
204
|
requirements:
|