Class: ListenBrainz::ArtistMap
- Defined in:
- lib/listenbrainz/models/artist_map.rb
Overview
Model class for artist maps.
Defined Under Namespace
Classes: Payload
Instance Attribute Summary collapse
- #artist_count ⇒ Integer readonly
- #artists ⇒ Array<Artist> readonly
-
#country ⇒ String
readonly
ISO-3166-1 alpha-3 code of the country.
- #listen_count ⇒ Integer readonly
Class Method Summary collapse
-
.get(username = ListenBrainz.client.username, range: nil) ⇒ Payload
Retrieves the artist map for the given user.
-
.sitewide(range: nil) ⇒ Payload
Retrieves the site-wide artist map.
Methods inherited from Base
Instance Attribute Details
#artist_count ⇒ Integer (readonly)
64 |
# File 'lib/listenbrainz/models/artist_map.rb', line 64 attribute :artist_count, Types::Integer |
#artists ⇒ Array<Artist> (readonly)
79 |
# File 'lib/listenbrainz/models/artist_map.rb', line 79 attribute :artists, Types::Array.of(Artist) |
#country ⇒ String (readonly)
ISO-3166-1 alpha-3 code of the country
70 |
# File 'lib/listenbrainz/models/artist_map.rb', line 70 attribute :country, Types::String |
#listen_count ⇒ Integer (readonly)
74 |
# File 'lib/listenbrainz/models/artist_map.rb', line 74 attribute :listen_count, Types::Integer |
Class Method Details
.get(username = ListenBrainz.client.username, range: nil) ⇒ Payload
Retrieves the artist map for the given user.
16 17 18 19 20 21 22 |
# File 'lib/listenbrainz/models/artist_map.rb', line 16 def self.get(username = ListenBrainz.client.username, range: nil) params = { range: }.compact ListenBrainz.client.query( :get, "1/stats/user/#{username}/artist-map", params: ).fetch(:payload).then { Payload.new(_1) } end |
.sitewide(range: nil) ⇒ Payload
Retrieves the site-wide artist map.
32 33 34 35 36 37 |
# File 'lib/listenbrainz/models/artist_map.rb', line 32 def self.sitewide(range: nil) params = { range: }.compact ListenBrainz.client.query( :get, '1/stats/sitewide/artist-map', params: ).fetch(:payload).then { Payload.new(_1) } end |