Class: Echonest::ApiMethods::Catalog

Inherits:
Base
  • Object
show all
Defined in:
lib/echonest/api.rb

Overview

Instance Method Summary collapse

Methods inherited from Base

build_params_with_validation, #initialize, method_with_option, method_with_required_any, #request, validator

Constructor Details

This class inherits a constructor from Echonest::ApiMethods::Base

Instance Method Details

#create(name, type = "artist") ⇒ Object

type can be ‘song’ or ‘artist’ (Default)



352
353
354
# File 'lib/echonest/api.rb', line 352

def create(name, type="artist")
  @api.request('catalog/create', :post, {:name => name, :type => type, :format => "json"}).body
end

#update(catalog_id, data) ⇒ Object

Updates (adds or deletes) items from a catalog. The body of the post should include an item block that describes modifications to the catalog. data: [=> “hogehoge”, :artist_name => “Oscar Peterson”}]



358
359
360
361
# File 'lib/echonest/api.rb', line 358

def update(catalog_id, data)
  json_data = data.to_json
  @api.request('catalog/update', :post, {:id => catalog_id, :data_type => "json", :format => "json", :data => json_data}).body
end