Sha256: e155dcdddd7a7593d53bb7c53c14c1ab5b0e96c67bad2254b42ea3a8c141e42d
Contents?: true
Size: 1.6 KB
Versions: 14
Compression:
Stored size: 1.6 KB
Contents
/** * This service gives access to the documentation metadata */ app.factory('Documentation', function($http, $q) { var versions = $q.when($http.get('api/index-new.json', { cache: true }).then(function(data) { return $q.all(_.map(data.data.versions, function(version) { return $http.get('api/' + version + '.json', {cache: true}).then(function(versionData) { return [version, versionData.data]; }); })).then(_.zipObject); })); return { /** * Returns an array of version strings */ versions: function() { return versions.then(_.keys); }, /** * Returns the info for the requested version */ info: function(version) { return versions.then(function(v) { return v[version].info; }); }, /** * Returns a list of controllers and types, useful for generating navigation */ items: function(version) { return versions.then(function(v) { return v[version]; }); }, /** * Returns description of a controller */ controller: function(version, name) { return this.items(version).then(function(v) { var controller = v.resources[name]; controller.id = name; return controller; }); }, /** * Returns a description of a type */ type: function(version, name) { return versions.then(function(v) { return v[version].schemas[name]; }); }, /** * Returns a description of a trait */ trait: function(version, name) { return versions.then(function(v) { return v[version].traits[name]; }); } }; });
Version data entries
14 entries across 14 versions & 1 rubygems