Methods¶
All methods require an instatiated Tugboat object with a valid API Authorization Token. For now you can get one by emailing api@tugboatyards.com.
- Tugboat.__init__(api_auth=None, api_endpoint=None)¶
To instantiate a Tugboat() client you will need an API token. If you are a publisher you can tokens by emailing api@tugboatyards.com. You can optionally pass in a custom api_endpoint but it is not required.
- Tugboat.CheckKey()¶
A test method for verifying a key is valid. This method returns True if the key is valid, False if it is invalid.
The corresponding API method is GET /key-check.
- Tugboat.GetPage(page_id=None)¶
A method that returns a tugboatyards.Page object. The page_id parameter is optional. If a page_id is not specified the API defaults to the API application’s default page.
The corresponding API method is GET /page[/page_id].
- Tugboat.GetOffer(offer_id=0)¶
A method that returns a tugboatyards.Offer object. The offer_id is required.
The corresponding API method is GET /offer/(offer_id).
- Tugboat.GetSubscribers(offer_id=0)¶
A method that returns a list of tugboatyards.Subscriber objects. The method can only be called for an offer_id that is recurring.
The corresponding API method is GET /offer/(offer_id)/subscribers.
- Tugboat.CreateOffer(page_id=0, offer_name='', title='', thank_you_message='', amount=0.0, is_recurring=False, desc='', period='', offer_type='', issues=[])¶
This method creates an offer. The the return value is a tugboatyards.Offer. Required fields are page_id, offer_name, title, thank_you_message, amount, and desc.
The corresponding API method is POST /offers.
- Tugboat.UpdateOffer(offer_id=None, amount=None, title=None, desc=None, period=None, issues=[])¶
This method updates an offer. The the return value is the tugboatyards.Offer with the updated attributes. The offer_id and one attribute are the only fields that are required.
The corresponding API method is POST /offer/(offer_id).
- Tugboat.DeleteOffer(offer_id=None)¶
This is a convenience method that sets an offer’s status to deleted. The the return value is the tugboatyards.Offer with the new status. The offer_id is required.
The corresponding API method is POST /offer/(offer_id).
- Tugboat.AppendIssueToOffer(offer_id=0, issue={})¶
This method accepts an offer_id and two item dict that should contain two keys: issue_name and title.
Example:
{"issue_name": "issue-01","title": "The issue title."}
The response is a list of tugboatyards.Issue objects.
The corresponding API method is POST /offer/(offer_id)/issues.
- Tugboat.GetCheckout(checkout_id=0)¶
This method returns a tugboatyards.Checkout object. The checkout_id is required. This method is mainly used to verify an IPN message.
The corresponding API method is GET /checkout/(checkout_id).