octokit 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +6 -0
- data/lib/faraday/raise_error.rb +21 -29
- data/lib/octokit/client/connection.rb +3 -3
- data/lib/octokit/version.rb +1 -1
- data/octokit.gemspec +3 -2
- data/spec/octokit/client/issues_spec.rb +0 -2
- metadata +6 -7
data/.travis.yml
ADDED
data/lib/faraday/raise_error.rb
CHANGED
@@ -3,38 +3,30 @@ require 'faraday'
|
|
3
3
|
# @api private
|
4
4
|
module Faraday
|
5
5
|
class Response::RaiseError < Response::Middleware
|
6
|
-
def
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
raise Octokit::ServiceUnavailable, error_message(response)
|
27
|
-
end
|
6
|
+
def on_complete(response)
|
7
|
+
case response[:status].to_i
|
8
|
+
when 400
|
9
|
+
raise Octokit::BadRequest, error_message(response)
|
10
|
+
when 401
|
11
|
+
raise Octokit::Unauthorized, error_message(response)
|
12
|
+
when 403
|
13
|
+
raise Octokit::Forbidden, error_message(response)
|
14
|
+
when 404
|
15
|
+
raise Octokit::NotFound, error_message(response)
|
16
|
+
when 406
|
17
|
+
raise Octokit::NotAcceptable, error_message(response)
|
18
|
+
when 500
|
19
|
+
raise Octokit::InternalServerError, error_message(response)
|
20
|
+
when 501
|
21
|
+
raise Octokit::NotImplemented, error_message(response)
|
22
|
+
when 502
|
23
|
+
raise Octokit::BadGateway, error_message(response)
|
24
|
+
when 503
|
25
|
+
raise Octokit::ServiceUnavailable, error_message(response)
|
28
26
|
end
|
29
27
|
end
|
30
28
|
|
31
|
-
def
|
32
|
-
super
|
33
|
-
end
|
34
|
-
|
35
|
-
private
|
36
|
-
|
37
|
-
def self.error_message(response)
|
29
|
+
def error_message(response)
|
38
30
|
"#{response[:method].to_s.upcase} #{response[:url].to_s}: #{response[:status]}#{(': ' + response[:body]) if response[:body]}"
|
39
31
|
end
|
40
32
|
end
|
@@ -17,16 +17,16 @@ module Octokit
|
|
17
17
|
options.merge!(:params => { :access_token => oauth_token }) if oauthed? && !authenticated?
|
18
18
|
|
19
19
|
Faraday::Connection.new(options) do |connection|
|
20
|
-
connection.adapter(adapter)
|
21
|
-
connection.basic_auth authentication[:login], authentication[:password] if authenticate and authenticated?
|
22
20
|
connection.use Faraday::Response::RaiseError
|
23
21
|
unless raw
|
22
|
+
connection.use Faraday::Response::Mashify
|
24
23
|
case format.to_s.downcase
|
25
24
|
when 'json' then connection.use Faraday::Response::ParseJson
|
26
25
|
when 'xml' then connection.use Faraday::Response::ParseXml
|
27
26
|
end
|
28
|
-
connection.use Faraday::Response::Mashify
|
29
27
|
end
|
28
|
+
connection.basic_auth authentication[:login], authentication[:password] if authenticate and authenticated?
|
29
|
+
connection.adapter(adapter)
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
data/lib/octokit/version.rb
CHANGED
data/octokit.gemspec
CHANGED
@@ -11,8 +11,9 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.add_development_dependency('ZenTest', '~> 4.5')
|
12
12
|
s.add_runtime_dependency('addressable', '~> 2.2.4')
|
13
13
|
s.add_runtime_dependency('hashie', '~> 1.0.0')
|
14
|
-
s.add_runtime_dependency('faraday', '~> 0.
|
15
|
-
s.add_runtime_dependency('faraday_middleware', '~> 0.
|
14
|
+
s.add_runtime_dependency('faraday', '~> 0.6.0')
|
15
|
+
s.add_runtime_dependency('faraday_middleware', '~> 0.6.0')
|
16
|
+
s.add_runtime_dependency('jruby-openssl', '~> 0.7.3') if RUBY_PLATFORM == 'java'
|
16
17
|
s.add_runtime_dependency('multi_json', '~> 0.0.5')
|
17
18
|
s.add_runtime_dependency('multi_xml', '~> 0.2.0')
|
18
19
|
s.name = 'octokit'
|
@@ -65,7 +65,6 @@ describe Octokit::Client::Issues do
|
|
65
65
|
|
66
66
|
it "should create an issue" do
|
67
67
|
stub_post("issues/open/sferik/rails_admin").
|
68
|
-
with(:body => {:title => "Use OrmAdapter instead of talking directly to ActiveRecord", :body => "Hi,\n\nI just tried to play with this in an app with no ActiveRecord. I was disappointed. It seems the only reason the engine relies on AR is to provide History functionality. I would argue that having the History in a database, and therefore tying the app to AR & SQL, isn't worth it. How about we change it to just dump to a CSV and remove the AR dep?\n\n$0.02"}).
|
69
68
|
to_return(:body => fixture("issue.json"))
|
70
69
|
issue = @client.create_issue("sferik/rails_admin", "Use OrmAdapter instead of talking directly to ActiveRecord", "Hi,\n\nI just tried to play with this in an app with no ActiveRecord. I was disappointed. It seems the only reason the engine relies on AR is to provide History functionality. I would argue that having the History in a database, and therefore tying the app to AR & SQL, isn't worth it. How about we change it to just dump to a CSV and remove the AR dep?\n\n$0.02")
|
71
70
|
issue.number.should == 105
|
@@ -99,7 +98,6 @@ describe Octokit::Client::Issues do
|
|
99
98
|
|
100
99
|
it "should update an issue" do
|
101
100
|
stub_post("issues/edit/sferik/rails_admin/105").
|
102
|
-
with(:body => {:title => "Use OrmAdapter instead of talking directly to ActiveRecord", :body => "Hi,\n\nI just tried to play with this in an app with no ActiveRecord. I was disappointed. It seems the only reason the engine relies on AR is to provide History functionality. I would argue that having the History in a database, and therefore tying the app to AR & SQL, isn't worth it. How about we change it to just dump to a CSV and remove the AR dep?\n\n$0.02"}).
|
103
101
|
to_return(:body => fixture("issue.json"))
|
104
102
|
issue = @client.update_issue("sferik/rails_admin", 105, "Use OrmAdapter instead of talking directly to ActiveRecord", "Hi,\n\nI just tried to play with this in an app with no ActiveRecord. I was disappointed. It seems the only reason the engine relies on AR is to provide History functionality. I would argue that having the History in a database, and therefore tying the app to AR & SQL, isn't worth it. How about we change it to just dump to a CSV and remove the AR dep?\n\n$0.02")
|
105
103
|
issue.number.should == 105
|
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.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Wynn Netherland
|
@@ -12,8 +12,7 @@ autorequire:
|
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
14
|
|
15
|
-
date: 2011-
|
16
|
-
default_executable:
|
15
|
+
date: 2011-04-06 00:00:00 Z
|
17
16
|
dependencies:
|
18
17
|
- !ruby/object:Gem::Dependency
|
19
18
|
name: json
|
@@ -122,7 +121,7 @@ dependencies:
|
|
122
121
|
requirements:
|
123
122
|
- - ~>
|
124
123
|
- !ruby/object:Gem::Version
|
125
|
-
version: 0.
|
124
|
+
version: 0.6.0
|
126
125
|
type: :runtime
|
127
126
|
version_requirements: *id010
|
128
127
|
- !ruby/object:Gem::Dependency
|
@@ -133,7 +132,7 @@ dependencies:
|
|
133
132
|
requirements:
|
134
133
|
- - ~>
|
135
134
|
- !ruby/object:Gem::Version
|
136
|
-
version: 0.
|
135
|
+
version: 0.6.0
|
137
136
|
type: :runtime
|
138
137
|
version_requirements: *id011
|
139
138
|
- !ruby/object:Gem::Dependency
|
@@ -172,6 +171,7 @@ files:
|
|
172
171
|
- .gemtest
|
173
172
|
- .gitignore
|
174
173
|
- .rspec
|
174
|
+
- .travis.yml
|
175
175
|
- Gemfile
|
176
176
|
- LICENSE
|
177
177
|
- README.markdown
|
@@ -248,7 +248,6 @@ files:
|
|
248
248
|
- spec/octokit/client_spec.rb
|
249
249
|
- spec/octokit_spec.rb
|
250
250
|
- spec/repository_spec.rb
|
251
|
-
has_rdoc: true
|
252
251
|
homepage: http://wynnnetherland.com/projects/octokit/
|
253
252
|
licenses: []
|
254
253
|
|
@@ -272,7 +271,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
272
271
|
requirements: []
|
273
272
|
|
274
273
|
rubyforge_project:
|
275
|
-
rubygems_version: 1.
|
274
|
+
rubygems_version: 1.7.2
|
276
275
|
signing_key:
|
277
276
|
specification_version: 3
|
278
277
|
summary: Wrapper for the GitHub API
|