Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kylefox/spreedly
A super-simple python wrapper for Spreedly.com
https://github.com/kylefox/spreedly
Last synced: 5 days ago
JSON representation
A super-simple python wrapper for Spreedly.com
- Host: GitHub
- URL: https://github.com/kylefox/spreedly
- Owner: kylefox
- Created: 2009-03-03T04:07:03.000Z (almost 16 years ago)
- Default Branch: master
- Last Pushed: 2009-05-13T04:39:48.000Z (over 15 years ago)
- Last Synced: 2024-10-30T02:42:20.548Z (about 2 months ago)
- Language: Python
- Homepage:
- Size: 78.1 KB
- Stars: 4
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This is an extremely thin wrapper around [pyactiveresource](http://code.google.com/p/pyactiveresource/) which provides easy access to the [Spreedly.com](http://spreedly.com/) API. pyactiveresource does **all** of the heavy lifting, so make sure you've installed it. python-spreedly simply adds syntactic sugar.
Example (from console):
>>> from spreedly import Spreedly
>>> spreedly = Spreedly(SPREEDLY_API_URL)
>>> customer = spreedly.Subscriber.create({
... 'customer_id': '1234',
... 'screen_name': 'Anthony Hopkins'
... })
>>> customer.attributes['store_credit']
Decimal("0.0")
To retrieve all subscribers:
spreedly.Subscriber.find()
To retrieve a specific subscriber:spreedly.Subscriber.find(1234)
Creating a Complimentary Subscription works slightly different however:>>> customer = spreedly.ComplimentarySubscription.create({
... 'duration_quantity': 30,
... 'duration_units': 'days',
... 'feature_level': 'free' }, { 'subscriber_id':1234 })
>>> customer.active
TrueTwo dictionaries are sent, one for the complimentary subscription info and one for the subscriber number.
For a full list of what the API does, check out the [Spreedly Integration Reference](http://spreedly.com/manual/integration-reference/). You might find the [Rails Examples](http://spreedly.com/manual/integration-reference/api-access-using-rails/) helpful, as they use the [ActiveResource](http://api.rubyonrails.org/files/vendor/rails/activeresource/README.html) pattern.If you've never heard of them, here's what the fine Spreedly folks do:
"Spreedly lets you collect recurring and one-time subscription payments simply and securely. Your customers can upgrade and renew with ease while you monitor everything from your dashboard. Spend your time improving your service - not building a billing system."