Code Monkey home page Code Monkey logo

swish's Introduction

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 [email protected] 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 [email protected] 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.

swish's People

Contributors

semanticart avatar aperfect avatar michaelparenteau avatar

Stargazers

Kai Devrim avatar Angus H. avatar John McGrath avatar

Watchers

John McGrath avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.