|
GettingStarted
Getting StartedTunecore 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:
ExamplesSet up your environment: require 'rubygems'
require 'tunecore_direct'
TunecoreDirect::Base.tunecore_server = "http://localhost:3000"
TunecoreDirect::Base.api_key = "57247d992de24d7840a1b75dc2e5c30a"
request = TunecoreDirect::Request.newCreate 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
=> 55342Get 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