Class: Spotted::Resources::Me::Top

Inherits:
Object
  • Object
show all
Defined in:
lib/spotted/resources/me/top.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Top

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Top.

Parameters:



70
71
72
# File 'lib/spotted/resources/me/top.rb', line 70

def initialize(client:)
  @client = client
end

Instance Method Details

#list_top_artists(limit: nil, offset: nil, time_range: nil, request_options: {}) ⇒ Spotted::Internal::CursorURLPage<Spotted::Models::ArtistObject>

Some parameter documentations has been truncated, see Models::Me::TopListTopArtistsParams for more details.

Get the current user’s top artists based on calculated affinity.

Parameters:

  • limit (Integer)

    The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50.

  • offset (Integer)

    The index of the first item to return. Default: 0 (the first item). Use with lim

  • time_range (String)

    Over what time frame the affinities are computed. Valid values: ‘long_term` (cal

  • request_options (Spotted::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/spotted/resources/me/top.rb', line 25

def list_top_artists(params = {})
  parsed, options = Spotted::Me::TopListTopArtistsParams.dump_request(params)
  @client.request(
    method: :get,
    path: "me/top/artists",
    query: parsed,
    page: Spotted::Internal::CursorURLPage,
    model: Spotted::ArtistObject,
    options: options
  )
end

#list_top_tracks(limit: nil, offset: nil, time_range: nil, request_options: {}) ⇒ Spotted::Internal::CursorURLPage<Spotted::Models::TrackObject>

Some parameter documentations has been truncated, see Models::Me::TopListTopTracksParams for more details.

Get the current user’s top tracks based on calculated affinity.

Parameters:

  • limit (Integer)

    The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50.

  • offset (Integer)

    The index of the first item to return. Default: 0 (the first item). Use with lim

  • time_range (String)

    Over what time frame the affinities are computed. Valid values: ‘long_term` (cal

  • request_options (Spotted::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



55
56
57
58
59
60
61
62
63
64
65
# File 'lib/spotted/resources/me/top.rb', line 55

def list_top_tracks(params = {})
  parsed, options = Spotted::Me::TopListTopTracksParams.dump_request(params)
  @client.request(
    method: :get,
    path: "me/top/tracks",
    query: parsed,
    page: Spotted::Internal::CursorURLPage,
    model: Spotted::TrackObject,
    options: options
  )
end