Class: Spotted::Resources::Recommendations

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Recommendations

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 Recommendations.

Parameters:



155
156
157
# File 'lib/spotted/resources/recommendations.rb', line 155

def initialize(client:)
  @client = client
end

Instance Method Details

#get(limit: nil, market: nil, max_acousticness: nil, max_danceability: nil, max_duration_ms: nil, max_energy: nil, max_instrumentalness: nil, max_key: nil, max_liveness: nil, max_loudness: nil, max_mode: nil, max_popularity: nil, max_speechiness: nil, max_tempo: nil, max_time_signature: nil, max_valence: nil, min_acousticness: nil, min_danceability: nil, min_duration_ms: nil, min_energy: nil, min_instrumentalness: nil, min_key: nil, min_liveness: nil, min_loudness: nil, min_mode: nil, min_popularity: nil, min_speechiness: nil, min_tempo: nil, min_time_signature: nil, min_valence: nil, seed_artists: nil, seed_genres: nil, seed_tracks: nil, target_acousticness: nil, target_danceability: nil, target_duration_ms: nil, target_energy: nil, target_instrumentalness: nil, target_key: nil, target_liveness: nil, target_loudness: nil, target_mode: nil, target_popularity: nil, target_speechiness: nil, target_tempo: nil, target_time_signature: nil, target_valence: nil, request_options: {}) ⇒ Spotted::Models::RecommendationGetResponse

Deprecated.

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

Recommendations are generated based on the available information for a given seed entity and matched against similar artists and tracks. If there is sufficient information about the provided seeds, a list of tracks will be returned together with pool size details.

For artists and tracks that are very new or obscure there might not be enough data to generate a list of tracks.

Parameters:

  • limit (Integer)

    The target size of the list of recommended tracks. For seeds with unusually smal

  • market (String)

    An [ISO 3166-1 alpha-2 country code](en.wikipedia.org/wiki/ISO_3166-1_al

  • max_acousticness (Float)

    For each tunable track attribute, a hard ceiling on the selected track attribute

  • max_danceability (Float)

    For each tunable track attribute, a hard ceiling on the selected track attribute

  • max_duration_ms (Integer)

    For each tunable track attribute, a hard ceiling on the selected track attribute

  • max_energy (Float)

    For each tunable track attribute, a hard ceiling on the selected track attribute

  • max_instrumentalness (Float)

    For each tunable track attribute, a hard ceiling on the selected track attribute

  • max_key (Integer)

    For each tunable track attribute, a hard ceiling on the selected track attribute

  • max_liveness (Float)

    For each tunable track attribute, a hard ceiling on the selected track attribute

  • max_loudness (Float)

    For each tunable track attribute, a hard ceiling on the selected track attribute

  • max_mode (Integer)

    For each tunable track attribute, a hard ceiling on the selected track attribute

  • max_popularity (Integer)

    For each tunable track attribute, a hard ceiling on the selected track attribute

  • max_speechiness (Float)

    For each tunable track attribute, a hard ceiling on the selected track attribute

  • max_tempo (Float)

    For each tunable track attribute, a hard ceiling on the selected track attribute

  • max_time_signature (Integer)

    For each tunable track attribute, a hard ceiling on the selected track attribute

  • max_valence (Float)

    For each tunable track attribute, a hard ceiling on the selected track attribute

  • min_acousticness (Float)

    For each tunable track attribute, a hard floor on the selected track attribute’s

  • min_danceability (Float)

    For each tunable track attribute, a hard floor on the selected track attribute’s

  • min_duration_ms (Integer)

    For each tunable track attribute, a hard floor on the selected track attribute’s

  • min_energy (Float)

    For each tunable track attribute, a hard floor on the selected track attribute’s

  • min_instrumentalness (Float)

    For each tunable track attribute, a hard floor on the selected track attribute’s

  • min_key (Integer)

    For each tunable track attribute, a hard floor on the selected track attribute’s

  • min_liveness (Float)

    For each tunable track attribute, a hard floor on the selected track attribute’s

  • min_loudness (Float)

    For each tunable track attribute, a hard floor on the selected track attribute’s

  • min_mode (Integer)

    For each tunable track attribute, a hard floor on the selected track attribute’s

  • min_popularity (Integer)

    For each tunable track attribute, a hard floor on the selected track attribute’s

  • min_speechiness (Float)

    For each tunable track attribute, a hard floor on the selected track attribute’s

  • min_tempo (Float)

    For each tunable track attribute, a hard floor on the selected track attribute’s

  • min_time_signature (Integer)

    For each tunable track attribute, a hard floor on the selected track attribute’s

  • min_valence (Float)

    For each tunable track attribute, a hard floor on the selected track attribute’s

  • seed_artists (String)

    A comma separated list of [Spotify IDs](/documentation/web-api/concepts/spotify-

  • seed_genres (String)

    A comma separated list of any genres in the set of [available genre seeds](/docu

  • seed_tracks (String)

    A comma separated list of [Spotify IDs](/documentation/web-api/concepts/spotify-

  • target_acousticness (Float)

    For each of the tunable track attributes (below) a target value may be provided.

  • target_danceability (Float)

    For each of the tunable track attributes (below) a target value may be provided.

  • target_duration_ms (Integer)

    Target duration of the track (ms)

  • target_energy (Float)

    For each of the tunable track attributes (below) a target value may be provided.

  • target_instrumentalness (Float)

    For each of the tunable track attributes (below) a target value may be provided.

  • target_key (Integer)

    For each of the tunable track attributes (below) a target value may be provided.

  • target_liveness (Float)

    For each of the tunable track attributes (below) a target value may be provided.

  • target_loudness (Float)

    For each of the tunable track attributes (below) a target value may be provided.

  • target_mode (Integer)

    For each of the tunable track attributes (below) a target value may be provided.

  • target_popularity (Integer)

    For each of the tunable track attributes (below) a target value may be provided.

  • target_speechiness (Float)

    For each of the tunable track attributes (below) a target value may be provided.

  • target_tempo (Float)

    Target tempo (BPM)

  • target_time_signature (Integer)

    For each of the tunable track attributes (below) a target value may be provided.

  • target_valence (Float)

    For each of the tunable track attributes (below) a target value may be provided.

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

Returns:

See Also:



120
121
122
123
124
125
126
127
128
129
# File 'lib/spotted/resources/recommendations.rb', line 120

def get(params = {})
  parsed, options = Spotted::RecommendationGetParams.dump_request(params)
  @client.request(
    method: :get,
    path: "recommendations",
    query: parsed,
    model: Spotted::Models::RecommendationGetResponse,
    options: options
  )
end

#list_available_genre_seeds(request_options: {}) ⇒ Spotted::Models::RecommendationListAvailableGenreSeedsResponse

Deprecated.

Retrieve a list of available genres seed parameter values for [recommendations](/documentation/web-api/reference/get-recommendations).



143
144
145
146
147
148
149
150
# File 'lib/spotted/resources/recommendations.rb', line 143

def list_available_genre_seeds(params = {})
  @client.request(
    method: :get,
    path: "recommendations/available-genre-seeds",
    model: Spotted::Models::RecommendationListAvailableGenreSeedsResponse,
    options: params[:request_options]
  )
end