
Python client library for Sunnytrail
====================================

The fastest and easiest way to integrate.

Requirements
------------

Python 2.5

How to install
--------------

** First of all ensure that all tests pass on your system

  $ python setup.py test

** Install in the global or active environment

  $ python setup.py install

How to send events
------------------

  client = sunnytrail.Sunnytrail('YOUR-KEY')

  try:
    client.send(sunnytrail.SignupEvent('id', 'name', 
      'email', sunnytrail.Plan('name', 'price'))

  except sunnytrail.ServiceUnavailable:
    # add the message to a local queue and retry later

  except sunnytrail.InvalidMessage:
    # server side message validation failed. check data

  except sunnytrail.InvalidAPIKey:
    # check your API key. 

  except sunnytrail.SunnytrailException:
    # unexpected sunnytrail exception

  etc. -- check the tests for more usage examples

Type of events
--------------

Signup: 
  sunnytrail.SignupEvent

Payment: 
  sunnytrail.PayEvent

Cancel: 
  sunnytrail.CancelEvent

Command line interface
----------------------

** Signup for a free plan

$ ./sunnytrail --key=YOUR-KEY --name=Username --email=user@example.com --action=signup --plan="Free Trial" --price=0

** Upgrade to a paied plan

$ ./sunnytrail --key=YOUR-KEY --name=Username --email=user@example.com --action=signup --plan="Basic" --price=9.99

** Cancel account

$ ./sunnytrail --key=YOUR-KEY --name=Username --email=user@example.com --action=cancel


