Comparing version 2.0.0-beta1 to 2.0.0
{ | ||
"name": "jribbble", | ||
"version": "2.0.0-beta1", | ||
"version": "2.0.0", | ||
"homepage": "http://jribbble.com", | ||
@@ -22,4 +22,4 @@ "authors": [ | ||
"bower_components", | ||
"test", | ||
"tests" | ||
"tests", | ||
".travis.yml" | ||
], | ||
@@ -26,0 +26,0 @@ "dependencies": { |
@@ -1,3 +0,3 @@ | ||
Copyright (c) 2011, Tyler Gaw me@tylergaw.com | ||
Copyright (c) 2015, Tyler Gaw me@tylergaw.com | ||
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
{ | ||
"name": "jribbble", | ||
"version": "2.0.0-beta1", | ||
"version": "2.0.0", | ||
"description": "A jQuery plugin for the Dribbble API", | ||
"main": "index.js", | ||
"directories": { | ||
"example": "examples" | ||
}, | ||
"scripts": { | ||
"test": "node-qunit-phantomjs tests/index.html --verbose" | ||
}, | ||
"main": "dist/jribbble.js", | ||
"repository": { | ||
@@ -13,0 +7,0 @@ "type": "git", |
628
README.md
# Jribbble [](https://travis-ci.org/tylergaw/jribbble) | ||
A jQuery plugin to fetch shot and player info from the [Dribbble API](http://dribbble.com/api) | ||
A jQuery plugin to retrieve info from the [Dribbble API](http://developer.dribbble.com/v1/) | ||
Live demos available at [http://lab.tylergaw.com/jribbble](http://lab.tylergaw.com/jribbble) | ||
Live demos available on [Codepen.io](http://codepen.io/collection/nWvjrg/) | ||
## Dependencies | ||
* For normal usage; jQuery 1.3 or higher | ||
* For building your own Uglified version; [UglifyJS](https://github.com/mishoo/UglifyJS) | ||
* If you're interested, there's also a dependency-free version of Jribbble: [https://github.com/tylergaw/jribbble-no-dependencies](https://github.com/tylergaw/jribbble-no-dependencies) | ||
* jQuery 1.8+ | ||
## Testing [WIP] | ||
## Getting Jribbble | ||
with Bower | ||
``` | ||
npm install && npm install -g node-qunit-phantomjs | ||
bower install --save jribbble | ||
``` | ||
or direct download: | ||
- [jribbble.min.js](https://github.com/tylergaw/jribbble/blob/master/dist/jribbble.min.js) | ||
- [jribbble.js](https://github.com/tylergaw/jribbble/blob/master/dist/jribbble.js) | ||
## Using Jribbble | ||
Jribbble covers all non-authenticated methods of the [Dribbble API](http://developer.dribbble.com/v1/). All available methods are accessed from the `jribbble` object which is a member of the `jQuery` or `$` object. | ||
*Note:* If you need access to Dribbble methods using `POST` or `PUT` you will need | ||
to access the API using OAuth. Jribbble only supports unauthenticated `GET` methods. | ||
```html | ||
<body> | ||
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script> | ||
<script src="jribbble.min.js"></script> | ||
<script> | ||
function success(apiResponse) { | ||
// do cool stuff with apiResponse | ||
}; | ||
function error(jqxhr) { | ||
// Handle errors | ||
}; | ||
// To use Jribbble you will need to register an application at: | ||
// https://dribbble.com/account/applications/new | ||
// Before calling any methods of jribbble you must set your | ||
// dribbble client access token | ||
$.jribbble.setToken('<your_dribbble_client_access_token>'); | ||
// Jribbble methods return a promise | ||
$.jribbble.shots().then(success, error); | ||
</script> | ||
</body> | ||
``` | ||
npm test | ||
## Setting your app's client access token | ||
Before you can use any of Jribbble's methods, you must set your Dribbble app's client access token. | ||
If you do not have a token, create a new app at [https://dribbble.com/account/applications/new](https://dribbble.com/account/applications/new) | ||
#### `$.jribbble.setToken(token)` | ||
**Description:** Sets the required Dribbble application client access token. | ||
**Parameters:** | ||
- token - *required* `String or Int` Your Dribbble App client access token | ||
**Example usage:** | ||
```javascript | ||
$.jribbble.setToken('123456789'); | ||
``` | ||
## Building | ||
Jribbble uses a Makefile that is pretty much jQuery's Makefile. The Makefile adds the version number and | ||
date to the output files then creates the Ugly version of Jribbble using [UglifyJS](https://github.com/mishoo/UglifyJS) | ||
## Available methods | ||
NodeJS is required to build an Ugly version of Jribbble. | ||
#### Shots | ||
- [$.jribbble.shots](#jribbbleshotsid-options) | ||
- [$.jribbble.shots.attachments](#jribbbleshotsshotidattachmentsattachmentid-options) | ||
- [$.jribbble.shots.buckets](#jribbbleshotsshotidbucketsoptions) | ||
- [$.jribbble.shots.comments](#jribbbleshotsshotidcommentscommentid-options) | ||
- [$.jribbble.shots.comments.likes](#jribbbleshotsshotidcommentscommentidlikesoptions) | ||
- [$.jribbble.shots.likes](#jribbbleshotsshotidlikesoptions) | ||
- [$.jribbble.shots.projects](#jribbbleshotsshotidprojectsoptions) | ||
- [$.jribbble.shots.rebounds](#jribbbleshotsshotidreboundsoptions) | ||
To build navigate to the Jribbble directory and run the `make` command | ||
#### Users | ||
## Usage | ||
Jribbble makes available methods for retrieving shot and player information from the Dribbble.com API. All the available methods are accessed from the `jribbble` object which is a member of the `jQuery` or `$` object. | ||
- [$.jribbble.users](#jribbbleusersuserid) | ||
- [$.jribbble.users.buckets](#jribbbleusersuseridbucketsoptions) | ||
- [$.jribbble.users.followers](#jribbbleusersuseridfollowersoptions) | ||
- [$.jribbble.users.following](#jribbbleusersuseridfollowingoptions) | ||
- [$.jribbble.users.isFollowing](#jribbbleusersuseridisfollowingtargetuserid) | ||
### Tutorials | ||
A number of nice folks have taken the time to write articles explaining how to get started using Jribbble. If you've written one or know of any that should be listed, add it here and submit a pull request. | ||
- [How to use the Dribbble API by Sara Vieira](http://www.developerdrive.com/2014/09/how-to-use-the-dribbble-api/) | ||
- [Build a Dribbble Portfolio Grid with Flexboxgrid and Jribbble by Jonathan Cutrell](http://webdesign.tutsplus.com/tutorials/build-a-dribbble-portfolio-grid-with-flexboxgrid-and-jribbble--cms-20423) | ||
- [Create a Portfolio Powered by Dribbble by Chris Collins](http://theultralinx.com/2013/09/create-portfolio-powered-dribbble.html) | ||
#### Teams | ||
### Get a shot `$.jribbble.getShotById(shotId, callback)` | ||
#### Parameters | ||
- `shotId` INT The id of the shot | ||
- `callback` FUNC Function to call once the request has completed successfully. One parameter will be passed containing the JSON response of the request; callback(data). | ||
- [$.jribbble.teams.members](#jribbbleteamsteamidmembersoptions) | ||
- [$.jribbble.teams.shots](#jribbbleteamsteamidshotsoptions) | ||
#### Example | ||
$.jribbble.getShotById(196071, function (shot) { | ||
var html = []; | ||
#### Buckets | ||
$('#shotById a:first').attr('href', shot.url); | ||
$('#shotById img').attr('src', shot.image_url); | ||
$('#shotById h3').text(shot.title); | ||
$('#shotById h4').html('by <a href="' + shot.player.url + '">' + shot.player.name + '</a>'); | ||
- [$.jribbble.buckets](#jribbblebucketsbucketid) | ||
- [$.jribbble.buckets.shots](#jribbblebucketsbucketidshotsoptions) | ||
html.push('<li><b>Views:</b> ' + shot.views_count + '</li>'); | ||
html.push('<li><b>Likes:</b> ' + shot.likes_count + '</li>'); | ||
html.push('<li><b>Comments:</b> ' + shot.comments_count + '</li>'); | ||
html.push('<li><b>Rebounds:</b> ' + shot.rebounds_count + '</li>'); | ||
#### Projects | ||
$('#shotById ul').html(html.join('')); | ||
}); | ||
- [$.jribbble.projects](#jribbbleprojectsprojectid) | ||
- [$.jribbble.projects.shots](#jribbbleprojectsprojectidshotsoptions) | ||
### Get the comments of a shot `$.jribbble.getCommentsOfShot(shotId, callback, [pagingOpts])` | ||
#### Parameters | ||
* `shotId` INT The id of the shot | ||
* `callback` FUNC Function to call once the request has completed successfully. One parameter will be passed containing the JSON response of the request; callback(data). | ||
* `pagingOpts OBJ OPTIONAL` An object that may contain 1 or 2 members; `page`, `per_page`. Example: `{page: 1, per_page: 15}` | ||
### Shots | ||
#### Example | ||
$.jribbble.getCommentsOfShot(51986, function (response) { | ||
var html = []; | ||
#### `$.jribbble.shots(id, options)` | ||
$.each(response.comments, function (i, comment) { | ||
html.push('<li>'); | ||
html.push('<a href="' + comment.player.url + '">'); | ||
html.push('<img src="' + comment.player.avatar_url + '" alt=""></a>'); | ||
html.push('<h5>' + comment.player.name + '</h5>'); | ||
html.push('<p>' + comment.body + '</p>'); | ||
html.push('</li>'); | ||
}); | ||
**Description:** Gets a list of shots. | ||
$('#shotCommentsList').html(html.join('')); | ||
}, {page: 1, per_page: 5}); | ||
**Parameters:** | ||
- id - *optional* `String or Int` A shot id or a shot list name. See [API Docs](http://developer.dribbble.com/v1/shots/#list-shots) for list names. | ||
- options - *optional* `Object` Key:value pairs of options that will be included in the request as query parameters. See [API Docs](http://developer.dribbble.com/v1/shots/#list-shots) for a full list. | ||
### Get the rebbbounds of a shot `$.jribbble.getReboundsOfShot(shotId, callback, [pagingOpts])` | ||
#### Parameters | ||
* `shotId` INT The id of the shot | ||
* `callback` FUNC Function to call once the request has completed successfully. One parameter will be passed containing the JSON response of the request; callback(data). | ||
* `pagingOpts OBJ OPTIONAL` An object that may contain 1 or 2 members; `page`, `per_page`. Example: `{page: 1, per_page: 15}` | ||
**Example usage:** | ||
```javascript | ||
// Get a single shot | ||
$.jribbble.shots(2055068).then(function(res) { | ||
// Do cool stuff with response | ||
}); | ||
``` | ||
Live example [on Codepen.io](http://codepen.io/tylergaw/pen/KpMmjZ?editors=101). | ||
#### Example | ||
$.jribbble.getReboundsOfShot(10745, function (rebounds) { | ||
var html = []; | ||
```javascript | ||
// Get the second page of debut shots from the past month sorted by number of | ||
// views at 35 per page. | ||
$.jribbble.shots('debuts', { | ||
'sort': 'views', | ||
'timeframe': 'month', | ||
'per_page': 35 | ||
}).then(function(res) { | ||
// Do cool stuff with response | ||
}); | ||
``` | ||
$.each(rebounds.shots, function (i, shot) { | ||
html.push('<li><h3>' + shot.title + '</h3>'); | ||
html.push('<h4>by ' + shot.player.name + '</h4><a href="' + shot.url + '">'); | ||
html.push('<img src="' + shot.image_teaser_url + '" '); | ||
html.push('alt="' + shot.title + '"></a></li>'); | ||
}); | ||
Live example [on Codepen.io](http://codepen.io/tylergaw/pen/RPRVew/?editors=101). | ||
$('#reboundsOfShot').html(html.join('')); | ||
}, {page: 1, per_page: 10}); | ||
#### `$.jribbble.shots(shotId).attachments(attachmentId, options)` | ||
### Get a list of shots by the list name `$.jribbble.getShotsByList(listName, callback, [pagingOpts])` | ||
#### Parameters | ||
* `listName` STRING Can be one of: "popular", "everyone", "debuts" | ||
* `callback` FUNC Function to call once the request has completed successfully. One parameter will be passed containing the JSON response of the request; callback(data). | ||
* `pagingOpts OBJ OPTIONAL` An object that may contain 1 or 2 members; `page`, `per_page`. Example: `{page: 1, per_page: 15}` | ||
**Description:** Gets the attachments or single attachment for a shot. | ||
#### Example | ||
$.jribbble.getShotsByList('popular', function (listDetails) { | ||
var html = []; | ||
**Parameters:** | ||
- shotId - *required* `String or Int` | ||
- attachmentId - *optional* `String or Int` Only required if you want a single attachment. `options` are not rejected, but will have no effect when `attachmentId` is used. | ||
- options - *optional* `Object` Key:value pairs of options that will be included in the request as query parameters. Attachments only support paging options. `per_page` and `page`. | ||
$.each(listDetails.shots, function (i, shot) { | ||
html.push('<li><h3>' + shot.title + '</h3>'); | ||
html.push('<h4>by ' + shot.player.name + '</h4><a href="' + shot.url + '">'); | ||
html.push('<img src="' + shot.image_teaser_url + '" '); | ||
html.push('alt="' + shot.title + '"></a></li>'); | ||
}); | ||
**Example usage:** | ||
```javascript | ||
// Get all attachments for a shot | ||
$.jribbble.shots(2066347).attachments().then(function(res) { | ||
// Do cool stuff with response | ||
}); | ||
``` | ||
Live example [on Codepen.io](http://codepen.io/tylergaw/pen/XbKgJy/?editors=101). | ||
$('#shotsByList').html(html.join('')); | ||
}, {page: 2, per_page: 10}); | ||
```javascript | ||
// Get a single attachment for a shot | ||
$.jribbble.shots(2066347).attachments(370029).then(function(res) { | ||
// Do cool stuff with response | ||
}); | ||
``` | ||
### Get a list of a player's shots `$.jribbble.getShotsByPlayerId(playerId, callback, [pagingOpts])` | ||
#### Parameters | ||
* `playerId` STRING or INT Can be a player's integer id or username | ||
* `callback` FUNC Function to call once the request has completed successfully. One parameter will be passed containing the JSON response of the request; callback(data). | ||
* `pagingOpts OBJ OPTIONAL` An object that may contain 1 or 2 members; `page`, `per_page`. Example: `{page: 1, per_page: 15}` | ||
Live example [on Codepen.io](http://codepen.io/tylergaw/pen/ZGOyGM/?editors=101). | ||
#### Example | ||
$.jribbble.getShotsByPlayerId('tylergaw', function (playerShots) { | ||
var html = []; | ||
#### `$.jribbble.shots(shotId).buckets(options)` | ||
$.each(playerShots.shots, function (i, shot) { | ||
html.push('<li><h3>' + shot.title + '</h3>'); | ||
html.push('<h4>by ' + shot.player.name + '</h4><a href="' + shot.url + '">'); | ||
html.push('<img src="' + shot.image_teaser_url + '" '); | ||
html.push('alt="' + shot.title + '"></a></li>'); | ||
}); | ||
**Description:** Gets the buckets for a shot. | ||
$('#shotsByPlayerId').html(html.join('')); | ||
}, {page: 1, per_page: 10}); | ||
**Parameters:** | ||
- shotId - *required* `String or Int` | ||
- options - *optional* `Object` Key:value pairs of options that will be included in the request as query parameters. Buckets only support paging options. `per_page` and `page`. | ||
### Get a list of shots a player is following `$.jribbble.getShotsThatPlayerFollows(playerId, callback, [pagingOpts])` | ||
#### Parameters | ||
* `playerId` STRING or INT Can be a player's integer id or username | ||
* `callback` FUNC Function to call once the request has completed successfully. One parameter will be passed containing the JSON response of the request; callback(data). | ||
* `pagingOpts OBJ OPTIONAL` An object that may contain 1 or 2 members; `page`, `per_page`. Example: `{page: 1, per_page: 15}` | ||
**Example usage:** | ||
```javascript | ||
// Get all buckets for a shot at 36 per page | ||
$.jribbble.shots(2067006).buckets({'per_page': 36}).then(function(res) { | ||
// Do cool stuff with response | ||
}); | ||
``` | ||
#### Example | ||
$.jribbble.getShotsThatPlayerFollows('tylergaw', function (followedShots) { | ||
var html = []; | ||
Live example [on Codepen.io](http://codepen.io/tylergaw/pen/ZGOayV/?editors=101). | ||
$.each(followedShots.shots, function (i, shot) { | ||
html.push('<li><h3>' + shot.title + '</h3>'); | ||
html.push('<h4>by ' + shot.player.name + '</h4><a href="' + shot.url + '">'); | ||
html.push('<img src="' + shot.image_teaser_url + '" '); | ||
html.push('alt="' + shot.title + '"></a></li>'); | ||
}); | ||
#### `$.jribbble.shots(shotId).comments(commentId, options)` | ||
$('#shotsPlayerFollows').html(html.join('')); | ||
}, {page: 3, per_page: 10}); | ||
**Description:** Gets the comments or single comment for a shot. | ||
### Get the profile details of a player `$.jribbble.getPlayerById(playerId, callback)` | ||
#### Parameters | ||
* `playerId` STRING or INT Can be a player's integer id or username | ||
* `callback` FUNC Function to call once the request has completed successfully. One parameter will be passed containing the JSON response of the request; callback(data). | ||
**Parameters:** | ||
- shotId - *required* `String or Int` | ||
- commentId - *optional* `String or Int` Only required if you want a single comment. `options` are not rejected, but will have no effect when `commentId` is used. | ||
- options - *optional* `Object` Key:value pairs of options that will be included in the request as query parameters. Comments only support paging options. `per_page` and `page`. | ||
#### Example | ||
$.jribbble.getPlayerById('tylergaw', function (player) { | ||
var html = []; | ||
**Example usage:** | ||
```javascript | ||
// Get all comments for a shot | ||
$.jribbble.shots(2067969).comments().then(function(res) { | ||
// Do cool stuff with response | ||
}); | ||
``` | ||
html.push('<a href="' + player.url + '"><img src="' + player.avatar_url + '" alt=""></a>'); | ||
html.push('<div><h3>' + player.name + ' / ' + player.location + '</h3>'); | ||
html.push('<h4><a href="' + player.url + '">' + player.url + '</a></h4>'); | ||
html.push('<ul><li><b>Shots: </b>' + player.shots_count + '</li>'); | ||
html.push('<li><b>Following: </b>' + player.following_count + '</li>'); | ||
html.push('<li><b>Followers: </b>' + player.followers_count + '</li>'); | ||
html.push('<li><b>Draftees: </b>' + player.draftees_count + '</li></ul></div>'); | ||
Live example [on Codepen.io](http://codepen.io/tylergaw/pen/LVZrBq/?editors=101). | ||
$('#playerProfile').html(html.join('')); | ||
}); | ||
```javascript | ||
// Get a single comment for a shot | ||
$.jribbble.shots(2067969).comments(4448286).then(function(res) { | ||
// Do cool stuff with response | ||
}); | ||
``` | ||
### Get the followers of a player `$.jribbble.getPlayerFollowers(playerId, callback, [pagingOpts])` | ||
#### Parameters | ||
* `playerId` STRING or INT Can be a player's integer id or username | ||
* `callback` FUNC Function to call once the request has completed successfully. One parameter will be passed containing the JSON response of the request; callback(data). | ||
* `pagingOpts OBJ OPTIONAL` An object that may contain 1 or 2 members; `page`, `per_page`. Example: `{page: 1, per_page: 15}` | ||
Live example [on Codepen.io](http://codepen.io/tylergaw/pen/yNJERz/?editors=101). | ||
#### Example | ||
$.jribbble.getPlayerFollowers('robertjpetro', function (followers) { | ||
var html = []; | ||
#### `$.jribbble.shots(shotId).comments(commentId).likes(options)` | ||
$.each(followers.players, function (i, player) { | ||
html.push('<li><h3>' + player.name + '</h3>'); | ||
html.push('<a href="' + player.url + '">'); | ||
html.push('<img src="' + player.avatar_url + '" '); | ||
html.push('alt=""></a></li>'); | ||
}); | ||
**Description:** Gets the likes for a comment. | ||
$('#playerFollowers').html(html.join('')); | ||
}, {per_page: 12}); | ||
**Parameters:** | ||
- shotId - *required* `String or Int` | ||
- commentId - *required* `String or Int` The id of the comment | ||
- options - *optional* `Object` Key:value pairs of options that will be included in the request as query parameters. Likes only support paging options. `per_page` and `page`. | ||
### Get the players a player is following `$.jribbble.getPlayerFollowing(playerId, callback, [pagingOpts])` | ||
#### Parameters | ||
* `playerId` STRING or INT Can be a player's integer id or username | ||
* `callback` FUNC Function to call once the request has completed successfully. One parameter will be passed containing the JSON response of the request; callback(data). | ||
* `pagingOpts OBJ OPTIONAL` An object that may contain 1 or 2 members; `page`, `per_page`. Example: `{page: 1, per_page: 15}` | ||
**Example usage:** | ||
```javascript | ||
// Get the likes for a comment. | ||
$.jribbble.shots(2069352).comments(4450321).likes().then(function(res) { | ||
// Do cool stuff with response | ||
}); | ||
``` | ||
#### Example | ||
$.jribbble.getPlayerFollowing('tylergaw', function (following) { | ||
var html = []; | ||
Live example [on Codepen.io](http://codepen.io/tylergaw/pen/LVZwQL/?editors=101). | ||
$.each(following.players, function (i, player) { | ||
html.push('<li><h3>' + player.name + '</h3>'); | ||
html.push('<a href="' + player.url + '">'); | ||
html.push('<img src="' + player.avatar_url + '" '); | ||
html.push('alt=""></a></li>'); | ||
}); | ||
#### `$.jribbble.shots(shotId).likes(options)` | ||
$('#playerFollowing').html(html.join('')); | ||
}, {per_page: 12}); | ||
**Description:** Gets the likes for a shot. | ||
### Get a list of shots a player likes `$.jribbble.getShotsThatPlayerLikes(playerId, callback, [pagingOpts])` | ||
#### Parameters | ||
* `playerId` STRING or INT Can be a player's integer id or username | ||
* `callback` FUNC Function to call once the request has completed successfully. One parameter will be passed containing the JSON response of the request; callback(data). | ||
* `pagingOpts OBJ OPTIONAL` An object that may contain 1 or 2 members; `page`, `per_page`. Example: `{page: 1, per_page: 15}` | ||
**Parameters:** | ||
- shotId - *required* `String or Int` | ||
- options - *optional* `Object` Key:value pairs of options that will be included in the request as query parameters. Likes only support paging options. `per_page` and `page`. | ||
#### Example | ||
$.jribbble.getShotsThatPlayerLikes('acreek', function (playerLikes) { | ||
var html = []; | ||
**Example usage:** | ||
```javascript | ||
// Get the likes for a shot. | ||
$.jribbble.shots(2058881).likes().then(function(res) { | ||
// Do cool stuff with response | ||
}); | ||
``` | ||
$.each(playerLikes.shots, function (i, shot) { | ||
html.push('<li><h3>' + shot.title + '</h3>'); | ||
html.push('<h4>by ' + shot.player.name + '</h4><a href="' + shot.url + '">'); | ||
html.push('<img src="' + shot.image_teaser_url + '" '); | ||
html.push('alt="' + shot.title + '"></a></li>'); | ||
}); | ||
Live example [on Codepen.io](http://codepen.io/tylergaw/pen/jPVVZb/?editors=101). | ||
$('#shotsPlayerLikes').html(html.join('')); | ||
}, {page: 1, per_page: 10}); | ||
#### `$.jribbble.shots(shotId).projects(options)` | ||
**Description:** Gets the projects for a shot. | ||
**Parameters:** | ||
- shotId - *required* `String or Int` | ||
- options - *optional* `Object` Key:value pairs of options that will be included in the request as query parameters. Projects only support paging options. `per_page` and `page`. | ||
**Example usage:** | ||
```javascript | ||
// Get the projects for a shot. | ||
$.jribbble.shots(2077496).projects().then(function(res) { | ||
// Do cool stuff with response | ||
}); | ||
``` | ||
Live example [on Codepen.io](http://codepen.io/tylergaw/pen/qdqqYo/?editors=101). | ||
#### `$.jribbble.shots(shotId).rebounds(options)` | ||
**Description:** Gets the rebounds for a shot. | ||
**Parameters:** | ||
- shotId - *required* `String or Int` | ||
- options - *optional* `Object` Key:value pairs of options that will be included in the request as query parameters. Rebounds only support paging options. `per_page` and `page`. | ||
**Example usage:** | ||
```javascript | ||
// Get the rebounds for a shot. | ||
$.jribbble.shots(2046896).rebounds().then(function(res) { | ||
// Do cool stuff with response | ||
}); | ||
``` | ||
Live example [on Codepen.io](http://codepen.io/tylergaw/pen/XbNpqx/?editors=101). | ||
### Users | ||
#### `$.jribbble.users(userId)` | ||
**Description:** Gets a single user | ||
**Parameters:** | ||
- userId - *required* `String or Int` The username or id for the user. | ||
**Example usage:** | ||
```javascript | ||
$.jribbble.users('tylergaw').then(function(res) { | ||
// Do cool stuff with response | ||
}); | ||
``` | ||
Live example [on Codepen.io](http://codepen.io/tylergaw/pen/bdBrYK/?editors=101). | ||
#### `$.jribbble.users(userId).buckets(options)` | ||
**Description:** Gets a user's buckets | ||
**Parameters:** | ||
- userId - *required* `String or Int` The username or id for the user. | ||
- options - *optional* `Object` Key:value pairs of options that will be included in the request as query parameters. Buckets only support paging options. `per_page` and `page`. | ||
**Example usage:** | ||
```javascript | ||
$.jribbble.users('tylergaw').buckets().then(function(res) { | ||
// Do cool stuff with response | ||
}); | ||
``` | ||
Live example [on Codepen.io](http://codepen.io/tylergaw/pen/bdBrXz/?editors=101). | ||
#### `$.jribbble.users(userId).followers(options)` | ||
**Description:** Gets a user's followers | ||
**Parameters:** | ||
- userId - *required* `String or Int` The username or id for the user. | ||
- options - *optional* `Object` Key:value pairs of options that will be included in the request as query parameters. Followers only support paging options. `per_page` and `page`. | ||
**Example usage:** | ||
```javascript | ||
$.jribbble.users('tylergaw').followers().then(function(res) { | ||
// Do cool stuff with response | ||
}); | ||
``` | ||
Live example [on Codepen.io](http://codepen.io/tylergaw/pen/ZGBJdY/?editors=101). | ||
#### `$.jribbble.users(userId).following(options)` | ||
**Description:** Gets the users a user is following | ||
**Parameters:** | ||
- userId - *required* `String or Int` The username or id for the user. | ||
- options - *optional* `Object` Key:value pairs of options that will be included in the request as query parameters. Following only support paging options. `per_page` and `page`. | ||
**Example usage:** | ||
```javascript | ||
$.jribbble.users('tylergaw').following().then(function(res) { | ||
// Do cool stuff with response | ||
}); | ||
``` | ||
Live example [on Codepen.io](http://codepen.io/tylergaw/pen/jPVLdR/?editors=101). | ||
#### `$.jribbble.users(userId).isFollowing(targetUserId)` | ||
**Description:** Check to see if a user is following another user. | ||
**Parameters:** | ||
- userId - *required* `String or Int` The username or id for the user. | ||
- targetUserId - *required* `String or Int` The username or id for the other user. | ||
**Example usage:** | ||
```javascript | ||
$.jribbble.users('tylergaw').isFollowing('jimniels').then(function(res) { | ||
// Do cool stuff with response | ||
}); | ||
``` | ||
Live example [on Codepen.io](http://codepen.io/tylergaw/pen/bdBrjx/?editors=101). | ||
### Teams | ||
#### `$.jribbble.teams(teamId).members(options)` | ||
**Description:** Gets the members of a team. | ||
**Parameters:** | ||
- teamId - *required* `String` | ||
- options - *optional* `Object` Key:value pairs of options that will be included in the request as query parameters. Teams only support paging options. `per_page` and `page`. | ||
**Example usage:** | ||
```javascript | ||
$.jribbble.teams('eight2eight').members(options).then(function(res) { | ||
// Do cool stuff with response | ||
}); | ||
``` | ||
Live example [on Codepen.io](http://codepen.io/tylergaw/pen/bdBrgv/?editors=101). | ||
#### `$.jribbble.teams(teamId).shots(options)` | ||
**Description:** Gets the shots for a team. | ||
**Parameters:** | ||
- teamId - *required* `String` | ||
- options - *optional* `Object` Key:value pairs of options that will be included in the request as query parameters. Shots only support paging options. `per_page` and `page`. | ||
**Example usage:** | ||
```javascript | ||
$.jribbble.teams('eight2eight').shots(options).then(function(res) { | ||
// Do cool stuff with response | ||
}); | ||
``` | ||
Live example [on Codepen.io](http://codepen.io/tylergaw/pen/bdBrWM/?editors=101). | ||
### Buckets | ||
#### `$.jribbble.buckets(bucketId)` | ||
**Description:** Gets a single bucket | ||
**Parameters:** | ||
- bucketId - *required* `String or Int` | ||
**Example usage:** | ||
```javascript | ||
$.jribbble.buckets(114550).then(function(res) { | ||
// Do cool stuff with response | ||
}); | ||
``` | ||
Live example [on Codepen.io](http://codepen.io/tylergaw/pen/mJORor/?editors=101). | ||
#### `$.jribbble.buckets(bucketId).shots(options)` | ||
**Description:** Gets the shots for a project | ||
**Parameters:** | ||
- bucketId - *required* `String or Int` | ||
- options - *optional* `Object` Key:value pairs of options that will be included in the request as query parameters. Shots only support paging options. `per_page` and `page`. | ||
**Example usage:** | ||
```javascript | ||
// Get the shots for a bucket. | ||
$.jribbble.buckets(114550).shots(options).then(function(res) { | ||
// Do cool stuff with response | ||
}); | ||
``` | ||
Live example [on Codepen.io](http://codepen.io/tylergaw/pen/ZGBLPq/?editors=101). | ||
### Projects | ||
#### `$.jribbble.projects(projectId)` | ||
**Description:** Gets a single project | ||
**Parameters:** | ||
- projectId - *required* `String or Int` | ||
**Example usage:** | ||
```javascript | ||
$.jribbble.projects(267945).then(function(res) { | ||
// Do cool stuff with response | ||
}); | ||
``` | ||
Live example [on Codepen.io](http://codepen.io/tylergaw/pen/MwbJPB/?editors=101). | ||
#### `$.jribbble.projects(projectId).shots(options)` | ||
**Description:** Gets the shots for a project | ||
**Parameters:** | ||
- projectId - *required* `String or Int` | ||
- options - *optional* `Object` Key:value pairs of options that will be included in the request as query parameters. Shots only support paging options. `per_page` and `page`. | ||
**Example usage:** | ||
```javascript | ||
// Get the shots for a project. | ||
$.jribbble.projects(267945).shots(options).then(function(res) { | ||
// Do cool stuff with response | ||
}); | ||
``` | ||
Live example [on Codepen.io](http://codepen.io/tylergaw/pen/mJORaE/?editors=101). | ||
--------------------------------------------------------------------------- | ||
## Contributing | ||
Jribbble is open source. [Issues](https://github.com/tylergaw/jribbble/issues) and [pull requests](https://github.com/tylergaw/jribbble/pulls) gladly accepted. | ||
### Tests | ||
Jribbble uses Qunit and PhantomJS for tests. If you submit a pull request, you should most likely write a new test or modify an existing test. All tests must pass for a pull request to be accepted. | ||
Installing test dependencies: | ||
``` | ||
npm install && npm install -g node-qunit-phantomjs | ||
``` | ||
running the tests: | ||
``` | ||
make test | ||
``` | ||
The tests will also run when pull requests are submitted. See [Travis](https://travis-ci.org/tylergaw/jribbble) for build status. | ||
### Building Jribbble | ||
Jribbble includes a small Makefile that includes a build task. The task copies the jribbble.js source to the `/dist` directory and creates a minified version of it using UglifyJS2. To build jribbble run: | ||
``` | ||
make | ||
``` | ||
from the root directory |
@@ -0,1 +1,7 @@ | ||
/** | ||
* @preserve | ||
* Jribbble @VERSION | @DATE | ||
* Copyright (c) 2015, Tyler Gaw me@tylergaw.com | ||
* Released under the ISC-LICENSE | ||
*/ | ||
;(function($, window, document, undefined) { | ||
@@ -2,0 +8,0 @@ 'use strict'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1193
0
503
64069
12