Created
September 26, 2013 18:15
-
-
Save greggyNapalm/6718271 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* JSHint strict mode tweak */ | |
| /*jshint globalstrict: true*/ | |
| /*jshint browser: true*/ | |
| /*global $, _, angular, ya, app */ | |
| 'use strict'; | |
| var APITestMixIn = { | |
| get_tests: function (url, per_page) { | |
| /* Retrieve test entries from REST API, infinit data pagination aka | |
| * GitHUb api. | |
| */ | |
| url = url || url_base + 'tests/'; | |
| if(!(_.isUndefined(per_page))) { | |
| url = url + '?per_page=' + per_page; | |
| } | |
| return $http.get(url); | |
| }, | |
| get_test: function (test_id) { | |
| /* Fetch single test resource by uniq id. | |
| */ | |
| if(typeof(test_id) === 'undefined') { | |
| throw 'Rrequired parameters missing:*test_id*'; | |
| } | |
| return $http.get(url_base + 'tests/' + test_id); | |
| }, | |
| get_lunapark_test: function (lunapark_test_id) { | |
| /* Fetch load test resource or retrive KSHM API repr if missing. | |
| */ | |
| if(typeof(lunapark_test_id) === 'undefined') { | |
| throw 'Rrequired parameters missing:*lunapark_test_id*'; | |
| } | |
| return $http.get(url_base + 'tests/luna/' + lunapark_test_id); | |
| }, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment