Skip to content

Instantly share code, notes, and snippets.

View caseysoftware's full-sized avatar

Danger Casey caseysoftware

View GitHub Profile
#!/usr/bin/env ruby
def x_values
%w(a b c d)
end
def y_values
%w(m n o p)
end
@caseysoftware
caseysoftware / display.php
Last active August 29, 2015 14:13
How to process your search results from the Clarify API using the PHP library. Check out our Quickstarts for more information: http://clarify.io/docs/quickstarts/
<?php
require '../vendor/autoload.php';
$bundle = new Clarify\Bundle($apikey);
$items = $bundle->search($terms);
$search_terms = json_encode($items['search_terms']);
$item_results = json_encode($items['item_results']);
@caseysoftware
caseysoftware / clarify.php
Created January 19, 2015 17:31
This is part of the Clarify Quickstart Guide - http://clarify.io/docs/quickstart/php/
// This is dependent on the code snippet listed above
$results = $result['item_results'];
$items = $result['_links']['items'];
foreach($items as $index => $item) {
$_bundle = $bundle->load($item['href']);
echo $_bundle['_links']['self']['href'] . "\n";
echo $_bundle['name'] . "\n";
@caseysoftware
caseysoftware / search.php
Last active August 29, 2015 14:13
How to load search your audio files with the Clarify API using the PHP library. Check out our Quickstarts for more information: http://clarify.io/docs/quickstarts/
<?php
require '../vendor/autoload.php';
$bundle = new Clarify\Bundle('my api key');
$page = $bundle->search('dorothy');
$results = $page['item_results'];
$items = $page['_links']['items'];
foreach ($items as $index => $item) {
@caseysoftware
caseysoftware / clarify.php
Last active August 29, 2015 14:13
How to load an audio file into the Clarify API using the PHP library. Check out our Quickstarts for more information: http://clarify.io/docs/quickstarts/
<?php
require '../vendor/autoload.php';
$bundle = new Clarify\Bundle('my api key');
$result = $bundle->create('Dorothy and the Wizard of Oz', 'http://media.clarify.io/audio/books/dorothyandthewizardinoz_01_baum_64kb.mp3');
@caseysoftware
caseysoftware / clarify.php
Created January 16, 2015 23:07
Creating a Clarify object in PHP. This is part of the Clarify Quickstart Guide - http://clarify.io/docs/quickstart/php/
require '../vendor/autoload.php';
$bundle = new Clarify\Bundle('my api key');
@caseysoftware
caseysoftware / composer.json
Created January 16, 2015 23:06
How to install the Clarify PHP library via composer. Check out our Quickstarts for more information: http://clarify.io/docs/quickstarts/
{
"require": {
"clarify/clarify-helper": "~1.2.1"
}
}
@caseysoftware
caseysoftware / track.json
Last active August 29, 2015 14:13
This is a sample Track Notification received when you use the notify_url parameter.
{
"bundle_id":"abcdef",
"track_id":"123456",
"updated":"2014-08-25T22:12:39.574Z",
"name":"Dorothy and the Wizard of Oz",
"external_id":"my_id_123",
"_class":"TrackNotification",
"_links":{
"curies":[{
"href":"/docs/rels/{rel}","name":"clarify","templated":true
@caseysoftware
caseysoftware / bundle.json
Last active August 29, 2015 14:13
This is a sample Bundle Notification received when you use the notify_url parameter.
{
"bundle_id":"abcdef",
"updated":"2014-08-25T22:12:39.574Z",
"bundle_processing_cost":0.1,
"name":"Dorothy and the Wizard of Oz",
"external_id":"my_id_123",
"_class":"BundleNotification",
"_links":{
"curies":[{
"href":"/docs/rels/{rel}","name":"clarify","templated":true
@caseysoftware
caseysoftware / create.php
Last active August 29, 2015 14:13
Example using the notify_url callback via the PHP helper library
<?php
// Don't forget to rename creds-dist.php to creds.php and insert your API key
require 'creds.php';
// This assumes you've installed the library via composer
require 'vendor/autoload.php';
$bundle = new \Clarify\Bundle($apikey);
$success = $bundle->create(