Last active
August 29, 2015 14:05
-
-
Save wesleytodd/e54cfa3bbbb96ed18ca1 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
(function() { |
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
angular.module('video', []) | |
.service('VideoSingle', [VideoSingle]); | |
})(); |
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
/** | |
* @file Video Single Model | |
* @version 1.0 | |
* @module video | |
*/ | |
/* exports VideoSingle */ | |
/** | |
* Video Single Model | |
* | |
* This represents the data and functionality for a single video instance | |
* | |
* @constructs module:video.VideoSingle | |
* @memberof module:video | |
* @extends module:util.EventEmitter | |
* @param {object} options - The video single options | |
* | |
* @requires module:vube.util.extend | |
* @requires module:vube.util.EventEmitter | |
*/ | |
var VideoSingle = function(http) { | |
this.http = http; | |
this.options = vube.util.extend({}, options, VideoSingle.defaultOptions); | |
}; | |
util.extend(VideoSingle.prototype, vube.util.EventEmitter); | |
/** | |
* The default options for a `VideoSingle` | |
* | |
* @var defaultOptions | |
* @memberof module:video.VideoSingle | |
* @static | |
*/ | |
VideoSingle.defaultOptions = { | |
singleApi: '/t-api/video/' | |
}; | |
/** | |
* Gets a single video from the api | |
* | |
* @function get | |
* @memberof module:video.VideoSingle | |
* @instance | |
* @param {string} urlId - The url id to get form the api | |
* @returns {module:xhr.XHR} - The xhr instance | |
*/ | |
VideoSingle.prototype.get = function(urlId) { | |
return this.http({ | |
url: this.options.singleApi + urlId | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment