Sha256: ce1fb8364651825266f64bf384b65c2c6be8b4ddc6683002705d592dcf7da422
Contents?: true
Size: 2 KB
Versions: 1
Compression:
Stored size: 2 KB
Contents
= octopi Octopi is a Ruby interface to GitHub API v2 (http://develop.github.com). It's under early but active development and already works. == Example === Users API Getting user information user = User.find("fcoury") puts "#{user.name} is being followed by #{user.followers.join(", ")} and following #{user.following.join(", ")}" The bang methods `followers!` and `following!` retrieves a full User object for each user login returned, so it has to be used carefully. user.followers!.each do |u| puts " - #{u.name} (#{u.login}) has #{u.public_repo_count} repo(s)" end Searching for user users = User.find_all("silva") puts "#{users.size} users found for 'silva':" users.each do |u| puts " - #{u.name}" end === Repositories API repo = user.repository("octopi") # same as: Repository.find("fcoury", "octopi") puts "Repository: #{repo.name} - #{repo.description} (by #{repo.owner}) - #{repo.url}" puts " Tags: #{repo.tags and repo.tags.map {|t| t.name}.join(", ")}" Search: repos = Repository.find_all("ruby", "git") puts "#{repos.size} repository(ies) with 'ruby' and 'git':" repos.each do |r| puts " - #{r.name}" end Issues API integrated into the Repository object: issue = repo.issues.first puts "First open issue: #{issue.number} - #{issue.title} - Created at: #{issue.created_at}" Commits API information from a Repository object: first_commit = repo.commits.first puts "First commit: #{first_commit.id} - #{first_commit.message} - by #{first_commit.author['name']}" Single commit information: puts "Diff:" first_commit.details.modified.each {|m| puts "#{m['filename']} DIFF: #{m['diff']}" } == Author * Felipe Coury - http://felipecoury.com * HasMany.info blog - http://hasmany.info == Copyright DISCLAIMER: The name of this library is pronounced <i>octo-pie</i> but no Octocats were harmed during its creation. It's not really an Octo Pie, but a contraction of the words Octocat and API. Copyright (c) 2009 Felipe Coury. See LICENSE for details.
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fcoury-octopi-0.0.5 | README.rdoc |