Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: octokit/octokit.rb
...
head fork: octokit/octokit.rb
  • 15 commits
  • 15 files changed
  • 0 commit comments
  • 4 contributors
Commits on Jan 08, 2012
@catsby catsby Initial support for Downloads
Adds support for listing all or individual downloads for a repository

Refs octokit/octokit.rb#61
b94aad8
@catsby catsby Trim down the Downloads fixture
We don't need 200 lines of fixture
c3bb450
Commits on Jan 12, 2012
@catsby catsby Merge remote-tracking branch 'pengwynn/master' into downloads
* pengwynn/master:
  Run specs in random order to catch order-dependency bugs
b6cb984
Commits on Feb 12, 2012
@catsby catsby Merge branch 'master' into downloads
* master:
  Add "v3" to README.
  Update faraday_middleware to version 0.8
  Adding Events V3 API methods for public_events and repo events. Also fixed missing rake task to generate YARD documentation.
  Missed a spot.
  Renamed auto_paginate option to auto_traversal to more accurately reflect its behavior.
  Removed redundant nil check.
  Added an auto-pagination option that will fetch all results upon request.
  Switched every user API call except Search to v3. If there's a Search in v3, I can't find it in the docs.
  Upgraded followers API to v3.
  Add commit_comment APIv3 GitHub calls
  Update rspec dependency version
  Fix typo in spec
2733f68
Commits on Feb 13, 2012
@pengwynn pengwynn Updates changelog 6dbc537
Commits on Mar 03, 2012
@webcracy webcracy add #user_events("<username>") to list all events for a user 23a177c
Commits on Mar 07, 2012
@catsby catsby Trim spec file down to 2 items
Don't need 1724 lines of spec when ~100 will do
ae4ca70
Commits on Mar 12, 2012
@pengwynn pengwynn Merge pull request #72 from ctshryock/downloads
Add support Downloads API: List, Get
c1eae26
@sferik sferik Explicitly specify language 6d12438
@sferik sferik Test in both 1.8 and 1.9 mode on JRuby and Rubinius c9c66cb
@sferik sferik Use maruku instead of rdiscount for compatibility with JRuby and Rubi…
…nius in 1.9 mode
d52496a
@sferik sferik Don't start SimpleCov during CI builds 919ccad
Commits on Mar 28, 2012
@pengwynn pengwynn Fixes #75, error creating pull requests 5ba3cb3
Commits on Mar 30, 2012
@sferik sferik Remove REE support (EOL imminent) 9ab8a80
Commits on Mar 31, 2012
@pengwynn pengwynn Version bump for release 30bad46
View
8 .travis.yml
@@ -1,7 +1,9 @@
+language: ruby
rvm:
- 1.8.7
- 1.9.2
- 1.9.3
- - jruby
- - rbx
- - ree
+ - jruby-18mode
+ - jruby-19mode
+ - rbx-18mode
+ - rbx-19mode
View
1  CHANGELOG.md
@@ -1,5 +1,6 @@
# CHANGELOG
+* [1.0.0 - February 12, 2012](https://github.com/pengwynn/octokit/compare/v0.6.5...v1.0.0)
* [0.6.5 - October 15, 2011](https://github.com/pengwynn/octokit/compare/v0.6.4...v0.6.5)
* [0.6.4 - July 2, 2011](https://github.com/pengwynn/octokit/compare/v0.6.3...v0.6.4)
* [0.6.3 - May 5, 2011](https://github.com/pengwynn/octokit/compare/v0.6.2...v0.6.3)
View
2  README.md
@@ -71,11 +71,9 @@ implementations:
* Ruby 1.9.3
* [JRuby][]
* [Rubinius][]
-* [Ruby Enterprise Edition][ree]
[jruby]: http://www.jruby.org/
[rubinius]: http://rubini.us/
-[ree]: http://www.rubyenterpriseedition.com/
If something doesn't work on one of these interpreters, it should be considered
a bug.
View
2  lib/octokit/client.rb
@@ -4,6 +4,7 @@
require 'octokit/request'
require 'octokit/client/commits'
+require 'octokit/client/downloads'
require 'octokit/client/issues'
require 'octokit/client/labels'
require 'octokit/client/network'
@@ -34,6 +35,7 @@ def initialize(options={})
include Octokit::Request
include Octokit::Client::Commits
+ include Octokit::Client::Downloads
include Octokit::Client::Issues
include Octokit::Client::Labels
include Octokit::Client::Network
View
29 lib/octokit/client/downloads.rb
@@ -0,0 +1,29 @@
+module Octokit
+ class Client
+ module Downloads
+
+ # List available downloads for a repository
+ #
+ # @param repo [String, Repository, Hash] A Github Repository
+ # @return [Array] A list of available downloads
+ # @see http://developer.github.com/v3/repos/downloads/#list-downloads-for-a-repository
+ # @example List all downloads for Github/Hubot
+ # Octokit.downloads("github/hubot")
+ def downloads(repo, options={})
+ get("repos/#{Repository.new(repo)}/downloads", options, 3)
+ end
+
+ # Get single download for a repository
+ #
+ # @param repo [String, Repository, Hash] A GitHub repository
+ # @param id [Integer] ID of the download
+ # @return [Download] A single download from the repository
+ # @see http://developer.github.com/v3/repos/downloads/#get-a-single-download
+ # @example Get the "Robawt" download from Github/Hubot
+ # Octokit.download("github/hubot")
+ def download(repo, id, options={})
+ get("repos/#{Repository.new(repo)}/downloads/#{id}", options, 3)
+ end
+ end
+ end
+end
View
10 lib/octokit/client/events.rb
@@ -10,6 +10,16 @@ module Events
def public_events(options={})
get("/events", options, 3)
end
+
+ # List all user events
+ #
+ # @return [Array] A list of all user events
+ # @see http://developer.github.com/v3/events
+ # @example List all user events
+ # Octokit.user_events("sferik")
+ def user_events(user, options={})
+ get("/users/#{user}/events", options, 3)
+ end
# List events for a repository
#
View
4 lib/octokit/client/pulls.rb
@@ -8,7 +8,7 @@ def create_pull_request(repo, base, head, title, body, options={})
:title => title,
:body => body,
}
- post("repos/#{Repository.new(repo)}/pulls", options.merge({:pull => pull}))
+ post("repos/#{Repository.new(repo)}/pulls", options.merge(pull))
end
def create_pull_request_for_issue(repo, base, head, issue, options={})
@@ -17,7 +17,7 @@ def create_pull_request_for_issue(repo, base, head, issue, options={})
:head => head,
:issue => issue
}
- post("repos/#{Repository.new(repo)}/pulls", options.merge({:pull => pull}))
+ post("repos/#{Repository.new(repo)}/pulls", options.merge(pull))
end
def pull_requests(repo, state='open', options={})
View
2  lib/octokit/version.rb
@@ -1,3 +1,3 @@
module Octokit
- VERSION = "1.0.0".freeze unless defined?(Octokit::VERSION)
+ VERSION = "1.0.1".freeze unless defined?(Octokit::VERSION)
end
View
2  octokit.gemspec
@@ -8,12 +8,12 @@ Gem::Specification.new do |gem|
gem.add_dependency 'hashie', '~> 1.2'
gem.add_dependency 'multi_json', '~> 1.0'
gem.add_development_dependency 'json'
+ gem.add_development_dependency 'maruku'
gem.add_development_dependency 'rake'
gem.add_development_dependency 'rspec', '~> 2.8'
gem.add_development_dependency 'simplecov'
gem.add_development_dependency 'webmock'
gem.add_development_dependency 'yard'
- gem.add_development_dependency 'rdiscount'
gem.authors = ["Wynn Netherland", "Adam Stacoviak", "Erik Michaels-Ober"]
gem.description = %q{Simple wrapper for the GitHub API (v2 and v3)}
gem.email = ['wynn.netherland@gmail.com', 'adam@stacoviak.com', 'sferik@gmail.com']
View
11 spec/fixtures/v3/download.json
@@ -0,0 +1,11 @@
+{
+ "content_type": "application/gzip",
+ "created_at": "2011-12-24T05:18:20Z",
+ "description": "Robawt",
+ "html_url": "https://github.com/downloads/github/hubot/hubot-2.1.0.tar.gz",
+ "download_count": 267,
+ "size": 6144,
+ "name": "hubot-2.1.0.tar.gz",
+ "id": 165347,
+ "url": "https://api.github.com/repos/github/hubot/downloads/165347"
+}
View
35 spec/fixtures/v3/downloads.json
@@ -0,0 +1,35 @@
+[
+ {
+ "content_type": "application/gzip",
+ "created_at": "2011-12-24T05:18:20Z",
+ "description": "Robawt",
+ "size": 6144,
+ "html_url": "https://github.com/downloads/github/hubot/hubot-2.1.0.tar.gz",
+ "name": "hubot-2.1.0.tar.gz",
+ "download_count": 267,
+ "id": 165347,
+ "url": "https://api.github.com/repos/github/hubot/downloads/165347"
+ },
+ {
+ "content_type": "application/gzip",
+ "created_at": "2011-12-01T08:48:32Z",
+ "description": "Robawt",
+ "size": 6144,
+ "html_url": "https://github.com/downloads/github/hubot/hubot-2.0.5.tar.gz",
+ "name": "hubot-2.0.5.tar.gz",
+ "download_count": 3602,
+ "id": 155291,
+ "url": "https://api.github.com/repos/github/hubot/downloads/155291"
+ },
+ {
+ "content_type": "application/gzip",
+ "created_at": "2011-11-25T20:07:31Z",
+ "description": "Robawt",
+ "size": 6144,
+ "html_url": "https://github.com/downloads/github/hubot/hubot-2.0.4.tar.gz",
+ "name": "hubot-2.0.4.tar.gz",
+ "download_count": 383,
+ "id": 153174,
+ "url": "https://api.github.com/repos/github/hubot/downloads/153174"
+ }
+]
View
102 spec/fixtures/v3/user_events.json
@@ -0,0 +1,102 @@
+
+[
+ {
+ "type": "PushEvent",
+ "payload": {
+ "head": "e99fc3fedd7fa79a590911ef5c3415a6ab4d5d5f",
+ "size": 2,
+ "push_id": 65327953,
+ "commits": [
+ {
+ "sha": "eae82e96148fa21d7e062d89f683567f3decf07c",
+ "author": {
+ "name": "Erik Michaels-Ober",
+ "email": "sferik@gmail.com"
+ },
+ "url": "https://api.github.com/repos/codeforamerica/follow-all/commits/eae82e96148fa21d7e062d89f683567f3decf07c",
+ "distinct": true,
+ "message": "Update rails dependency to version 3.2.2"
+ },
+ {
+ "sha": "e99fc3fedd7fa79a590911ef5c3415a6ab4d5d5f",
+ "author": {
+ "name": "Erik Michaels-Ober",
+ "email": "sferik@gmail.com"
+ },
+ "url": "https://api.github.com/repos/codeforamerica/follow-all/commits/e99fc3fedd7fa79a590911ef5c3415a6ab4d5d5f",
+ "distinct": true,
+ "message": "Update omniauth-oauth dependency to version 1.0.1"
+ }
+ ],
+ "ref": "refs/heads/master"
+ },
+ "public": true,
+ "org": {
+ "gravatar_id": "ec81184c572bc827b72ebb489d49f821",
+ "id": 337792,
+ "url": "https://api.github.com/orgs/",
+ "login": "codeforamerica"
+ },
+ "repo": {
+ "id": 1255356,
+ "url": "https://api.github.com/repos/codeforamerica/follow-all",
+ "name": "codeforamerica/follow-all"
+ },
+ "actor": {
+ "gravatar_id": "1f74b13f1e5c6c69cb5d7fbaabb1e2cb",
+ "id": 10308,
+ "url": "https://api.github.com/users/sferik",
+ "login": "sferik"
+ },
+ "created_at": "2012-03-02T22:01:29Z",
+ "id": "1525888969"
+ },
+ {
+ "type": "PushEvent",
+ "payload": {
+ "head": "092cb80b33268ed6b49b45d58ef3e50d4c9eca85",
+ "size": 2,
+ "push_id": 65327945,
+ "commits": [
+ {
+ "sha": "f1f47383f20a05ecda1b4cb34378408c53a7fbc3",
+ "author": {
+ "name": "Erik Michaels-Ober",
+ "email": "sferik@gmail.com"
+ },
+ "url": "https://api.github.com/repos/sferik/sign-in-with-twitter/commits/f1f47383f20a05ecda1b4cb34378408c53a7fbc3",
+ "distinct": true,
+ "message": "Update rails dependency to version 3.2.2"
+ },
+ {
+ "sha": "092cb80b33268ed6b49b45d58ef3e50d4c9eca85",
+ "author": {
+ "name": "Erik Michaels-Ober",
+ "email": "sferik@gmail.com"
+ },
+ "url": "https://api.github.com/repos/sferik/sign-in-with-twitter/commits/092cb80b33268ed6b49b45d58ef3e50d4c9eca85",
+ "distinct": true,
+ "message": "Update omniauth-oauth dependency to version 1.0.1"
+ }
+ ],
+ "ref": "refs/heads/master"
+ },
+ "public": true,
+ "org": {
+ "url": "https://api.github.com/orgs/"
+ },
+ "repo": {
+ "id": 1716295,
+ "url": "https://api.github.com/repos/sferik/sign-in-with-twitter",
+ "name": "sferik/sign-in-with-twitter"
+ },
+ "actor": {
+ "gravatar_id": "1f74b13f1e5c6c69cb5d7fbaabb1e2cb",
+ "id": 10308,
+ "url": "https://api.github.com/users/sferik",
+ "login": "sferik"
+ },
+ "created_at": "2012-03-02T22:01:27Z",
+ "id": "1525888950"
+ }
+]
View
8 spec/helper.rb
@@ -1,6 +1,8 @@
-require 'simplecov'
-SimpleCov.start do
- add_filter "/spec"
+unless ENV['CI']
+ require 'simplecov'
+ SimpleCov.start do
+ add_filter "/spec"
+ end
end
require 'octokit'
require 'rspec'
View
33 spec/octokit/client/downloads_spec.rb
@@ -0,0 +1,33 @@
+# -*- encoding: utf-8 -*-
+require 'helper'
+
+describe Octokit::Client::Downloads do
+
+ before do
+ @client = Octokit::Client.new(:login => 'sferik')
+ end
+
+ describe ".downloads" do
+
+ it "should list available downloads" do
+ stub_get("/repos/github/hubot/downloads").
+ to_return(:body => fixture("v3/downloads.json"))
+ downloads = @client.downloads("github/hubot")
+ downloads.first.description.should == "Robawt"
+ end
+
+ end
+
+ describe ".download" do
+
+ it "should get a single download" do
+ stub_get("/repos/github/hubot/downloads/165347").
+ to_return(:body => fixture("v3/download.json"))
+ download = @client.download("github/hubot", 165347)
+ download.id.should == 165347
+ download.name.should == 'hubot-2.1.0.tar.gz'
+ end
+
+ end
+
+end
View
9 spec/octokit/client/events_spec.rb
@@ -14,6 +14,15 @@
public_events.first.id.should == '1513284759'
end
end
+
+ describe ".user_events" do
+ it "should return all user events" do
+ stub_get("/users/sferik/events").
+ to_return(:body => fixture("v3/user_events.json"))
+ user_events = @client.user_events('sferik')
+ user_events.first.id.should == '1525888969'
+ end
+ end
describe ".repository_events" do
it "should return events for a repository" do

No commit comments for this range

Something went wrong with that request. Please try again.