Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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
base: v0.6.1
...
head fork: octokit/octokit.rb
compare: v0.6.2
Checking mergeability… Don't worry, you can still create the pull request.
  • 14 commits
  • 20 files changed
  • 1 commit comment
  • 2 contributors
View
1  .autotest
@@ -0,0 +1 @@
+require 'autotest/bundler'
View
14 README.markdown
@@ -1,11 +1,15 @@
Octokit
=======
-Simple Ruby wrapper for the GitHub v2 API.
+Simple Ruby wrapper for the GitHub v2 API.
Installation
------------
gem install octokit
-
+
+Continuous Integration
+----------------------
+[![Build Status](http://travis-ci.org/pengwynn/octokit.png)](http://travis-ci.org/pengwynn/octokit)
+
Some examples
-------------
@@ -13,12 +17,12 @@ Some examples
Octokit.user('pengwynn')
=> <#Hashie::Mash blog="http://wynnnetherland.com" company="Orrka" created_at="2008/02/25 10:24:19 -0800" email="wynn.netherland@gmail.com" followers_count=21 following_count=55 id=865 location="Dallas, TX" login="pengwynn" name="Wynn Netherland" public_gist_count=4 public_repo_count=16>
-
+
### Show who a user follows
Octokit.following('pengwynn')
=> ["cglee", "bryansray", "rails", "zachinglis", "wycats", "obie", "mully", "squeejee", "jderrett", "Shopify", "ReinH", "technoweenie", "errfree", "defunkt", "joshsusser", "hashrocket", "newbamboo", "bigtiger", "github", "jamis", "jeresig", "thoughtbot", "therealadam", "jnunemaker", "seaofclouds", "choan", "llimllib", "kwhinnery", "marshall", "handcrafted", "adamstac", "jashkenas", "dan", "remy", "hayesdavis", "documentcloud", "imathis", "mdeiters", "njonsson", "asenchi", "mattsa", "marclove", "webiest", "brogers", "polomasta", "stephp", "mchelen", "piyush", "davidnorth", "rmetzler", "jferris", "madrobby", "zh", "erikvold", "desandro"]
-
+
Working with repositories
-------------------------
For convenience, methods that require a repo argument may be passed in any of the following forms
@@ -32,7 +36,7 @@ For convenience, methods that require a repo argument may be passed in any of th
Octokit.repo("pengwynn/linkedin")
=> <#Hashie::Mash description="Ruby wrapper for the LinkedIn API" fork=false forks=1 homepage="http://bit.ly/ruby-linkedin" name="linkedin" open_issues=2 owner="pengwynn" private=false url="http://github.com/pengwynn/linkedin" watchers=36>
-
+
Authenticated requests
----------------------
Some methods require authentication so you'll need to pass a login and an api_token. You can find your GitHub API token on your [account page](https://github.com/account)
View
0  lib/faraday/raise_error.rb → lib/faraday/response/raise_error.rb
File renamed without changes
View
4 lib/octokit.rb
@@ -17,8 +17,8 @@ def self.method_missing(method, *args, &block)
client.send(method, *args, &block)
end
- def self.respond_to?(method)
- client.respond_to?(method) || super
+ def self.respond_to?(method, include_private=false)
+ client.respond_to?(method, include_private) || super(method, include_private)
end
# Custom error class for rescuing from all GitHub errors
View
7 lib/octokit/client/connection.rb
@@ -1,5 +1,5 @@
require 'faraday_middleware'
-require 'faraday/raise_error'
+require 'faraday/response/raise_error'
module Octokit
class Client
@@ -16,7 +16,7 @@ def connection(raw=false, authenticate=true)
options.merge!(:params => { :access_token => oauth_token }) if oauthed? && !authenticated?
- Faraday::Connection.new(options) do |connection|
+ con = Faraday::Connection.new(options) do |connection|
connection.use Faraday::Response::RaiseError
unless raw
connection.use Faraday::Response::Mashify
@@ -25,9 +25,10 @@ def connection(raw=false, authenticate=true)
when 'xml' then connection.use Faraday::Response::ParseXml
end
end
- connection.basic_auth authentication[:login], authentication[:password] if authenticate and authenticated?
connection.adapter(adapter)
end
+ con.basic_auth authentication[:login], authentication[:password] if authenticate and authenticated?
+ con
end
end
end
View
2  lib/octokit/version.rb
@@ -1,3 +1,3 @@
module Octokit
- VERSION = "0.6.1".freeze unless defined?(Octokit::VERSION)
+ VERSION = "0.6.2".freeze unless defined?(Octokit::VERSION)
end
View
4 octokit.gemspec
@@ -2,7 +2,7 @@
require File.expand_path('../lib/octokit/version', __FILE__)
Gem::Specification.new do |s|
- s.add_development_dependency('json', '~> 1.5')
+ s.add_development_dependency('json_pure', '~> 1.5')
s.add_development_dependency('nokogiri', '~> 1.4')
s.add_development_dependency('rake', '~> 0.8')
s.add_development_dependency('rspec', '~> 2.5')
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency('faraday', '~> 0.6.0')
s.add_runtime_dependency('faraday_middleware', '~> 0.6.0')
s.add_runtime_dependency('jruby-openssl', '~> 0.7.3') if RUBY_PLATFORM == 'java'
- s.add_runtime_dependency('multi_json', '~> 0.0.5')
+ s.add_runtime_dependency('multi_json', '~> 1.0.0')
s.add_runtime_dependency('multi_xml', '~> 0.2.0')
s.name = 'octokit'
s.authors = ["Wynn Netherland", "Adam Stacoviak", "Erik Michaels-Ober"]
View
1  spec/faraday/response_spec.rb
@@ -1,3 +1,4 @@
+# -*- encoding: utf-8 -*-
require 'helper'
describe Faraday::Response do
View
1  spec/octokit/client/commits_spec.rb
@@ -1,3 +1,4 @@
+# -*- encoding: utf-8 -*-
require 'helper'
describe Octokit::Client::Pulls do
View
1  spec/octokit/client/issues_spec.rb
@@ -1,3 +1,4 @@
+# -*- encoding: utf-8 -*-
require 'helper'
describe Octokit::Client::Issues do
View
1  spec/octokit/client/network_spec.rb
@@ -1,3 +1,4 @@
+# -*- encoding: utf-8 -*-
require 'helper'
describe Octokit::Client::Network do
View
1  spec/octokit/client/objects_spec.rb
@@ -1,3 +1,4 @@
+# -*- encoding: utf-8 -*-
require 'helper'
describe Octokit::Client::Objects do
View
11 spec/octokit/client/organizations_spec.rb
@@ -1,3 +1,4 @@
+# -*- encoding: utf-8 -*-
require 'helper'
describe Octokit::Client::Organizations do
@@ -110,7 +111,7 @@
with(:name => "Fellows").
to_return(:body => fixture("team.json"))
team = @client.create_team("codeforamerica", {:name => "Fellows"})
- team.first.last.should == "Fellows"
+ team.name.should == "Fellows"
end
end
@@ -121,7 +122,7 @@
stub_get("teams/32598").
to_return(:body => fixture("team.json"))
team = @client.team(32598)
- team.first.last.should == "Fellows"
+ team.name.should == "Fellows"
end
end
@@ -133,7 +134,7 @@
with(:name => "Fellows").
to_return(:body => fixture("team.json"))
team = @client.update_team(32598, :name => "Fellows")
- team.first.last.should == "Fellows"
+ team.name.should == "Fellows"
end
end
@@ -144,7 +145,7 @@
stub_delete("teams/32598").
to_return(:body => fixture("team.json"))
team = @client.delete_team(32598)
- team.first.last.should == "Fellows"
+ team.name.should == "Fellows"
end
end
@@ -155,7 +156,7 @@
stub_delete("teams/32598").
to_return(:body => fixture("team.json"))
team = @client.delete_team(32598)
- team.first.last.should == "Fellows"
+ team.name.should == "Fellows"
end
end
View
1  spec/octokit/client/pulls_spec.rb
@@ -1,3 +1,4 @@
+# -*- encoding: utf-8 -*-
require 'helper'
describe Octokit::Client::Pulls do
View
1  spec/octokit/client/repositories_spec.rb
@@ -1,3 +1,4 @@
+# -*- encoding: utf-8 -*-
require 'helper'
describe Octokit::Client::Repositories do
View
3  spec/octokit/client/timelines_spec.rb
@@ -1,3 +1,4 @@
+# -*- encoding: utf-8 -*-
require 'helper'
describe Octokit::Client::Users do
@@ -23,7 +24,7 @@
events = client.user_timeline("sferik")
events.first.repository.name.should == "homebrew"
end
-
+
context "when authenticated" do
it "should return a user timeline" do
View
1  spec/octokit/client/users_spec.rb
@@ -1,3 +1,4 @@
+# -*- encoding: utf-8 -*-
require 'helper'
describe Octokit::Client::Users do
View
9 spec/octokit/client_spec.rb
@@ -9,4 +9,13 @@
connection.should == endpoint.to_s
end
+ it 'should work with basic auth' do
+ stub_request(:get, "https://foo%2Ftoken:bar@github.com/api/v2/json/commits/list/baz/quux/master").
+ with(:headers => {'Accept'=>'*/*'}).
+ to_return(:status => 200, :body => '{"commits":[]}', :headers => {})
+ proc {
+ Octokit::Client.new(:login => 'foo', :token => 'bar').commits('baz/quux')
+ }.should_not raise_exception
+ end
+
end
View
7 spec/octokit_spec.rb
@@ -1,3 +1,4 @@
+# -*- encoding: utf-8 -*-
require 'helper'
describe Octokit do
@@ -5,6 +6,12 @@
Octokit.reset
end
+ describe ".respond_to?" do
+ it "should be true if method exists" do
+ Octokit.respond_to?(:client, true).should be_true
+ end
+ end
+
describe ".client" do
it "should be a Octokit::Client" do
Octokit.client.should be_a Octokit::Client
View
1  spec/repository_spec.rb
@@ -1,3 +1,4 @@
+# -*- encoding: utf-8 -*-
require 'helper'
describe Octokit::Repository do

Showing you all comments on commits in this comparison.

@sferik
Collaborator

@mislav The spec in 64b241f was failing before this patch. I believe this was working prior to upgrading to faraday 0.6.0. Are we doing something wrong here?

Something went wrong with that request. Please try again.