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

Version Path
sportdb-1.8.27 lib/sportdb/service/public/football/js/football/api.js
sportdb-1.8.26 lib/sportdb/service/public/football/js/football/api.js
sportdb-1.8.25 lib/sportdb/service/public/football/js/football/api.js
sportdb-1.8.24 lib/sportdb/service/public/football/js/football/api.js
sportdb-1.8.23 lib/sportdb/service/public/football/js/football/api.js
sportdb-1.8.22 lib/sportdb/service/public/football/js/football/api.js
sportdb-1.8.21 lib/sportdb/service/public/football/js/football/api.js
sportdb-1.8.20 lib/sportdb/service/public/football/js/football/api.js
sportdb-1.8.19 lib/sportdb/service/public/football/js/football/api.js
sportdb-1.8.18 lib/sportdb/service/public/football/js/football/api.js
sportdb-1.8.17 lib/sportdb/service/public/football/js/football/api.js
sportdb-1.8.16 lib/sportdb/service/public/football/js/football/api.js
sportdb-1.8.15 lib/sportdb/service/public/football/js/football/api.js
sportdb-1.8.14 lib/sportdb/service/public/football/js/football/api.js
sportdb-1.8.13 lib/sportdb/service/public/football/js/football/api.js
sportdb-1.8.12 lib/sportdb/service/public/football/js/football/api.js
sportdb-1.8.11 lib/sportdb/service/public/football/js/football/api.js
sportdb-1.8.10 lib/sportdb/service/public/football/js/football/api.js
sportdb-1.8.9 lib/sportdb/service/public/football/js/football/api.js
sportdb-1.8.8 lib/sportdb/service/public/football/js/football/api.js