firstfm 0.7.0 → 0.8.0

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.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +4 -4
  3. data/Gemfile.lock +49 -18
  4. data/VERSION.yml +1 -1
  5. data/firstfm.gemspec +27 -32
  6. data/lib/firstfm.rb +2 -3
  7. data/lib/firstfm/artist.rb +25 -44
  8. data/lib/firstfm/geo.rb +32 -33
  9. data/lib/firstfm/location.rb +8 -8
  10. data/lib/firstfm/track.rb +15 -15
  11. data/lib/firstfm/user.rb +9 -9
  12. data/lib/firstfm/venue.rb +16 -16
  13. data/test/fixtures/artist.json +229 -0
  14. data/test/fixtures/artists.json +890 -0
  15. data/test/fixtures/events.json +173 -0
  16. data/test/fixtures/geo_event.json +98 -0
  17. data/test/fixtures/geo_events.json +845 -0
  18. data/test/fixtures/geo_get_metro_artist_chart.json +77 -0
  19. data/test/fixtures/get_correction.json +14 -0
  20. data/test/fixtures/get_correction_blank.json +1 -0
  21. data/test/fixtures/top_tracks.json +1711 -0
  22. data/test/fixtures/tracks.json +679 -0
  23. data/test/fixtures/user_artists.json +78 -0
  24. data/test/fixtures/venues.json +98 -0
  25. data/test/test_artist.rb +23 -32
  26. data/test/test_geo.rb +75 -75
  27. data/test/test_track.rb +10 -11
  28. data/test/test_user.rb +6 -7
  29. data/test/test_venue.rb +23 -44
  30. metadata +40 -78
  31. data/test/fixtures/artist.xml +0 -112
  32. data/test/fixtures/artists.xml +0 -371
  33. data/test/fixtures/event.xml +0 -54
  34. data/test/fixtures/events.xml +0 -128
  35. data/test/fixtures/geo_event.xml +0 -54
  36. data/test/fixtures/geo_events.xml +0 -109
  37. data/test/fixtures/geo_get_metro_artist_chart.xml +0 -29
  38. data/test/fixtures/get_correction.xml +0 -11
  39. data/test/fixtures/get_correction_blank.xml +0 -5
  40. data/test/fixtures/get_images.xml +0 -913
  41. data/test/fixtures/top_tracks.xml +0 -844
  42. data/test/fixtures/tracks.xml +0 -362
  43. data/test/fixtures/user_artists.xml +0 -29
  44. data/test/fixtures/venue.xml +0 -32
  45. data/test/fixtures/venues.xml +0 -54
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b74e40001b6370a1f7e2a54cb30bb12e635633d0
4
+ data.tar.gz: ea17aa4e6090b6061df859813053ab77ed6d37f2
5
+ SHA512:
6
+ metadata.gz: cfd13a5eb3c14ad0d8e7fdb880f7e168ab0b17f0b7d278489ce7b6f9923a4310d371362ee2917e6faceb5a65dbe46a15bcb2c1c2c1b4bc529504b72efd3a9e07
7
+ data.tar.gz: 77e5d13c044e46ce0b258cf523cd2cb88b36902d4b260feedb77e4ca457745b6587a7c81850c7ca046e24a92392dd09c2b7b568f69fb2f5edf4d367609d8a25e
data/Gemfile CHANGED
@@ -1,13 +1,13 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem "httparty", '~> 0.10.0'
4
- gem "crack", '~> 0.3.2'
5
- gem 'will_paginate', '~> 3.0.4'
6
- gem "chronic", '~> 0.9.0'
3
+ gem "httparty", '~> 0.13.5'
4
+ gem 'will_paginate', '~> 3.0.7'
5
+ gem "chronic", '~> 0.10.2'
7
6
 
8
7
  group :development do
9
8
  gem "rake"
10
9
  gem "bundler"
11
10
  gem "jeweler"
12
11
  gem "fakeweb"
12
+
13
13
  end
data/Gemfile.lock CHANGED
@@ -1,35 +1,66 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- chronic (0.9.0)
5
- crack (0.3.2)
4
+ addressable (2.3.8)
5
+ builder (3.2.2)
6
+ chronic (0.10.2)
7
+ descendants_tracker (0.0.4)
8
+ thread_safe (~> 0.3, >= 0.3.1)
6
9
  fakeweb (1.3.0)
7
- git (1.2.5)
8
- httparty (0.10.0)
9
- multi_json (~> 1.0)
10
- multi_xml
11
- jeweler (1.8.4)
12
- bundler (~> 1.0)
10
+ faraday (0.9.1)
11
+ multipart-post (>= 1.2, < 3)
12
+ git (1.2.9.1)
13
+ github_api (0.12.4)
14
+ addressable (~> 2.3)
15
+ descendants_tracker (~> 0.0.4)
16
+ faraday (~> 0.8, < 0.10)
17
+ hashie (>= 3.4)
18
+ multi_json (>= 1.7.5, < 2.0)
19
+ nokogiri (~> 1.6.6)
20
+ oauth2
21
+ hashie (3.4.2)
22
+ highline (1.7.3)
23
+ httparty (0.13.5)
24
+ json (~> 1.8)
25
+ multi_xml (>= 0.5.2)
26
+ jeweler (2.0.1)
27
+ builder
28
+ bundler (>= 1.0)
13
29
  git (>= 1.2.5)
30
+ github_api
31
+ highline (>= 1.6.15)
32
+ nokogiri (>= 1.5.10)
14
33
  rake
15
34
  rdoc
16
- json (1.7.6)
17
- multi_json (1.5.0)
18
- multi_xml (0.5.2)
19
- rake (10.0.3)
20
- rdoc (3.12)
35
+ json (1.8.3)
36
+ jwt (1.5.1)
37
+ mini_portile (0.6.2)
38
+ multi_json (1.11.2)
39
+ multi_xml (0.5.5)
40
+ multipart-post (2.0.0)
41
+ nokogiri (1.6.6.2)
42
+ mini_portile (~> 0.6.0)
43
+ oauth2 (1.0.0)
44
+ faraday (>= 0.8, < 0.10)
45
+ jwt (~> 1.0)
46
+ multi_json (~> 1.3)
47
+ multi_xml (~> 0.5)
48
+ rack (~> 1.2)
49
+ rack (1.6.4)
50
+ rake (10.4.2)
51
+ rdoc (4.2.0)
21
52
  json (~> 1.4)
22
- will_paginate (3.0.4)
53
+ thread_safe (0.3.5)
54
+ will_paginate (3.0.7)
23
55
 
24
56
  PLATFORMS
25
57
  ruby
26
58
 
27
59
  DEPENDENCIES
28
60
  bundler
29
- chronic (~> 0.9.0)
30
- crack (~> 0.3.2)
61
+ chronic (~> 0.10.2)
31
62
  fakeweb
32
- httparty (~> 0.10.0)
63
+ httparty (~> 0.13.5)
33
64
  jeweler
34
65
  rake
35
- will_paginate (~> 3.0.4)
66
+ will_paginate (~> 3.0.7)
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 0
3
- :minor: 7
3
+ :minor: 8
4
4
  :patch: 0
5
5
  :build:
data/firstfm.gemspec CHANGED
@@ -2,14 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
+ # stub: firstfm 0.8.0 ruby lib
5
6
 
6
7
  Gem::Specification.new do |s|
7
8
  s.name = "firstfm"
8
- s.version = "0.7.0"
9
+ s.version = "0.8.0"
9
10
 
10
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib"]
11
13
  s.authors = ["Aleksandr Lossenko"]
12
- s.date = "2013-07-14"
14
+ s.date = "2015-08-16"
13
15
  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
16
  s.email = "aleksandr.lossenko@gmail.com"
15
17
  s.extra_rdoc_files = [
@@ -35,21 +37,18 @@ Gem::Specification.new do |s|
35
37
  "lib/firstfm/track.rb",
36
38
  "lib/firstfm/user.rb",
37
39
  "lib/firstfm/venue.rb",
38
- "test/fixtures/artist.xml",
39
- "test/fixtures/artists.xml",
40
- "test/fixtures/event.xml",
41
- "test/fixtures/events.xml",
42
- "test/fixtures/geo_event.xml",
43
- "test/fixtures/geo_events.xml",
44
- "test/fixtures/geo_get_metro_artist_chart.xml",
45
- "test/fixtures/get_correction.xml",
46
- "test/fixtures/get_correction_blank.xml",
47
- "test/fixtures/get_images.xml",
48
- "test/fixtures/top_tracks.xml",
49
- "test/fixtures/tracks.xml",
50
- "test/fixtures/user_artists.xml",
51
- "test/fixtures/venue.xml",
52
- "test/fixtures/venues.xml",
40
+ "test/fixtures/artist.json",
41
+ "test/fixtures/artists.json",
42
+ "test/fixtures/events.json",
43
+ "test/fixtures/geo_event.json",
44
+ "test/fixtures/geo_events.json",
45
+ "test/fixtures/geo_get_metro_artist_chart.json",
46
+ "test/fixtures/get_correction.json",
47
+ "test/fixtures/get_correction_blank.json",
48
+ "test/fixtures/top_tracks.json",
49
+ "test/fixtures/tracks.json",
50
+ "test/fixtures/user_artists.json",
51
+ "test/fixtures/venues.json",
53
52
  "test/helper.rb",
54
53
  "test/test_artist.rb",
55
54
  "test/test_geo.rb",
@@ -59,37 +58,33 @@ Gem::Specification.new do |s|
59
58
  ]
60
59
  s.homepage = "http://github.com/egze/firstfm"
61
60
  s.licenses = ["MIT"]
62
- s.require_paths = ["lib"]
63
- s.rubygems_version = "1.8.25"
61
+ s.rubygems_version = "2.2.2"
64
62
  s.summary = "A ruby wrapper for the Last.fm APIs"
65
63
 
66
64
  if s.respond_to? :specification_version then
67
- s.specification_version = 3
65
+ s.specification_version = 4
68
66
 
69
67
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
70
- s.add_runtime_dependency(%q<httparty>, ["~> 0.10.0"])
71
- s.add_runtime_dependency(%q<crack>, ["~> 0.3.2"])
72
- s.add_runtime_dependency(%q<will_paginate>, ["~> 3.0.4"])
73
- s.add_runtime_dependency(%q<chronic>, ["~> 0.9.0"])
68
+ s.add_runtime_dependency(%q<httparty>, ["~> 0.13.5"])
69
+ s.add_runtime_dependency(%q<will_paginate>, ["~> 3.0.7"])
70
+ s.add_runtime_dependency(%q<chronic>, ["~> 0.10.2"])
74
71
  s.add_development_dependency(%q<rake>, [">= 0"])
75
72
  s.add_development_dependency(%q<bundler>, [">= 0"])
76
73
  s.add_development_dependency(%q<jeweler>, [">= 0"])
77
74
  s.add_development_dependency(%q<fakeweb>, [">= 0"])
78
75
  else
79
- s.add_dependency(%q<httparty>, ["~> 0.10.0"])
80
- s.add_dependency(%q<crack>, ["~> 0.3.2"])
81
- s.add_dependency(%q<will_paginate>, ["~> 3.0.4"])
82
- s.add_dependency(%q<chronic>, ["~> 0.9.0"])
76
+ s.add_dependency(%q<httparty>, ["~> 0.13.5"])
77
+ s.add_dependency(%q<will_paginate>, ["~> 3.0.7"])
78
+ s.add_dependency(%q<chronic>, ["~> 0.10.2"])
83
79
  s.add_dependency(%q<rake>, [">= 0"])
84
80
  s.add_dependency(%q<bundler>, [">= 0"])
85
81
  s.add_dependency(%q<jeweler>, [">= 0"])
86
82
  s.add_dependency(%q<fakeweb>, [">= 0"])
87
83
  end
88
84
  else
89
- s.add_dependency(%q<httparty>, ["~> 0.10.0"])
90
- s.add_dependency(%q<crack>, ["~> 0.3.2"])
91
- s.add_dependency(%q<will_paginate>, ["~> 3.0.4"])
92
- s.add_dependency(%q<chronic>, ["~> 0.9.0"])
85
+ s.add_dependency(%q<httparty>, ["~> 0.13.5"])
86
+ s.add_dependency(%q<will_paginate>, ["~> 3.0.7"])
87
+ s.add_dependency(%q<chronic>, ["~> 0.10.2"])
93
88
  s.add_dependency(%q<rake>, [">= 0"])
94
89
  s.add_dependency(%q<bundler>, [">= 0"])
95
90
  s.add_dependency(%q<jeweler>, [">= 0"])
data/lib/firstfm.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  require 'yaml'
2
- require 'crack'
3
2
  require 'httparty'
4
3
  require 'chronic'
5
4
  require 'will_paginate/collection'
@@ -14,7 +13,7 @@ require 'firstfm/geo'
14
13
  require 'firstfm/user'
15
14
 
16
15
  module Firstfm
17
-
16
+
18
17
  GH_PAGE_URL = "https://github.com/egze/firstfm"
19
-
18
+
20
19
  end
@@ -1,76 +1,57 @@
1
1
  module Firstfm
2
-
2
+
3
3
  class Artist
4
-
4
+
5
5
  attr_accessor :name, :mbid, :url, :listeners, :streamable, :images, :playcount
6
-
6
+
7
7
  include HTTParty
8
8
  base_uri 'ws.audioscrobbler.com'
9
- format :xml
10
-
11
- parser(
12
- Proc.new do |body, format|
13
- Crack::XML.parse(body)
14
- end
15
- )
16
-
9
+ format :json
10
+
17
11
  def initialize(params = {})
18
12
  @name = params[:name]
19
13
  end
20
14
 
21
15
  def get_tags
22
16
  name_params = self.mbid.nil? ? {:artist => self.name} : {:mbid => self.mbid}
23
- response = self.class.get("/2.0/", {:query => {:method => 'artist.getInfo', :api_key => Firstfm.config.api_key}.merge(name_params)})
24
- tags_array = (response["lfm"] and response["lfm"]["artist"] and response["lfm"]["artist"]["tags"] and response["lfm"]["artist"]["tags"]["tag"]) || []
17
+ response = self.class.get("/2.0/", {:query => {:method => 'artist.getInfo', :api_key => Firstfm.config.api_key, :format => :json}.merge(name_params)})
18
+ tags_array = (response and response["artist"] and response["artist"]["tags"] and response["artist"]["tags"]["tag"]) || []
25
19
  tags_array.is_a?(Array) ? tags_array.map {|t| t["name"] } : []
26
20
  end
27
21
 
28
22
  def self.get_tags(artist)
29
23
  self.new(name: artist).get_tags
30
24
  end
31
-
32
- def get_images(page = 1, limit = 50)
33
- name_params = self.mbid.nil? ? {:artist => self.name} : {:mbid => self.mbid}
34
- response = self.class.get("/2.0/", {:query => {:method => 'artist.getImages', :page => page, :limit => limit, :api_key => Firstfm.config.api_key}.merge(name_params)})
35
- images_array = (response["lfm"] and response["lfm"]["images"] and response["lfm"]["images"]["image"]) || []
36
- images = Image.init_from_array(images_array)
37
- WillPaginate::Collection.create(page, limit) do |pager|
38
- pager.replace images
39
- pager.total_entries = response["lfm"]["images"]["total"].to_i rescue 0
40
- end
41
- end
42
-
25
+
43
26
  def self.search(artist, page = 1, limit = 50)
44
- response = get("/2.0/", {:query => {:method => 'artist.search', :artist => artist, :page => page, :limit => limit, :api_key => Firstfm.config.api_key}})
45
- artists_array = (response and response["lfm"] and response["lfm"]["results"] and response["lfm"]["results"]["artistmatches"] and response["lfm"]["results"]["artistmatches"]["artist"]) || []
27
+ response = get("/2.0/", {:query => {:method => 'artist.search', :artist => artist, :page => page, :limit => limit, :api_key => Firstfm.config.api_key, :format => :json}})
28
+ artists_array = (response and response["results"] and response["results"]["artistmatches"] and response["results"]["artistmatches"]["artist"]) || []
46
29
  artists = Artist.init_from_array(artists_array)
47
30
  WillPaginate::Collection.create(page, limit) do |pager|
48
31
  pager.replace artists
49
- pager.total_entries = response['lfm']['results']['opensearch:totalResults'].to_i rescue 0
32
+ pager.total_entries = response['results']['opensearch:totalResults'].to_i rescue 0
50
33
  end
51
34
  end
52
-
35
+
53
36
  def self.get_top_tracks(artist, page = 1, limit = 50)
54
- response = get("/2.0/", {:query => {:method => 'artist.getTopTracks', :artist => artist, :page => page, :limit => limit, :api_key => Firstfm.config.api_key}})
55
- tracks_array = (response and response["lfm"] and response["lfm"]["toptracks"] and response["lfm"]["toptracks"]["track"]) || []
37
+ response = get("/2.0/", {:query => {:method => 'artist.getTopTracks', :artist => artist, :page => page, :limit => limit, :api_key => Firstfm.config.api_key, :format => :json}})
38
+ tracks_array = (response and response and response["toptracks"] and response["toptracks"]["track"]) || []
56
39
  tracks = Track.init_from_array(tracks_array)
57
40
  WillPaginate::Collection.create(page, limit) do |pager|
58
41
  pager.replace tracks
59
- pager.total_entries = response["lfm"]["toptracks"]["total"].to_i rescue 0
42
+ pager.total_entries = response["toptracks"]["@attr"]["total"].to_i rescue 0
60
43
  end
61
44
  end
62
-
45
+
63
46
  def self.get_correction(artist)
64
- response = get("/2.0/", {:query => {:method => 'artist.getcorrection', :artist => artist, :api_key => Firstfm.config.api_key}})
65
- if response && response["lfm"] && response["lfm"] && response["lfm"]["status"] == "ok"
66
- if response["lfm"]["corrections"] && response["lfm"]["corrections"]["correction"]
67
- init_from_hash(response["lfm"]["corrections"]["correction"]["artist"]) rescue nil
68
- elsif response["lfm"].key?("corrections")
69
- init_from_hash({"name" => artist})
70
- end
47
+ response = get("/2.0/", {:query => {:method => 'artist.getcorrection', :artist => artist, :api_key => Firstfm.config.api_key, :format => :json}})
48
+ if response["corrections"] && response["corrections"]["correction"]
49
+ init_from_hash(response["corrections"]["correction"]["artist"]) rescue nil
50
+ elsif response.key?("corrections")
51
+ init_from_hash({"name" => artist})
71
52
  end
72
53
  end
73
-
54
+
74
55
  def self.init_from_array(array)
75
56
  return [] unless array.is_a?(Array)
76
57
  array.inject([]) do |arr, artist|
@@ -78,7 +59,7 @@ module Firstfm
78
59
  arr
79
60
  end
80
61
  end
81
-
62
+
82
63
  def self.init_from_hash(hash)
83
64
  return nil unless hash.is_a?(Hash)
84
65
  Artist.new.tap do |artist|
@@ -91,7 +72,7 @@ module Firstfm
91
72
  artist.playcount = hash["playcount"].to_i
92
73
  end
93
74
  end
94
-
75
+
95
76
  end
96
-
77
+
97
78
  end
data/lib/firstfm/geo.rb CHANGED
@@ -1,61 +1,60 @@
1
1
  module Firstfm
2
-
2
+
3
3
  class Geo
4
-
4
+
5
5
  include HTTParty
6
6
  base_uri 'ws.audioscrobbler.com'
7
- format :xml
8
-
7
+ format :json
8
+
9
9
  def self.get_events(params = {})
10
10
  location = params.delete(:location)
11
11
  lat = params.delete(:lat)
12
12
  lng = params.delete(:lng)
13
13
  page = params.delete(:page) || 1
14
14
  distance = params.delete(:distance)
15
-
16
- response = get("/2.0/", {:query => {:method => 'geo.getevents', :location => location, :page => page, :lat => lat, :lng => lng, :distance => distance, :api_key => Firstfm.config.api_key}})
17
- events = response && response['lfm'] ? Event.init_events_from_hash(response['lfm']) : []
18
-
15
+
16
+ response = get("/2.0/", {:query => {:method => 'geo.getevents', :location => location, :page => page, :lat => lat, :lng => lng, :distance => distance, :api_key => Firstfm.config.api_key, :format => :json}})
17
+ events = response ? Event.init_events_from_hash(response) : []
19
18
  collection = WillPaginate::Collection.create(page, 10) do |pager|
20
19
  pager.replace events
21
- pager.total_entries = response['lfm']['events']['total'].to_i
20
+ pager.total_entries = response['events']['@attr']['total'].to_i
22
21
  end
23
-
22
+
24
23
  end
25
-
24
+
26
25
  def self.get_top_artists(params = {})
27
26
  country = params[:country]
28
27
  page = params[:page] || 1
29
28
  limit = params[:limit] || 50
30
-
29
+
31
30
  response = get("/2.0/", {:query => {
32
- :method => 'geo.gettopartists',
31
+ :method => 'geo.gettopartists',
33
32
  :country => country,
34
- :page => page,
35
- :limit => limit,
36
- :api_key => Firstfm.config.api_key
33
+ :page => page,
34
+ :limit => limit,
35
+ :api_key => Firstfm.config.api_key, :format => :json
37
36
  }})
38
-
39
- artists_array = (response and response['lfm'] and response['lfm']['topartists'] and response['lfm']['topartists']['artist']) || []
37
+
38
+ artists_array = (response and response['topartists'] and response['topartists']['artist']) || []
40
39
  artists = Artist.init_from_array(artists_array)
41
40
  WillPaginate::Collection.create(page, limit) do |pager|
42
41
  pager.replace artists
43
- pager.total_entries = response['lfm']['topartists']['total'].to_i rescue 0
42
+ pager.total_entries = response['topartists']['@attr']['total'].to_i rescue 0
44
43
  end
45
44
  end
46
-
45
+
47
46
  def self.get_metro_artist_chart(params = {})
48
47
  get_generic_artist_chart 'geo.getmetroartistchart', params
49
48
  end
50
-
49
+
51
50
  def self.get_metro_hype_artist_chart(params = {})
52
51
  get_generic_artist_chart 'geo.getmetrohypeartistchart', params
53
52
  end
54
-
53
+
55
54
  def self.get_metro_unique_artist_chart(params = {})
56
55
  get_generic_artist_chart 'geo.getmetrouniqueartistchart', params
57
56
  end
58
-
57
+
59
58
  def self.get_generic_artist_chart(method, params = {})
60
59
  metro = params[:metro]
61
60
  country = params[:country]
@@ -63,26 +62,26 @@ module Firstfm
63
62
  end_timestamp = params[:end]
64
63
  page = params[:page] || 1
65
64
  limit = params[:limit] || 50
66
-
65
+
67
66
  response = get("/2.0/", {:query => {
68
- :method => method,
67
+ :method => method,
69
68
  :country => country,
70
69
  :metro => metro,
71
70
  :start => start_timestamp,
72
71
  :end => end_timestamp,
73
- :page => page,
74
- :limit => limit,
75
- :api_key => Firstfm.config.api_key }.reject {|k,v| v.nil?}
72
+ :page => page,
73
+ :limit => limit,
74
+ :api_key => Firstfm.config.api_key, :format => :json }.reject {|k,v| v.nil?}
76
75
  })
77
-
78
- artists_array = (response and response['lfm'] and response['lfm']['topartists'] and response['lfm']['topartists']['artist']) || []
76
+
77
+ artists_array = (response and response['topartists'] and response['topartists']['artist']) || []
79
78
  artists = Artist.init_from_array(artists_array)
80
79
  WillPaginate::Collection.create(page, limit) do |pager|
81
80
  pager.replace artists
82
- pager.total_entries = response['lfm']['topartists']['total'].to_i rescue 0
81
+ pager.total_entries = response['topartists']['@attr']['total'].to_i rescue 0
83
82
  end
84
83
  end
85
-
84
+
86
85
  end
87
-
86
+
88
87
  end