Calyhre/dribbble is an unofficial API wrapper ruby gem for Dribbble.com's API.
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.
- Ruby
~> 2.2.5
, usev1.0.4
for previous Ruby versions.
gem 'dribbble'
gem install dribbble
Lets assume you have your token set:
token = 'my_access_token'
Some calls are through a client:
client = Dribbble::Client.new(token)
bucket = Dribbble::Bucket.find(token, '2754')
bucket = Dribbble::Bucket.create(token, name: 'A new bucket', description: 'A description')
bucket.update name: 'An updated bucket name'
bucket.delete
shots = bucket.shots
bucket.add_shot(329335)
# or
bucket.add_shot(shot) # shot is a Dribbble::Shot
bucket.remove_shot(329335)
# or
bucket.remove_shot(shot) # shot is a Dribbble::Shot
project = Dribbble::Project.find(token, 3)
shots = project.shots
shot = Dribbble::Shot.find(token, 1971500)
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)
params = {
title: 'A new shot',
description: 'Shot description',
tags: %w(tag1 tag2),
team_id: 1234
}
shot.update(params)
shot.delete
shot.attachments
shot.create_attachment(file: File.open('attachment_path'))
shot.find_attachment(206165)
shot.delete_attachment(206165)
shot.buckets
shot.comments
comment = shot.create_comment(body: 'A comment')
comment = shot.find_comment(1145736)
comment = shot.update_comment(1145736, body: 'Comment body')
shot.delete_comment(1145736)
comment.likes
comment.like?
comment.like!
comment.unlike!
shot.likes
shot.like?
shot.like!
shot.unlike!
projects = shot.projects
shots = shot.rebounds
Let's assume you have a team:
user = Dribbble::User.find(token, 483195)
team = user.teams.first
users = team.members
shots = team.shots
user = Dribbble::User.find(token, 483195)
user = client.user
user.buckets
buckets = client.buckets
users = user.followers
users = client.followers
users = user.following
shots = client.following_shots
user.following?
user.following?(483195)
user.follow!
user.unfollow!
shots = user.likes
shots = client.likes
projects = user.projects
projects = client.projects
shots = user.shots
shots = client.shots
teams = user.teams
teams = client.teams
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'
Feel free to help me make this gem awesome !
Released under the MIT License. See the LICENSE file for further details.