Module: Echowrap::API::TasteProfile

Includes:
Utils
Included in:
Client
Defined in:
lib/echowrap/api/taste_profile.rb

Constant Summary

Constants included from Utils

Utils::API_KEY_CANNOT_CALL_THIS_METHOD, Utils::INVALID_PARAMETER, Utils::MISSING_OR_INVALID_KEY, Utils::MISSING_PARAMETER, Utils::RATE_LIMIT_EXCEEDED, Utils::SUCCESS

Instance Method Summary collapse

Instance Method Details

#taste_profile_ban(options = {}) ⇒ Boolean

Indicates that the given items have been banned or unbanned.

Examples:

taste_profile_ban

Echowrap.taste_profile_ban(:id => 'CANVFPJ131839D8144', :item => 'kfw')

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :id (String)

    The ID of the taste profile. Required. Example: ‘CANVFPJ131839D8144’

  • :item (String)

    The id of the item(s) in the taste profile to be updated. This can be the simple item ID or the Rosetta ID of the item. The items must already be in the taste profile. Examples: ‘kfw’, ‘ARK3D5J1187B9BA0B8’, ‘CAOFUDS12BB066268E:artist:kfw’, ‘7digital-US:track:293030’

  • :ban (Integer)

    Sets the ban flag of the specified items(s) to the given value. Not required, defaults to ‘true’, must be one of [‘true’, ‘false’].

Returns:

  • (Boolean)

    Message success

Raises:

See Also:



112
113
114
# File 'lib/echowrap/api/taste_profile.rb', line 112

def taste_profile_ban(options={})
  boolean_from_response(:get, '/api/v4/catalog/ban', options)
end

#taste_profile_create(options = {}) ⇒ Echowrap::TasteProfile

Creates a taste profile.

Examples:

taste_profile_create

Echowrap.taste_profile_create(:name => "Favorite artists of Paul", :type => 'artist')

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :name (String)

    The name of the taste profile. Required. Example: ‘Favorite artists of Paul’.

  • :type (String)

    The type of the taste profile. Required, must be one of [‘artist’, ‘song’, ‘general’]. Example: ‘song’

Returns:

Raises:

See Also:



21
22
23
# File 'lib/echowrap/api/taste_profile.rb', line 21

def taste_profile_create(options={})
  object_from_response(Echowrap::TasteProfile, :post, '/api/v4/catalog/create', nil, options)
end

#taste_profile_delete(options = {}) ⇒ Echowrap::TasteProfile

Deletes the entire taste profile. Only the API key used to create a taste profile can be used to delete that taste profile.

Examples:

taste_profile_delete

Echowrap.taste_profile_delete

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :id (String)

    The ID of the taste profile. Required. Example: ‘CANVFPJ131839D8144’

Returns:

Raises:

See Also:



181
182
183
# File 'lib/echowrap/api/taste_profile.rb', line 181

def taste_profile_delete(options={})
  object_from_response(Echowrap::TasteProfile, :post, '/api/v4/catalog/delete', nil, options)
end

#taste_profile_favorite(options = {}) ⇒ Boolean

Indicates that the given items have been favorited or unfavorited.

Examples:

taste_profile_favorite

Echowrap.taste_profile_favorite(:id => 'CANVFPJ131839D8144', :item => 'kfw')

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :id (String)

    The ID of the taste profile. Required. Example: ‘CANVFPJ131839D8144’

  • :item (String)

    The id of the item(s) in the taste profile to be updated. This can be the simple item ID or the Rosetta ID of the item. The items must already be in the taste profile. Examples: ‘kfw’, ‘ARK3D5J1187B9BA0B8’, ‘CAOFUDS12BB066268E:artist:kfw’, ‘7digital-US:track:293030’

  • :favorite (String)

    Sets the favorite flag of the specified items(s) to the given value. Not required, defaults to ‘true’, must be either [‘true, ’false’].

Returns:

  • (Boolean)

    Message success.

Raises:

See Also:



130
131
132
# File 'lib/echowrap/api/taste_profile.rb', line 130

def taste_profile_favorite(options={})
  boolean_from_response(:get, '/api/v4/catalog/favorite', options)
end

#taste_profile_feed(options = {}) ⇒ Array

Returns feeds based on the artists in a taste profile. Unlike catalog/read method, the catalog/feed method interleaves items and sorts them by date.

Examples:

taste_profile_feed

Echowrap.taste_profile_feed

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :id (String)

    The ID of the taste profile. Required if name is omitted. Example: ‘CAJTFEO131216286ED’.

  • :bucket (String)

    Indicates what type of feed items should be returned for each artist in the taste profile. Not required, may send multiple. can be any combination of news, blogs, reviews, audio and video blogs. If omitted defaults to news.

  • :results (Integer)

    The number of results desired. Not required, defaults to 25.

  • :start (Integer)

    The desired index of the first result returned. Not required, defaults to 0.

  • :since (String)

    Limit the items to those that have occurred since the given date. Not required, if supplied must be in date format YYYY-mm-dd. Example: ‘2013-05-19’.

  • :high_relevance (String)

    if true only items that are highly relevant for this artist will be returned. Currently only news items are filtered for high relevance. Not required, defaults to ‘false’, must be one of [‘true’, ‘false’].

Returns:

  • (Array)

    Array of feeds

Raises:

See Also:



255
256
257
# File 'lib/echowrap/api/taste_profile.rb', line 255

def taste_profile_feed(options={})
  objects_from_response(Echowrap::Feed, :get, '/api/v4/catalog/feed', :feed, options)
end

#taste_profile_keyvalues(options = {}) ⇒ Echowrap::TasteProfile

Retrieve the catalog-level key/values that are stored in the Taste Profile

Examples:

taste_profile_keyvalues

Echowrap.taste_profile_keyvalues(:id => 'CANVFPJ131839D8144')

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :id (String)

    The ID of the taste profile. Required. Example: ‘CANVFPJ131839D8144’

Returns:

Raises:

See Also:



58
59
60
# File 'lib/echowrap/api/taste_profile.rb', line 58

def taste_profile_keyvalues(options={})
  object_from_response(Echowrap::TasteProfile, :get, '/api/v4/catalog/keyvalues', nil, options)
end

#taste_profile_list(options = {}) ⇒ Array

Returns a list of all taste profiles created on this key

Examples:

taste_profile_list

Echowrap.taste_profile_list

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :results (Integer)

    The number of results desired.

  • :start (Integer)

    The desired index of the first result returned.

Returns:

  • (Array)

    Array of taste profiles.

Raises:

See Also:



165
166
167
# File 'lib/echowrap/api/taste_profile.rb', line 165

def taste_profile_list(options={})
  objects_from_response(Echowrap::TasteProfile, :get, '/api/v4/catalog/list', :catalogs, options)
end

#taste_profile_play(options = {}) ⇒ Boolean

Increment the playcount for the given items by the given count.

Examples:

taste_profile_play

Echowrap.taste_profile_play(:id => 'CANVFPJ131839D8144', :item => 'kfw')

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :id (String)

    The ID of the taste profile. Required. Example: ‘CANVFPJ131839D8144’

  • :item (String)

    The id of the item(s) in the taste profile to be updated. This can be the simple item ID or the Rosetta ID of the item. The items must already be in the taste profile. Examples: ‘kfw’, ‘ARK3D5J1187B9BA0B8’, ‘CAOFUDS12BB066268E:artist:kfw’, ‘7digital-US:track:293030’

  • :plays (Integer)

    Increments the play count for the specified item(s) by the given value. Not required, defaults to 1, must be between 1 and 100.

Returns:

  • (Boolean)

    Message success.

Raises:

See Also:



76
77
78
# File 'lib/echowrap/api/taste_profile.rb', line 76

def taste_profile_play(options={})
  boolean_from_response(:get, '/api/v4/catalog/play', options)
end

#taste_profile_predict(options = {}) ⇒ Echowrap::TasteProfile

Access the taste profile attributes.

Examples:

taste_profile_predict

Echowrap.taste_profile_predict

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :id (String)

    The ID of the taste profile. Required. Example: ‘CAJTFEO131216286ED’.

  • :category (String)

    The attributes to be returned for the taste profile. Required, may send multiple, must be any of [‘adventurousness’, ‘diversity’, ‘freshness’, ‘mainstreamness’, ‘top_years’, ‘top_styles’, ‘audio_features’] (audio features is only available for song-based profiles).

Returns:

Raises:

See Also:



291
292
293
# File 'lib/echowrap/api/taste_profile.rb', line 291

def taste_profile_predict(options={})
  object_from_response(Echowrap::TasteProfile, :get, '/api/v4/catalog/predict', :catalog, options)
end

#taste_profile_profile(options = {}) ⇒ Echowrap::TasteProfile

Get basic information on a taste profile

Examples:

taste_profile_profile

Echowrap.taste_profile_profile

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :id (String)

    The ID of the taste profile. Required if name is omitted. Example: ‘CAJTFEO131216286ED’.

  • :name (String)

    The name of the taste profile. Required if the ID is omitted. Example: ‘My Favorite Artists’.

Returns:

Raises:

See Also:



198
199
200
# File 'lib/echowrap/api/taste_profile.rb', line 198

def taste_profile_profile(options={})
  object_from_response(Echowrap::TasteProfile, :get, '/api/v4/catalog/profile', :catalog, options)
end

#taste_profile_rate(options = {}) ⇒ Boolean

Apply the given rating to the given items

Examples:

taste_profile_rate

Echowrap.taste_profile_rate(:id => 'CANVFPJ131839D8144', :item => 'kfw')

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :id (String)

    The ID of the taste profile. Required. Example: ‘CANVFPJ131839D8144’

  • :item (String)

    The id of the item(s) in the taste profile to be updated. This can be the simple item ID or the Rosetta ID of the item. The items must already be in the taste profile. Examples: ‘kfw’, ‘ARK3D5J1187B9BA0B8’, ‘CAOFUDS12BB066268E:artist:kfw’, ‘7digital-US:track:293030’

  • :rating (Integer)

    Sets the rating of the specified items(s) to the given value. Not required, defaults to 5, must be between 1 and 10.

Returns:

  • (Boolean)

    Message success.

Raises:

See Also:



148
149
150
# File 'lib/echowrap/api/taste_profile.rb', line 148

def taste_profile_rate(options={})
  boolean_from_response(:get, '/api/v4/catalog/rate', options)
end

#taste_profile_read(options = {}) ⇒ Echowrap::TasteProfile

Returns data stored in the taste profile. Also returns Echo Nest IDs for items that have been resolved to Echo Nest IDs along with information requested via bucket. If item_id is not set, all items (subject to the limits of the start and results parameters) are returned, otherwise, only the items explicitly specified by item_id are returned.

Examples:

taste_profile_read

Echowrap.taste_profile_read

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :id (String)

    The ID of the taste profile. Required if name is omitted. Example: ‘CAJTFEO131216286ED’.

  • :item_id (String)

    The item id for the item in the taste profile. Not required, can send multiple. ID will be whatever ID was assigned for the item.

  • :bucket (String)

    Indicates what data should be returned for each item. Not required, can send multiple. Can by any of the following ‘item_keyvalues’, For song items: ‘audio_summary’, ‘artist_familiarity’, ‘artist_hotttnesss’, ‘artist_location’, ‘song_hotttnesss’, ‘song_type’, ‘tracks’, ‘id:Rosetta-space’ For artist items: ‘biographies’, ‘blogs’, ‘doc_counts’, ‘familiarity’, ‘hotttnesss’, ‘images’, ‘artist_location’, ‘news’, ‘reviews’, ‘songs’, ‘terms’, ‘urls’, ‘video’, ‘years_active’, ‘id:Rosetta-space’

  • :results (Integer)

    The number of results desired.

  • :start (Integer)

    The desired index of the first result returned.

Returns:

Raises:

See Also:



218
219
220
# File 'lib/echowrap/api/taste_profile.rb', line 218

def taste_profile_read(options={})
  object_from_response(Echowrap::TasteProfile, :get, '/api/v4/catalog/read', :catalog, options)
end

#taste_profile_similar(options = {}) ⇒ Array

Returns a list of all taste profiles that are similar to the given set of taste profiles. This method returns similar taste profiles of the given use type. Similarity search is restricted to taste profiles that were created with the caller’s API key.

Examples:

taste_profile_similar

Echowrap.taste_profile_similar

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :id (String)

    The ID of the taste profile. Required, can send multiple up to 10. Example: ‘CAJTFEO131216286ED’.

  • :results (Integer)

    The number of results desired. Not required, defaults to 25.

  • :start (Integer)

    The desired index of the first result returned. Not required, defaults to 0.

  • :keyvalue (String)

    Restrict results to taste profiles that have the given key/value pair. If no value is given, restrict results to all taste profiles that have the given key. Not required, may send multiple, Examples: [‘yob’, ‘gender:female’, ‘zipcode:03103’]

Returns:

  • (Array)

    Array of taste profiles

Raises:

See Also:



274
275
276
# File 'lib/echowrap/api/taste_profile.rb', line 274

def taste_profile_similar(options={})
  objects_from_response(Echowrap::TasteProfile, :get, '/api/v4/catalog/similar', :catalogs, options)
end

#taste_profile_skip(options = {}) ⇒ Boolean

Increment the skip count for the given items by the given count

Examples:

taste_profile_skip

Echowrap.taste_profile_skip(:id => 'CANVFPJ131839D8144', :item => 'kfw')

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :id (String)

    The ID of the taste profile. Required. Example: ‘CANVFPJ131839D8144’

  • :item (String)

    The id of the item(s) in the taste profile to be updated. This can be the simple item ID or the Rosetta ID of the item. The items must already be in the taste profile. Examples: ‘kfw’, ‘ARK3D5J1187B9BA0B8’, ‘CAOFUDS12BB066268E:artist:kfw’, ‘7digital-US:track:293030’

  • :skips (Integer)

    Increments the skip count for the specified item(s) by the given value. Not required, defaults to 1, must be between 1 and 100.

Returns:

  • (Boolean)

    Message success

Raises:

See Also:



94
95
96
# File 'lib/echowrap/api/taste_profile.rb', line 94

def taste_profile_skip(options={})
  boolean_from_response(:get, '/api/v4/catalog/skip', options)
end

#taste_profile_status(options = {}) ⇒ Echowrap::Status

Checks the status of a taste profile update.

Examples:

taste_profile_status

Echowrap.taste_profile_status(:ticket => 'e0ba094bbf98cd006283aa7de6780a83')

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :ticket (String)

    The ticket to check (returned by upload or update). Required. Example: ‘e0ba094bbf98cd006283aa7de6780a83’.

Returns:

Raises:

See Also:



234
235
236
# File 'lib/echowrap/api/taste_profile.rb', line 234

def taste_profile_status(options={})
  object_from_response(Echowrap::Status, :get, '/api/v4/catalog/status', nil, options)
end

#taste_profile_update(options = {}) ⇒ Echowrap::TasteProfile

Updates (adds or deletes) items from a taste profile. The body of the post should include an item block that describes modifications to the taste profile.

Examples:

taste_profile_update

Echowrap.taste_profile_update(:name => "Favorite artists of Paul", :type => 'artist')

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :id (String)

    The ID of the taste profile. Required. Example: ‘CANVFPJ131839D8144’

  • :data (String)

    The data to be uploaded. Required, Must be JSON format. See Echowrap API docs for data options

Returns:

Raises:

See Also:



38
39
40
41
42
43
44
# File 'lib/echowrap/api/taste_profile.rb', line 38

def taste_profile_update(options={})
  object_from_response(Echowrap::TasteProfile,
                       :post,
                       '/api/v4/catalog/update',
                       nil,
                       options.merge({:data_type => 'json'}))
end