2017 © Pedro Peláez
 

library cuecloud-php

PHP client for the CueCloud API

image

cuecloud/cuecloud-php

PHP client for the CueCloud API

  • Friday, December 5, 2014
  • by cuecloud
  • Repository
  • 2 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

CueCloud PHP API Client Library

Installation

The CueCloud PHP API client can be installed using Composer. You shouldn't have any problem installing it following these steps., (*1)

Composer

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

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)

Usage

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)

validateUser()

Test method to make sure that the user has valid API credentials., (*9)

getKeywords()

Request common keywords for Cues, that are returned within a list., (*10)

getBalance()

Request the user's current balance, in USD., (*11)

makeDeposit($amountUSD, $ccLastFour)

Given a valid credit card on file in the app, this will deposit a given amount into the user's balance., (*12)

withdrawFunds($amountUSD)

Given a PayPal email, this will deposit the funds immediately into that user's PayPal account., (*13)

grantBonus($cueCompletionId, $amount, $reason, $noteToSelf)

This will grant a bonus to the user who has completed a particular Cue for us., (*14)

getPayments($paymentType, $paymentId, $noteToSelf, $page)

Get a list of payments, with some options to filter. If not filter is provided, all payments will be returned., (*15)

approveCueCompletion($cueCompletionId)

Approve a CueCompletion that has been submitted to a user's Cue., (*16)

declineCueCompletion($cueCompletionId)

Decline a CueCompletion that has been submitted to a user's Cue., (*17)

cancelCue($cueId)

Cancel a Cue that the user has posted, refunding their balance, (*18)

createCue($title, $amount, $numOpportunities, $description, $isAnonymous, $pushNotificationOnCueCompletion, $disallowAnonymous, $iFrameUrl, $urlNotificationOnCueCompletion, $emailNotificationOnCueCompletion, $lifetimeInMinutes, $timeLimitToCompleteCueInMinutes, $autoApproveCueCompletionInMinute, $noteToSelf, $keywords)

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)

getCues($cueId, $groupId, $noteToSelf, $hasPendingCueCompletions, $status, $page)

Get a list of all the Cues the use has created. Some filters are available as parameters., (*20)

assignCue($cueId)

Try and check-in or check-out a Cue depending on whether the Cue is already checked out by that user., (*21)

getCueCompletion($cueId, $cueCompletionId, $status, $page)

Get CueCompletions for a particular Cue, or filter by CueCompletion, or status., (*22)

submitCueCompletion($assignmentId, $answerText, $videoUrl, $videoThumbnail, $imageUrl, $isAnonymous)

Submit the CueCompletion data, though in production the method will block any requests without an HTTP_REFERER., (*23)

Running Tests

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)

The Versions

05/12 2014

dev-master

9999999-dev

PHP client for the CueCloud API

  Sources   Download

MIT License

The Requires

  • php >=5.3.1

 

The Development Requires

by Miguel Molina