dev-master
9999999-devPHP client for the CueCloud API
MIT License
The Requires
- php >=5.3.1
The Development Requires
by Miguel Molina
Wallogit.com
2017 © Pedro Peláez
PHP client for the CueCloud API
The CueCloud PHP API client can be installed using Composer. You shouldn't have any problem installing it following these steps., (*1)
You'll need to create a composer file for your project, you can do it editing it yourself or generate it answering the questions that composer would ask you after running:, (*2)
composer init
You need to set the CueCloud PHP API Client as a required package for your project, using the package identifier (cuecloud/cuecloud-php)., (*3)
Your composer.json should look something like this:, (*4)
The result should be something like (pay special attention to the require item):, (*5)
{
"name": "test/my-test",
"description": "This is a test",
"license": "MIT License",
"authors": [
{
"name": "John Doe",
"email": "john@doe.com"
}
],
"require": {
"cuecloud/cuecloud-php": "dev-master"
}
}
Configuration is done through the constructor of CueCloud\API\Client. This is mandatory and if not passed none of the API methods will work., (*6)
use CueCloud\API\Client as CueCloudAPI; $apiKey = 'your_API_key'; $apiPass = 'your_secret_password'; $client = new CueCloud($apiKey, $apiPass);
Additional parameters could be passed: the version of the API, and the base URL as well (although this parameter is only useful for CueCloud developers)., (*7)
Once you added the library as a requirement in composer, and set your API key and password when instantiating the CueCloud client, you are ready to call any of the methods provided:, (*8)
Test method to make sure that the user has valid API credentials., (*9)
Request common keywords for Cues, that are returned within a list., (*10)
Request the user's current balance, in USD., (*11)
Given a valid credit card on file in the app, this will deposit a given amount into the user's balance., (*12)
Given a PayPal email, this will deposit the funds immediately into that user's PayPal account., (*13)
This will grant a bonus to the user who has completed a particular Cue for us., (*14)
Get a list of payments, with some options to filter. If not filter is provided, all payments will be returned., (*15)
Approve a CueCompletion that has been submitted to a user's Cue., (*16)
Decline a CueCompletion that has been submitted to a user's Cue., (*17)
Cancel a Cue that the user has posted, refunding their balance, (*18)
Create a new Cue. The only required parameters are the title, amount, and the number of opportunities (which defaults to 1 otherwise). An iframe URL can be specified so the user would fill a custom form on a given URL (usually your site), (*19)
Get a list of all the Cues the use has created. Some filters are available as parameters., (*20)
Try and check-in or check-out a Cue depending on whether the Cue is already checked out by that user., (*21)
Get CueCompletions for a particular Cue, or filter by CueCompletion, or status., (*22)
Submit the CueCompletion data, though in production the method will block any requests without an HTTP_REFERER., (*23)
A collection of integration tests is included. To execute them use phpunit, which should be already installed via composer because it's a development dependency of the CueCloud PHP API client:, (*24)
phpunit ./tests/
This will use the settings included on phpunit.xml., (*25)
Alternatively (useful only for CueCloud developers) the integration tests could be ran against their local development server using the settings on phpunit.local.xml, executing:, (*26)
phpunit -c phpunit.local.xml ./tests/
Copyright 2014 CueCloud. Licensed under the MIT License., (*27)
PHP client for the CueCloud API
MIT License