Class: TunecoreDirect::Request
- Includes:
- TunecoreDirect
- Defined in:
- lib/tunecore_direct/request.rb
Overview
This class includes all the methods that you have to interact with the TuneCore web service.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#create_album(params = {}) ⇒ Object
Creates this new Album at TuneCore.
-
#create_person(email, password, name, phone_number, country, postal_code = nil) ⇒ Object
Creates a new account at Tunecore.
-
#create_song(params = {}) ⇒ Object
Creates this new Song at TuneCore.
-
#get_album(album_id) ⇒ Object
Returns Response that will contain an #Album.
-
#get_albums(person_id = nil) ⇒ Object
Returns a Response that will contain many #Album objects.
-
#get_people ⇒ Object
Returns an array of #Person objects associated with the current API key.
-
#get_person(person_id) ⇒ Object
Returns a #Person object for the given id.
-
#takedown_album(album_id) ⇒ Object
Sends a takedown request for this album.
Methods inherited from Base
api_key, #api_key, api_key=, #to_xml, tunecore_server, #tunecore_server, tunecore_server=
Instance Method Details
#create_album(params = {}) ⇒ Object
Creates this new Album at TuneCore
22 23 24 25 26 |
# File 'lib/tunecore_direct/request.rb', line 22 def create_album( params={} ) http_res = http_post("create_album", params ) tc_res = Response.new( http_res.body ) return tc_res end |
#create_person(email, password, name, phone_number, country, postal_code = nil) ⇒ Object
Creates a new account at Tunecore
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/tunecore_direct/request.rb', line 8 def create_person(email, password, name, phone_number, country, postal_code=nil) parameters = { "email" => email, "password" => password, "name" => name, "phone_number" => phone_number, "country" => country, "postal_code" => postal_code } http_res = http_post("create_person", parameters ) tc_res = Response.new( http_res.body ) return tc_res end |
#create_song(params = {}) ⇒ Object
Creates this new Song at TuneCore
29 30 31 32 33 |
# File 'lib/tunecore_direct/request.rb', line 29 def create_song( params={} ) http_res = http_post("create_song", params ) tc_res = Response.new( http_res.body ) return tc_res end |
#get_album(album_id) ⇒ Object
Returns Response that will contain an #Album
36 37 38 39 40 41 |
# File 'lib/tunecore_direct/request.rb', line 36 def get_album(album_id) params = { "album_id" => album_id } http_res = http_post("get_album", params ) tc_res = Response.new( http_res.body ) return tc_res end |
#get_albums(person_id = nil) ⇒ Object
Returns a Response that will contain many #Album objects
44 45 46 47 48 49 |
# File 'lib/tunecore_direct/request.rb', line 44 def get_albums(person_id=nil) params = { "person_id" => person_id } http_res = http_post("get_albums", params ) tc_res = Response.new( http_res.body ) return tc_res end |
#get_people ⇒ Object
Returns an array of #Person objects associated with the current API key.
60 61 62 63 64 |
# File 'lib/tunecore_direct/request.rb', line 60 def get_people http_res = http_post("get_people", Hash.new ) tc_res = Response.new( http_res.body ) return tc_res end |
#get_person(person_id) ⇒ Object
Returns a #Person object for the given id
52 53 54 55 56 57 |
# File 'lib/tunecore_direct/request.rb', line 52 def get_person(person_id) parameters = {"person_id" => person_id} http_res = http_post("get_person", parameters ) tc_res = Response.new( http_res.body ) return tc_res end |
#takedown_album(album_id) ⇒ Object
Sends a takedown request for this album
67 68 69 70 71 72 |
# File 'lib/tunecore_direct/request.rb', line 67 def takedown_album(album_id) params = {"album_id" => album_id} http_res = http_post("takedown_album", params ) tc_res = Response.new( http_res.body ) return tc_res end |