My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
GettingStarted  

Featured
Updated Feb 4, 2010 by alexk...@gmail.com

Getting Started

Tunecore Direct is an web service API that allows Tunecore partners to "white label" the Tunecore media distribution platform, letting you offer Tunecore's services to their customers transparently.

The web service allows a partner to:

  1. Create customer accounts
  2. Publish albums via accounts
To get started with the API first obtain an API key, then have a look at TunecoreDirect::Request

Examples

Set up your environment:

        require 'rubygems'
        require 'tunecore_direct'
        TunecoreDirect::Base.tunecore_server = "http://localhost:3000"
        TunecoreDirect::Base.api_key = "57247d992de24d7840a1b75dc2e5c30a"
        request = TunecoreDirect::Request.new

Create a person:

        # Make a new a person object and set all the attributes
        person = TunecoreDirect::Person.new( :name => "Alex Kane", 
                                            :email => "alex@gmail.com", 
                                            :phone_number => "212-555-1212", 
                                            :country => "United States", 
                                            :postal_code => "11201" )
        # Create the person on the Tunecore server
        person.create
        => false
        # Hmm it didn't work.  Let's find out why.
        person.errors
        => [{:message=>"can't be blank", :attribute=>"password"}]
        # Doh! We forgot to set a password.
        person.password = "paSSword"
        person.create
        => true
        # It worked, and we can now get the person_id which we will use later to create albums for this person
        person.person_id
        => 55342

Get a list of your people:

        response = request.get_people
        response.status
        => "complete"
        response.type
        => "people"
        response.object.first.email
        => "joe1243@blow.com"

Author:: Alex Kane (mailto:alex@tunecore.com)

Copyright:: Copyright (c) 2008 Tunecore

License:: GNU LPGPL


Sign in to add a comment
Powered by Google Project Hosting