Skip to content

Commit

Permalink
first stable version
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnnyTheTank committed Dec 30, 2015
1 parent f21dd73 commit 490346d
Show file tree
Hide file tree
Showing 9 changed files with 388 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/bower_components
/.idea/
/.codekit-cache/
/config.codekit
/node_modules
33 changes: 33 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
module.exports = function(grunt) {

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
js: {
files : {
'dist/angular-bandsintown-api-factory.min.js' : ['src/angular-bandsintown-api-factory.js']
}
},
options: {
banner: '\n/*! <%= pkg.name %> v<%= pkg.version %> (<%= grunt.template.today("dd-mm-yyyy") %>) by <%= pkg.author %> */\n',
}
},
watch: {
minifiyJs: {
files: [
'src/angular-bandsintown-api-factory.js'
],
tasks: ['uglify'],
options: {
spawn: true,
},
},
},
});

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

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

};
96 changes: 94 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,94 @@
# angular-bandsintown-api-factory
AngularJS factory for Bandsintown JSON REST API requests
**angular-bandsintown-api-factory** is an angularjs module with a bandsintown v2 api factory.

Author: Jonathan Hornung ([JohnnyTheTank](https://github.com/JohnnyTheTank))

## Usage
1. Install via [bower](http://bower.io/) :
1. `bower install --save angular-bandsintown-api-factory`
2. Add `jtt_bandsintown` 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-bandsintown-api-factory/src/angular-bandsintown-api-factory.js"></script>
```

4. Use the factory `bandsintownFactory`


### factory methods

#### getArtist
Get all parameters [here](http://bandsintown.com/api/requests#artists-get)
```js
// all parameters: http://bandsintown.com/api/requests#artists-get
bandsintownFactory.getArtist({
artist:"<ARTIST_NAME>", // ? and / characters must be double escaped. Artists such as "AC/DC" will end up as "AC%252FDC"
artist_id:"<ARTIST_ID>", // (optional) fallback: mbid_<id> (MusicBrainz ID), fbid_<id> (Facebook Page ID)
app_id:"<YOUR_APP_ID>", //The application ID can be anything, but should be a word that describes your application or company.
}).success(function (_data) {
//on success
}).error(function (_data) {
//on error
});
```

#### getEvents
Get all parameters [here](http://bandsintown.com/api/requests#artists-events)
```js
// all parameters: http://bandsintown.com/api/requests#artists-events
bandsintownFactory.getEventsFromArtist({
artist:"<ARTIST_NAME>", // ? and / characters must be double escaped. Artists such as "AC/DC" will end up as "AC%252FDC"
artist_id:"<ARTIST_ID>", // (optional) fallback: mbid_<id> (MusicBrainz ID), fbid_<id> (Facebook Page ID)
date:"<DATE>", // (optional) (default: upcoming) yyyy-mm-dd || yyyy-mm-dd,yyyy-mm-dd (inclusive range) || upcoming || all
app_id:"<YOUR_APP_ID>", //The application ID can be anything, but should be a word that describes your application or company.
}).success(function (_data) {
//on success
}).error(function (_data) {
//on error
});
```

Get all parameters [here](http://bandsintown.com/api/requests#artists-event-search)
```js
// all parameters: http://bandsintown.com/api/requests#artists-event-search
bandsintownFactory.getEventsFromArtistByLocation({
artist:"<ARTIST_NAME>", // ? and / characters must be double escaped. Artists such as "AC/DC" will end up as "AC%252FDC"
artist_id:"<ARTIST_ID>", // (optional) fallback: mbid_<id> (MusicBrainz ID), fbid_<id> (Facebook Page ID)
date:"<DATE>", // (optional) (default: upcoming) yyyy-mm-dd || yyyy-mm-dd,yyyy-mm-dd (inclusive range) || upcoming || all
location:"<LOCATION>", // city,state (US or CA) || city,country || lat,lon || ip address
radius:"<RADIUS">, // (optional) (default: 25) in miles. valid values: 0-150
app_id:"<YOUR_APP_ID>", //The application ID can be anything, but should be a word that describes your application or company.
}).success(function (_data) {
//on success
}).error(function (_data) {
//on error
});
```

Get all parameters [here](http://bandsintown.com/api/requests#artists-recommended-events)
```js
// all parameters: http://bandsintown.com/api/requests#artists-recommended-events
bandsintownFactory.getRecommendedEventsFromArtistByLocation({
artist:"<ARTIST_NAME>", // ? and / characters must be double escaped. Artists such as "AC/DC" will end up as "AC%252FDC"
artist_id:"<ARTIST_ID>", // (optional) fallback: mbid_<id> (MusicBrainz ID), fbid_<id> (Facebook Page ID)
date:"<DATE>", // (optional) (default: upcoming) yyyy-mm-dd || yyyy-mm-dd,yyyy-mm-dd (inclusive range) || upcoming || all
location:"<LOCATION>", // city,state (US or CA) || city,country || lat,lon || ip address
radius:"<RADIUS">, // (optional) (default: 25) in miles. valid values: 0-150
only_recs:"<ONLY_RECS>", // (optional) (default: false) if true, the response will only include matching events for artists similar to the specified artist. if false, the response may also include matching events for the specified artist.
app_id:"<YOUR_APP_ID>", //The application ID can be anything, but should be a word that describes your application or company.
}).success(function (_data) {
//on success
}).error(function (_data) {
//on error
});
```

## Bandsintown V2 JSON API
Docs: http://bandsintown.com/api/requests


## License

MIT
31 changes: 31 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "angular-bandsintown-api-factory",
"description": "angularjs factory for bandsintown json rest api requests",
"version": "0.1.0",
"main": "Gruntfile.js",
"authors": [
"Jonathan Hornung"
],
"license": "MIT",
"keywords": [
"angularjs",
"angular",
"bandsintown",
"api",
"factory"
],
"homepage": "https://github.com/JohnnyTheTank/angular-bandsintown-api-factory",
"moduleType": [
"globals"
],
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"angular": "*"
}
}
18 changes: 18 additions & 0 deletions demo/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!doctype html>
<html lang="de">
<head>
<meta charset="UTF-8">
<title>angular-bandsintown-api-factory</title>

<script src="../bower_components/angular/angular.min.js"></script>
<script src="js/app.js"></script>
<script src="../src/angular-bandsintown-api-factory.js"></script>

</head>
<body ng-app="app">
<div ng-controller="controller">
Look in your console
</div>

</body>
</html>
39 changes: 39 additions & 0 deletions demo/js/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
var app = angular.module("app", ['jtt_bandsintown']);
app.controller('controller', ['$scope', 'bandsintownFactory', function($scope, bandsintownFactory) {

var _app_id = 'angular-bandsintown-api-factory-sample';

bandsintownFactory.getArtist({
artist:"Prinz Pi",
app_id:_app_id,
}).success(function(_data){
console.log("artist", _data);
});

bandsintownFactory.getEventsFromArtist({
artist:"Prinz Pi",
app_id:_app_id,
}).success(function(_data){
console.log("events from artist", _data);
});

bandsintownFactory.getEventsFromArtistByLocation({
artist:"Prinz Pi",
location:'munich, germany',
date:'all',
app_id:_app_id,
}).success(function(_data){
console.log("events from artist by location", _data);
});

bandsintownFactory.getRecommendedEventsFromArtistByLocation({
artist:"Prinz Pi",
location:'munich, germany',
date:'all',
only_recs: true,
app_id:_app_id,
}).success(function(_data){
console.log("recommended events from artist by location", _data);
});

}]);
3 changes: 3 additions & 0 deletions dist/angular-bandsintown-api-factory.min.js

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

31 changes: 31 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "angular-bandsintown-api-factory",
"version": "0.1.0",
"description": "angularjs factory for bandsintown json rest api requests",
"main": "Gruntfile.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/JohnnyTheTank/angular-bandsintown-api-factory.git"
},
"keywords": [
"angularjs",
"angular",
"bandsintown",
"api",
"factory"
],
"author": "Jonathan Hornung",
"license": "MIT",
"bugs": {
"url": "https://github.com/JohnnyTheTank/angular-bandsintown-api-factory/issues"
},
"homepage": "https://github.com/JohnnyTheTank/angular-bandsintown-api-factory#readme",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-uglify": "^0.11.0",
"grunt-contrib-watch": "^0.6.1"
}
}
Loading

0 comments on commit 490346d

Please sign in to comment.