Simple wrapper for the Dribbble API
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
spec
.gitignore
.travis.yml
CHANGELOG.md
CONTRIBUTING.md
Gemfile
Guardfile
LICENSE.md
README.md
Rakefile
dribbble.gemspec

README.md

Dribbble API wrapper Gem

Gem Version Build Status

Calyhre/dribbble is an unofficial API wrapper ruby gem for Dribbble.com's API.

But, what is Dribbble?

What are you working on? Dribbble is a community of designers answering that question each day. Web designers, graphic designers, illustrators, icon artists, typographers, logo designers, and other creative types share small screenshots (shots) that show their work, process, and current projects.

Installation

Requirements

  • Ruby ~> 2.2.5, use v1.0.4 for previous Ruby versions.

In a Gemfile

gem 'dribbble'

By yourself

gem install dribbble

Usage

Lets assume you have your token set:

token = 'my_access_token'

Some calls are through a client:

client = Dribbble::Client.new(token)

Buckets

Find a bucket
bucket = Dribbble::Bucket.find(token, '2754')
Create a bucket
bucket = Dribbble::Bucket.create(token, name: 'A new bucket', description: 'A description')
Update a bucket
bucket.update name: 'An updated bucket name'
Delete a bucket
bucket.delete

Bucket shots

List bucket shots
shots = bucket.shots
Add shot to a bucket
bucket.add_shot(329335)
# or
bucket.add_shot(shot) # shot is a Dribbble::Shot
Remove shot from a bucket
bucket.remove_shot(329335)
# or
bucket.remove_shot(shot) # shot is a Dribbble::Shot

Projects

Find a Projects
project = Dribbble::Project.find(token, 3)

Project shots

shots = project.shots

Shots

Find a shot
shot = Dribbble::Shot.find(token, 1971500)
Create a shot
params = {
  title: 'A new shot',
  description: 'Shot description',
  image: File.open('/path/to/image.png'),
  tags: %w(tag1 tag2),
  team_id: 1234,
  rebound_source_id: 1234
}
shot = Dribbble::Shot.create(token, params)
Update a shot
params = {
  title: 'A new shot',
  description: 'Shot description',
  tags: %w(tag1 tag2),
  team_id: 1234
}
shot.update(params)
Delete a shot
shot.delete

Shot attachments

List attachments for a shot
shot.attachments
Create an attachment
shot.create_attachment(file: File.open('attachment_path'))
Get a single attachment
shot.find_attachment(206165)
Delete an attachment
shot.delete_attachment(206165)

Shot buckets

List buckets for a shot
shot.buckets

Shot comments

List comments for a shot
shot.comments
Create a comment
comment = shot.create_comment(body: 'A comment')
Get a single comment
comment = shot.find_comment(1145736)
Update a comment
comment = shot.update_comment(1145736, body: 'Comment body')
Delete a comment
shot.delete_comment(1145736)
List likes for a comment
comment.likes
Check if you like a comment
comment.like?
Like a comment
comment.like!
Unlike a comment
comment.unlike!

Shot likes

List the likes for a shot
shot.likes
Check if you like a shot
shot.like?
Like a shot
shot.like!
Unlike a shot
shot.unlike!

Shot projects

List projects for a shot
projects = shot.projects

Shot rebounds

List rebounds for a shot
shots = shot.rebounds

Teams

Let's assume you have a team:

user = Dribbble::User.find(token, 483195)
team = user.teams.first

Team members

List a team’s members
users = team.members

Team shots

List shots for a team
shots = team.shots

Users

Get a single user
user = Dribbble::User.find(token, 483195)
Get the authenticated user
user = client.user

User buckets

List a user’s buckets
user.buckets
List authenticated user’s buckets
buckets = client.buckets

User followers

List followers of a user
users = user.followers
List followers of authenticated user
users = client.followers
List users followed by a user
users = user.following
List shots for users followed by a authenticated user
shots = client.following_shots
Check if you are following a user
user.following?
Check if one user is following another
user.following?(483195)
Follow a user
user.follow!
Unfollow a user
user.unfollow!

User likes

List shot likes for a user
shots = user.likes
List shot likes for authenticated user
shots = client.likes

User projects

List a user’s projects
projects = user.projects
List authenticated user’s projects
projects = client.projects

User shots

List shots for a user
shots = user.shots
List shots for authenticated user
shots = client.shots

User teams

List a user’s teams
teams = user.teams
List authenticated user’s teams
teams = client.teams

Pagination & parameters

All requests are paginated, defaults params are :

Param Default
page 1
per_page 100

You override them or adding some by passing a Hash to every request :

user.shots page: 2, custom_param: 'My param'

Contributing

Feel free to help me make this gem awesome !

Contributors and CONTRIBUTING

Licence

Released under the MIT License. See the LICENSE file for further details.