Project

swish

0.03
Repository is archived
No commit activity in last 3 years
No release in over 3 years
A Ruby wrapper for the Dribbble API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 0.1.8
>= 0.6.1
 Project Readme

Swish! A Ruby wrapper for the Dribbble API¶ ↑

Learn about the Dribbble API at dribbble.com/api.

Installation¶ ↑

Swish is just a Ruby gem:

gem install swish

Not playing in the Ruby league? Here are the others we know of so far:

Examples¶ ↑

require 'swish'

# Find a shot
shot = Dribbble::Shot.find(21603)

# See some data about the shot
shot.title
shot.image_url
shot.url
shot.player.name
shot.views_count
shot.likes_count
shot.comments_count
shot.rebounds_count

# Or get a shot's rebounds
shot.rebounds

# Find more shots
inspiring       = Dribbble::Shot.popular
call_the_police = Dribbble::Shot.everyone
yay_noobs       = Dribbble::Shot.debuts

# Find a player
player = Dribbble::Player.find('jeremy')

# See some data about the player
player.name
player.avatar_url
player.url
player.location
player.twitter_screen_name
player.drafted_by_player_id

# Player stats
player.shots_count
player.draftees_count
player.followers_count
player.following_count

# List a player's shots
player.shots

# List shots by players that this player follows
player.shots_following

# List a player's draftees
player.draftees

# List a player's followers
player.followers

# List the players who a player is following
player.following

Pagination¶ ↑

The Dribbble API returns paginated lists, with a default page size of 15 items. Swish makes it easy to traverse the pages of any list.

# Get the second page of popular shots, with 30 shots per page
shots = Dribbble::Shot.popular(:page => 2, :per_page => 30)

# Some useful stats for rendering pagination links
shots.page     # => current page number
shots.per_page # => number of items per page
shots.total    # => total number of items on all pages
shots.pages    # => total number of pages

# Try it with other lists
Dribbble::Player.find('jeremy').shots(:per_page => 5)
Dribbble::Player.find('jeremy').shots_following(:page => 10)
Dribbble::Shot.find(21603).rebounds(:page => 2, :per_page => 10)

See dribbble.com/api#pagination for more information.

Who’s using Swish?¶ ↑

  • liiikes.com, “Using statistics to find the best content on Dribbble.”

  • hooppps.com, “A free open-source mobile dribbble browser”

Email jeremy@weiskotten.com to have your project added to this list.

Thanks¶ ↑

Thanks to Dan and Rich for creating Dribbble (and its API!), and to everyone that has contributed to Swish, including:

  • Jeffrey Chupp

  • Jon Distad

  • Michael Parenteau

  • Adam Perfect

Email jeremy@weiskotten.com if you should be on this list. Apologies and thanks in advance.

Note on Patches/Pull Requests¶ ↑

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.

Copyright © 2010 Jeremy Weiskotten. See LICENSE for details.