octokit 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +1 -0
- data/README.markdown +9 -5
- data/lib/faraday/{raise_error.rb → response/raise_error.rb} +0 -0
- data/lib/octokit.rb +2 -2
- data/lib/octokit/client/connection.rb +4 -3
- data/lib/octokit/version.rb +1 -1
- data/octokit.gemspec +2 -2
- data/spec/faraday/response_spec.rb +1 -0
- data/spec/octokit/client/commits_spec.rb +1 -0
- data/spec/octokit/client/issues_spec.rb +1 -0
- data/spec/octokit/client/network_spec.rb +1 -0
- data/spec/octokit/client/objects_spec.rb +1 -0
- data/spec/octokit/client/organizations_spec.rb +6 -5
- data/spec/octokit/client/pulls_spec.rb +1 -0
- data/spec/octokit/client/repositories_spec.rb +1 -0
- data/spec/octokit/client/timelines_spec.rb +2 -1
- data/spec/octokit/client/users_spec.rb +1 -0
- data/spec/octokit/client_spec.rb +9 -0
- data/spec/octokit_spec.rb +7 -0
- data/spec/repository_spec.rb +1 -0
- metadata +7 -5
data/.autotest
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'autotest/bundler'
|
data/README.markdown
CHANGED
@@ -1,11 +1,15 @@
|
|
1
1
|
Octokit
|
2
2
|
=======
|
3
|
-
Simple Ruby wrapper for the GitHub v2 API.
|
3
|
+
Simple Ruby wrapper for the GitHub v2 API.
|
4
4
|
|
5
5
|
Installation
|
6
6
|
------------
|
7
7
|
gem install octokit
|
8
|
-
|
8
|
+
|
9
|
+
Continuous Integration
|
10
|
+
----------------------
|
11
|
+
[![Build Status](http://travis-ci.org/pengwynn/octokit.png)](http://travis-ci.org/pengwynn/octokit)
|
12
|
+
|
9
13
|
Some examples
|
10
14
|
-------------
|
11
15
|
|
@@ -13,12 +17,12 @@ Some examples
|
|
13
17
|
|
14
18
|
Octokit.user('pengwynn')
|
15
19
|
=> <#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>
|
16
|
-
|
20
|
+
|
17
21
|
### Show who a user follows
|
18
22
|
|
19
23
|
Octokit.following('pengwynn')
|
20
24
|
=> ["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"]
|
21
|
-
|
25
|
+
|
22
26
|
Working with repositories
|
23
27
|
-------------------------
|
24
28
|
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
|
|
32
36
|
|
33
37
|
Octokit.repo("pengwynn/linkedin")
|
34
38
|
=> <#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>
|
35
|
-
|
39
|
+
|
36
40
|
Authenticated requests
|
37
41
|
----------------------
|
38
42
|
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)
|
File without changes
|
data/lib/octokit.rb
CHANGED
@@ -17,8 +17,8 @@ module Octokit
|
|
17
17
|
client.send(method, *args, &block)
|
18
18
|
end
|
19
19
|
|
20
|
-
def self.respond_to?(method)
|
21
|
-
client.respond_to?(method) || super
|
20
|
+
def self.respond_to?(method, include_private=false)
|
21
|
+
client.respond_to?(method, include_private) || super(method, include_private)
|
22
22
|
end
|
23
23
|
|
24
24
|
# Custom error class for rescuing from all GitHub errors
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'faraday_middleware'
|
2
|
-
require 'faraday/raise_error'
|
2
|
+
require 'faraday/response/raise_error'
|
3
3
|
|
4
4
|
module Octokit
|
5
5
|
class Client
|
@@ -16,7 +16,7 @@ module Octokit
|
|
16
16
|
|
17
17
|
options.merge!(:params => { :access_token => oauth_token }) if oauthed? && !authenticated?
|
18
18
|
|
19
|
-
Faraday::Connection.new(options) do |connection|
|
19
|
+
con = Faraday::Connection.new(options) do |connection|
|
20
20
|
connection.use Faraday::Response::RaiseError
|
21
21
|
unless raw
|
22
22
|
connection.use Faraday::Response::Mashify
|
@@ -25,9 +25,10 @@ module Octokit
|
|
25
25
|
when 'xml' then connection.use Faraday::Response::ParseXml
|
26
26
|
end
|
27
27
|
end
|
28
|
-
connection.basic_auth authentication[:login], authentication[:password] if authenticate and authenticated?
|
29
28
|
connection.adapter(adapter)
|
30
29
|
end
|
30
|
+
con.basic_auth authentication[:login], authentication[:password] if authenticate and authenticated?
|
31
|
+
con
|
31
32
|
end
|
32
33
|
end
|
33
34
|
end
|
data/lib/octokit/version.rb
CHANGED
data/octokit.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
require File.expand_path('../lib/octokit/version', __FILE__)
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
|
-
s.add_development_dependency('
|
5
|
+
s.add_development_dependency('json_pure', '~> 1.5')
|
6
6
|
s.add_development_dependency('nokogiri', '~> 1.4')
|
7
7
|
s.add_development_dependency('rake', '~> 0.8')
|
8
8
|
s.add_development_dependency('rspec', '~> 2.5')
|
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.add_runtime_dependency('faraday', '~> 0.6.0')
|
15
15
|
s.add_runtime_dependency('faraday_middleware', '~> 0.6.0')
|
16
16
|
s.add_runtime_dependency('jruby-openssl', '~> 0.7.3') if RUBY_PLATFORM == 'java'
|
17
|
-
s.add_runtime_dependency('multi_json', '~> 0.0
|
17
|
+
s.add_runtime_dependency('multi_json', '~> 1.0.0')
|
18
18
|
s.add_runtime_dependency('multi_xml', '~> 0.2.0')
|
19
19
|
s.name = 'octokit'
|
20
20
|
s.authors = ["Wynn Netherland", "Adam Stacoviak", "Erik Michaels-Ober"]
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
1
2
|
require 'helper'
|
2
3
|
|
3
4
|
describe Octokit::Client::Organizations do
|
@@ -110,7 +111,7 @@ describe Octokit::Client::Organizations do
|
|
110
111
|
with(:name => "Fellows").
|
111
112
|
to_return(:body => fixture("team.json"))
|
112
113
|
team = @client.create_team("codeforamerica", {:name => "Fellows"})
|
113
|
-
team.
|
114
|
+
team.name.should == "Fellows"
|
114
115
|
end
|
115
116
|
|
116
117
|
end
|
@@ -121,7 +122,7 @@ describe Octokit::Client::Organizations do
|
|
121
122
|
stub_get("teams/32598").
|
122
123
|
to_return(:body => fixture("team.json"))
|
123
124
|
team = @client.team(32598)
|
124
|
-
team.
|
125
|
+
team.name.should == "Fellows"
|
125
126
|
end
|
126
127
|
|
127
128
|
end
|
@@ -133,7 +134,7 @@ describe Octokit::Client::Organizations do
|
|
133
134
|
with(:name => "Fellows").
|
134
135
|
to_return(:body => fixture("team.json"))
|
135
136
|
team = @client.update_team(32598, :name => "Fellows")
|
136
|
-
team.
|
137
|
+
team.name.should == "Fellows"
|
137
138
|
end
|
138
139
|
|
139
140
|
end
|
@@ -144,7 +145,7 @@ describe Octokit::Client::Organizations do
|
|
144
145
|
stub_delete("teams/32598").
|
145
146
|
to_return(:body => fixture("team.json"))
|
146
147
|
team = @client.delete_team(32598)
|
147
|
-
team.
|
148
|
+
team.name.should == "Fellows"
|
148
149
|
end
|
149
150
|
|
150
151
|
end
|
@@ -155,7 +156,7 @@ describe Octokit::Client::Organizations do
|
|
155
156
|
stub_delete("teams/32598").
|
156
157
|
to_return(:body => fixture("team.json"))
|
157
158
|
team = @client.delete_team(32598)
|
158
|
-
team.
|
159
|
+
team.name.should == "Fellows"
|
159
160
|
end
|
160
161
|
|
161
162
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
1
2
|
require 'helper'
|
2
3
|
|
3
4
|
describe Octokit::Client::Users do
|
@@ -23,7 +24,7 @@ describe Octokit::Client::Users do
|
|
23
24
|
events = client.user_timeline("sferik")
|
24
25
|
events.first.repository.name.should == "homebrew"
|
25
26
|
end
|
26
|
-
|
27
|
+
|
27
28
|
context "when authenticated" do
|
28
29
|
|
29
30
|
it "should return a user timeline" do
|
data/spec/octokit/client_spec.rb
CHANGED
@@ -9,4 +9,13 @@ describe Octokit::Client do
|
|
9
9
|
connection.should == endpoint.to_s
|
10
10
|
end
|
11
11
|
|
12
|
+
it 'should work with basic auth' do
|
13
|
+
stub_request(:get, "https://foo%2Ftoken:bar@github.com/api/v2/json/commits/list/baz/quux/master").
|
14
|
+
with(:headers => {'Accept'=>'*/*'}).
|
15
|
+
to_return(:status => 200, :body => '{"commits":[]}', :headers => {})
|
16
|
+
proc {
|
17
|
+
Octokit::Client.new(:login => 'foo', :token => 'bar').commits('baz/quux')
|
18
|
+
}.should_not raise_exception
|
19
|
+
end
|
20
|
+
|
12
21
|
end
|
data/spec/octokit_spec.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
1
2
|
require 'helper'
|
2
3
|
|
3
4
|
describe Octokit do
|
@@ -5,6 +6,12 @@ describe Octokit do
|
|
5
6
|
Octokit.reset
|
6
7
|
end
|
7
8
|
|
9
|
+
describe ".respond_to?" do
|
10
|
+
it "should be true if method exists" do
|
11
|
+
Octokit.respond_to?(:client, true).should be_true
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
8
15
|
describe ".client" do
|
9
16
|
it "should be a Octokit::Client" do
|
10
17
|
Octokit.client.should be_a Octokit::Client
|
data/spec/repository_spec.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: octokit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.6.
|
5
|
+
version: 0.6.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Wynn Netherland
|
@@ -12,10 +12,10 @@ autorequire:
|
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
14
|
|
15
|
-
date: 2011-04-
|
15
|
+
date: 2011-04-26 00:00:00 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
|
-
name:
|
18
|
+
name: json_pure
|
19
19
|
prerelease: false
|
20
20
|
requirement: &id001 !ruby/object:Gem::Requirement
|
21
21
|
none: false
|
@@ -143,7 +143,7 @@ dependencies:
|
|
143
143
|
requirements:
|
144
144
|
- - ~>
|
145
145
|
- !ruby/object:Gem::Version
|
146
|
-
version: 0.0
|
146
|
+
version: 1.0.0
|
147
147
|
type: :runtime
|
148
148
|
version_requirements: *id012
|
149
149
|
- !ruby/object:Gem::Dependency
|
@@ -167,6 +167,7 @@ extensions: []
|
|
167
167
|
extra_rdoc_files: []
|
168
168
|
|
169
169
|
files:
|
170
|
+
- .autotest
|
170
171
|
- .document
|
171
172
|
- .gemtest
|
172
173
|
- .gitignore
|
@@ -177,7 +178,7 @@ files:
|
|
177
178
|
- README.markdown
|
178
179
|
- Rakefile
|
179
180
|
- changelog.markdown
|
180
|
-
- lib/faraday/raise_error.rb
|
181
|
+
- lib/faraday/response/raise_error.rb
|
181
182
|
- lib/octokit.rb
|
182
183
|
- lib/octokit/client.rb
|
183
184
|
- lib/octokit/client/authentication.rb
|
@@ -328,3 +329,4 @@ test_files:
|
|
328
329
|
- spec/octokit/client_spec.rb
|
329
330
|
- spec/octokit_spec.rb
|
330
331
|
- spec/repository_spec.rb
|
332
|
+
has_rdoc:
|