Skip to content

Instantly share code, notes, and snippets.

@wesleytodd
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wesleytodd/e54cfa3bbbb96ed18ca1 to your computer and use it in GitHub Desktop.
Save wesleytodd/e54cfa3bbbb96ed18ca1 to your computer and use it in GitHub Desktop.
(function() {
angular.module('video', [])
.service('VideoSingle', [VideoSingle]);
})();
/**
* @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