Skip to content

Instantly share code, notes, and snippets.

View andyfowler's full-sized avatar

Andy Fowler andyfowler

View GitHub Profile
$response = $aboutmeApi->get();
$response->getPage(); // returns `Aboutme_Page` created from API response JSON
// no API consumer needs to know about AboutMe's API structure, only your own implemented methods.
$page->getFirstName();
$page->getBio();
// in testing
$page = Aboutme_Page::createFromResponse($yourfixture);
@andyfowler
andyfowler / merge_post.feature
Created May 23, 2014 20:00
Nutshell REST API merge spec
Feature: Merging entities
Background:
Given a Nutshell with an account
@wip
Scenario: Basic JSON API compliance
When the client requests POST /accounts/1-accounts/merge with the body:
"""
{"accounts": ["336-accounts","337-accounts"] }
SELECT pilot_name
, DATEDIFF(NOW(), MAX(IF(instructor_name IS NOT NULL, schedule_end, 0))) as days_since_last_dual_flight
, SUM(hobb_duration) as hours_past_year
, SUM(landings) as landings_past_year
, COUNT(id) as flights_past_year
, SUM(IF( schedule_end > (NOW() - INTERVAL 180 DAY), hobb_duration, 0)) as hours_180_days
, SUM(IF( schedule_end > (NOW() - INTERVAL 180 DAY), landings, 0)) as landings_180_days
, SUM(IF( schedule_end > (NOW() - INTERVAL 180 DAY), 1, 0)) as flights_180_days
, SUM(IF( schedule_end > (NOW() - INTERVAL 90 DAY), hobb_duration, 0)) as hours_90_days
, SUM(IF( schedule_end > (NOW() - INTERVAL 90 DAY), landings, 0)) as landings_90_days