Sha256: afc39e317d1556c441c72f4209c97128e960875e56b814d5449da574a815508e
Contents?: true
Size: 1.17 KB
Versions: 34
Compression:
Stored size: 1.17 KB
Contents
//////////////////////////////////// // football.db api wrapper define( function(require) { 'use strict'; require( 'utils' ); var Api = {}; Api.create = function( opts ) { var defaults = { baseUrl: 'http://footballdb.herokuapp.com/api/v1' }; var settings; function init( opts ) { settings = _.extend( {}, defaults, opts ); debug( 'baseUrl: ' + settings.baseUrl ); } function fetch( path, onsuccess ) { var url = settings.baseUrl + path + '?callback=?'; $.getJSON( url, onsuccess ); } function fetchRounds( event, onsuccess ) { fetch( '/event/' + event + '/rounds', onsuccess ); } function fetchRound( event, round, onsuccess ) { fetch( '/event/' + event + '/round/' + round, onsuccess ); } function fetchRoundsToday( onsuccess ) { // fetch( '/rounds/2013.6.30', onsuccess ); fetch( '/rounds/today', onsuccess ); } // call "c'tor/constructor" init( opts ); // return/export public api return { fetchRound: fetchRound, fetchRounds: fetchRounds, fetchRoundsToday: fetchRoundsToday } } // end fn Api.create return Api; }); // end define
Version data entries
34 entries across 34 versions & 1 rubygems