Skip to content

Commit

Permalink
chore: * create non-minified dist file * fixed dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnnyTheTank committed Jan 2, 2016
1 parent 3692fe6 commit 161e894
Show file tree
Hide file tree
Showing 6 changed files with 173 additions and 16 deletions.
14 changes: 13 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,23 @@ module.exports = function(grunt) {
banner: '\n/*! <%= pkg.name %> v<%= pkg.version %> (<%= grunt.template.today("dd-mm-yyyy") %>) by <%= pkg.author %> */\n',
}
},
concat: {
options: {
separator: ';',
banner: '\n/*! <%= pkg.name %> v<%= pkg.version %> (<%= grunt.template.today("dd-mm-yyyy") %>) by <%= pkg.author %> */\n',
},
dist: {
files : {
'dist/angular-vimeo-api-factory.js' : ['src/angular-vimeo-api-factory.js']
}
},
},
watch: {
minifiyJs: {
files: [
'src/angular-vimeo-api-factory.js'
],
tasks: ['uglify'],
tasks: ['uglify', 'concat'],
options: {
spawn: true,
},
Expand All @@ -27,6 +38,7 @@ module.exports = function(grunt) {

grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');

grunt.registerTask('default', ['watch']);

Expand Down
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,24 @@ Author: Jonathan Hornung ([JohnnyTheTank](https://github.com/JohnnyTheTank))

## Usage

1. Install via [bower](http://bower.io/) :
1. Install via either [bower](http://bower.io/), [npm](https://www.npmjs.com/) or downloaded files:
1. `bower install --save angular-vimeo-api-factory`
2. `npm install --save angular-vimeo-api-factory`
3. download [angular-vimeo-api-factory.zip](https://github.com/JohnnyTheTank/angular-vimeo-api-factory/zipball/master)
2. Add `jtt_vimeo` to your application's module dependencies.
3. Include dependencies in your HTML.
1. When using bower:

```html
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/angular-vimeo-api-factory/src/angular-vimeo-api-factory.js"></script>
<script src="bower_components/angular-vimeo-api-factory/src/angular-vimeo-api-factory.min.js"></script>
```
2. When using npm:
```html
<script src="node_modules/angular-vimeo-api-factory/src/angular-vimeo-api-factory.min.js"></script>
```
3. when using downloaded files
```html
<script src="angular-vimeo-api-factory.min.js"></script>
```

4. Use the factory `vimeoFactory`


Expand Down
7 changes: 2 additions & 5 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "angular-vimeo-api-factory",
"description": "angularjs factory for vimeo json rest api requests",
"version": "0.1.2",
"version": "0.5.0",
"main": "Gruntfile.js",
"authors": [
"Jonathan Hornung"
Expand All @@ -24,8 +24,5 @@
"bower_components",
"test",
"tests"
],
"dependencies": {
"angular": "*"
}
]
}
143 changes: 143 additions & 0 deletions dist/angular-vimeo-api-factory.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@

/*! angular-vimeo-api-factory v0.5.0 (02-01-2016) by Jonathan Hornung */
"use strict";

/**
@author Jonathan Hornung (https://github.com/JohnnyTheTank)
@url https://github.com/JohnnyTheTank/angular-vimeo-api-factory
@licence MIT
*/

angular.module("jtt_vimeo", [])
.factory('vimeoFactory', ['$http', 'vimeoSearchDataService', function ($http, vimeoSearchDataService) {

var vimeoFactory = {};

vimeoFactory.getVideosFromChannel = function (_params) {

if(!_params.channel) {
return false;
}

var searchData = vimeoSearchDataService.getNew("videosFromChannel", _params);

return $http({
method: 'GET',
url: searchData.url,
params: searchData.object,
}
);
};

vimeoFactory.getVideosFromCategory = function (_params) {

if(!_params.category) {
return false;
}

var searchData = vimeoSearchDataService.getNew("videosFromCategory", _params);

return $http({
method: 'GET',
url: searchData.url,
params: searchData.object,
}
);
};

vimeoFactory.getVideosFromTag = function (_params) {

if(!_params.tag) {
return false;
}

var searchData = vimeoSearchDataService.getNew("videosFromTag", _params);

return $http({
method: 'GET',
url: searchData.url,
params: searchData.object,
}
);
};

vimeoFactory.getVideosFromUser = function (_params) {

if(!_params.user) {
return false;
}

var searchData = vimeoSearchDataService.getNew("videosFromUser", _params);

return $http({
method: 'GET',
url: searchData.url,
params: searchData.object,
}
);
};

return vimeoFactory;
}])
.service('vimeoSearchDataService', function () {
this.getApiBaseUrl = function (_params) {
return "https://api.vimeo.com/";
};

this.fillDataInObjectByList = function (_object, _params, _list) {

angular.forEach(_list, function (value, key) {
if (typeof _params[value] !== "undefined") {
_object.object[value] = _params[value];
}
});

return _object;
};

this.getNew = function (_type, _params) {

var vimeoSearchData = {
object: {
access_token: _params.access_token,
},
url: "",
};

switch (_type) {
case "videosFromChannel":
vimeoSearchData = this.fillDataInObjectByList(vimeoSearchData, _params, [
'page', 'query', 'filter', 'filter_embeddable', 'sort', 'direction', 'per_page'
]);

vimeoSearchData.url = this.getApiBaseUrl() + "channels/" + _params.channel + "/videos";
break;

case "videosFromCategory":
vimeoSearchData = this.fillDataInObjectByList(vimeoSearchData, _params, [
'page', 'query', 'filter', 'filter_embeddable', 'sort', 'direction', 'per_page'
]);

vimeoSearchData.url = this.getApiBaseUrl() + "categories/" + _params.category + "/videos";
break;

case "videosFromTag":
vimeoSearchData = this.fillDataInObjectByList(vimeoSearchData, _params, [
'page', 'query', 'sort', 'direction', 'per_page'
]);

vimeoSearchData.url = this.getApiBaseUrl() + "tags/" + _params.tag + "/videos";
break;

case "videosFromUser":
vimeoSearchData = this.fillDataInObjectByList(vimeoSearchData, _params, [
'page', 'query', 'filter', 'filter_embeddable', 'sort', 'direction', 'per_page'
]);

vimeoSearchData.url = this.getApiBaseUrl() + "users/" + _params.user + "/videos";
break;
}

return vimeoSearchData;
};
});
2 changes: 1 addition & 1 deletion dist/angular-vimeo-api-factory.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-vimeo-api-factory",
"version": "0.1.2",
"version": "0.5.0",
"description": "angularjs factory for vimeo json rest api requests",
"main": "Gruntfile.js",
"scripts": {
Expand All @@ -25,10 +25,8 @@
"homepage": "https://github.com/JohnnyTheTank/angular-vimeo-api-factory#readme",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-concat": "^0.5.1",
"grunt-contrib-uglify": "^0.11.0",
"grunt-contrib-watch": "^0.6.1"
},
"dependencies": {
"angular": "*"
}
}

0 comments on commit 161e894

Please sign in to comment.