Skip to content

Commit 161e894

Browse files
committed
chore: * create non-minified dist file * fixed dependencies
1 parent 3692fe6 commit 161e894

File tree

6 files changed

+173
-16
lines changed

6 files changed

+173
-16
lines changed

Gruntfile.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,23 @@ module.exports = function(grunt) {
1212
banner: '\n/*! <%= pkg.name %> v<%= pkg.version %> (<%= grunt.template.today("dd-mm-yyyy") %>) by <%= pkg.author %> */\n',
1313
}
1414
},
15+
concat: {
16+
options: {
17+
separator: ';',
18+
banner: '\n/*! <%= pkg.name %> v<%= pkg.version %> (<%= grunt.template.today("dd-mm-yyyy") %>) by <%= pkg.author %> */\n',
19+
},
20+
dist: {
21+
files : {
22+
'dist/angular-vimeo-api-factory.js' : ['src/angular-vimeo-api-factory.js']
23+
}
24+
},
25+
},
1526
watch: {
1627
minifiyJs: {
1728
files: [
1829
'src/angular-vimeo-api-factory.js'
1930
],
20-
tasks: ['uglify'],
31+
tasks: ['uglify', 'concat'],
2132
options: {
2233
spawn: true,
2334
},
@@ -27,6 +38,7 @@ module.exports = function(grunt) {
2738

2839
grunt.loadNpmTasks('grunt-contrib-uglify');
2940
grunt.loadNpmTasks('grunt-contrib-watch');
41+
grunt.loadNpmTasks('grunt-contrib-concat');
3042

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

README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,24 @@ Author: Jonathan Hornung ([JohnnyTheTank](https://github.com/JohnnyTheTank))
44

55
## Usage
66

7-
1. Install via [bower](http://bower.io/) :
7+
1. Install via either [bower](http://bower.io/), [npm](https://www.npmjs.com/) or downloaded files:
88
1. `bower install --save angular-vimeo-api-factory`
9+
2. `npm install --save angular-vimeo-api-factory`
10+
3. download [angular-vimeo-api-factory.zip](https://github.com/JohnnyTheTank/angular-vimeo-api-factory/zipball/master)
911
2. Add `jtt_vimeo` to your application's module dependencies.
1012
3. Include dependencies in your HTML.
1113
1. When using bower:
12-
1314
```html
14-
<script src="bower_components/angular/angular.js"></script>
15-
<script src="bower_components/angular-vimeo-api-factory/src/angular-vimeo-api-factory.js"></script>
15+
<script src="bower_components/angular-vimeo-api-factory/src/angular-vimeo-api-factory.min.js"></script>
16+
```
17+
2. When using npm:
18+
```html
19+
<script src="node_modules/angular-vimeo-api-factory/src/angular-vimeo-api-factory.min.js"></script>
20+
```
21+
3. when using downloaded files
22+
```html
23+
<script src="angular-vimeo-api-factory.min.js"></script>
1624
```
17-
1825
4. Use the factory `vimeoFactory`
1926

2027

bower.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "angular-vimeo-api-factory",
33
"description": "angularjs factory for vimeo json rest api requests",
4-
"version": "0.1.2",
4+
"version": "0.5.0",
55
"main": "Gruntfile.js",
66
"authors": [
77
"Jonathan Hornung"
@@ -24,8 +24,5 @@
2424
"bower_components",
2525
"test",
2626
"tests"
27-
],
28-
"dependencies": {
29-
"angular": "*"
30-
}
27+
]
3128
}

dist/angular-vimeo-api-factory.js

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
2+
/*! angular-vimeo-api-factory v0.5.0 (02-01-2016) by Jonathan Hornung */
3+
"use strict";
4+
5+
/**
6+
@author Jonathan Hornung (https://github.com/JohnnyTheTank)
7+
@url https://github.com/JohnnyTheTank/angular-vimeo-api-factory
8+
@licence MIT
9+
*/
10+
11+
angular.module("jtt_vimeo", [])
12+
.factory('vimeoFactory', ['$http', 'vimeoSearchDataService', function ($http, vimeoSearchDataService) {
13+
14+
var vimeoFactory = {};
15+
16+
vimeoFactory.getVideosFromChannel = function (_params) {
17+
18+
if(!_params.channel) {
19+
return false;
20+
}
21+
22+
var searchData = vimeoSearchDataService.getNew("videosFromChannel", _params);
23+
24+
return $http({
25+
method: 'GET',
26+
url: searchData.url,
27+
params: searchData.object,
28+
}
29+
);
30+
};
31+
32+
vimeoFactory.getVideosFromCategory = function (_params) {
33+
34+
if(!_params.category) {
35+
return false;
36+
}
37+
38+
var searchData = vimeoSearchDataService.getNew("videosFromCategory", _params);
39+
40+
return $http({
41+
method: 'GET',
42+
url: searchData.url,
43+
params: searchData.object,
44+
}
45+
);
46+
};
47+
48+
vimeoFactory.getVideosFromTag = function (_params) {
49+
50+
if(!_params.tag) {
51+
return false;
52+
}
53+
54+
var searchData = vimeoSearchDataService.getNew("videosFromTag", _params);
55+
56+
return $http({
57+
method: 'GET',
58+
url: searchData.url,
59+
params: searchData.object,
60+
}
61+
);
62+
};
63+
64+
vimeoFactory.getVideosFromUser = function (_params) {
65+
66+
if(!_params.user) {
67+
return false;
68+
}
69+
70+
var searchData = vimeoSearchDataService.getNew("videosFromUser", _params);
71+
72+
return $http({
73+
method: 'GET',
74+
url: searchData.url,
75+
params: searchData.object,
76+
}
77+
);
78+
};
79+
80+
return vimeoFactory;
81+
}])
82+
.service('vimeoSearchDataService', function () {
83+
this.getApiBaseUrl = function (_params) {
84+
return "https://api.vimeo.com/";
85+
};
86+
87+
this.fillDataInObjectByList = function (_object, _params, _list) {
88+
89+
angular.forEach(_list, function (value, key) {
90+
if (typeof _params[value] !== "undefined") {
91+
_object.object[value] = _params[value];
92+
}
93+
});
94+
95+
return _object;
96+
};
97+
98+
this.getNew = function (_type, _params) {
99+
100+
var vimeoSearchData = {
101+
object: {
102+
access_token: _params.access_token,
103+
},
104+
url: "",
105+
};
106+
107+
switch (_type) {
108+
case "videosFromChannel":
109+
vimeoSearchData = this.fillDataInObjectByList(vimeoSearchData, _params, [
110+
'page', 'query', 'filter', 'filter_embeddable', 'sort', 'direction', 'per_page'
111+
]);
112+
113+
vimeoSearchData.url = this.getApiBaseUrl() + "channels/" + _params.channel + "/videos";
114+
break;
115+
116+
case "videosFromCategory":
117+
vimeoSearchData = this.fillDataInObjectByList(vimeoSearchData, _params, [
118+
'page', 'query', 'filter', 'filter_embeddable', 'sort', 'direction', 'per_page'
119+
]);
120+
121+
vimeoSearchData.url = this.getApiBaseUrl() + "categories/" + _params.category + "/videos";
122+
break;
123+
124+
case "videosFromTag":
125+
vimeoSearchData = this.fillDataInObjectByList(vimeoSearchData, _params, [
126+
'page', 'query', 'sort', 'direction', 'per_page'
127+
]);
128+
129+
vimeoSearchData.url = this.getApiBaseUrl() + "tags/" + _params.tag + "/videos";
130+
break;
131+
132+
case "videosFromUser":
133+
vimeoSearchData = this.fillDataInObjectByList(vimeoSearchData, _params, [
134+
'page', 'query', 'filter', 'filter_embeddable', 'sort', 'direction', 'per_page'
135+
]);
136+
137+
vimeoSearchData.url = this.getApiBaseUrl() + "users/" + _params.user + "/videos";
138+
break;
139+
}
140+
141+
return vimeoSearchData;
142+
};
143+
});

dist/angular-vimeo-api-factory.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-vimeo-api-factory",
3-
"version": "0.1.2",
3+
"version": "0.5.0",
44
"description": "angularjs factory for vimeo json rest api requests",
55
"main": "Gruntfile.js",
66
"scripts": {
@@ -25,10 +25,8 @@
2525
"homepage": "https://github.com/JohnnyTheTank/angular-vimeo-api-factory#readme",
2626
"devDependencies": {
2727
"grunt": "^0.4.5",
28+
"grunt-contrib-concat": "^0.5.1",
2829
"grunt-contrib-uglify": "^0.11.0",
2930
"grunt-contrib-watch": "^0.6.1"
30-
},
31-
"dependencies": {
32-
"angular": "*"
3331
}
3432
}

0 commit comments

Comments
 (0)