gh 0.11.3 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 43020016e261c85569cfa40a4a92753523a42a13
4
- data.tar.gz: 5eacd265750783b05a3f14ec64e666252cf81526
3
+ metadata.gz: 5eaf32d727662e6f4bd966e4683577be73528fab
4
+ data.tar.gz: 0c87937a7ad68fc8c1909fb0cfb3b2042f1d62fa
5
5
  SHA512:
6
- metadata.gz: 0722d2c77d6bda9093fb7c1b96197413798abfdacf2ac5b3bdacfea552d1b05ab1ab0b9a4a191c2c788728bad9de12b0c75b043587846eba3aba1efa1ec04ac9
7
- data.tar.gz: 657ee818d39385caeb1ca73d75a2db88bad3361783e8e2ab9a2157ae08f9b4c688be5b94d17442989262a8511e2895d987c686235903548eac7ab77164930904
6
+ metadata.gz: 4da20e23e06eb4be1e5090588086aefa88c35a1626e6efffce6941b82256d40021696f02f26cc91c5ad9b9597e43555ff0423b61b7f4e573502406fa6d955093
7
+ data.tar.gz: 2e789815ff440f2d3ab9edf477b1618da33f367f7b9ab70d7b675448a1d712e5b7c9b7f3ceb71ae000f919fe980073b269476dc4a7491cc280767263803c77f2
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gh (0.11.2)
4
+ gh (0.11.3)
5
5
  addressable
6
6
  backports
7
7
  faraday (~> 0.8)
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Konstantin Haase
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # GH - Layered GitHub API client
2
+ [![Build Status](https://travis-ci.org/travis-ci/travis.png?branch=master)](https://travis-ci.org/travis-ci/travis)
2
3
 
3
4
  This is a highly flexible, layered, low-level GitHub client library, trying to get out of your way and let you get to the GitHub data as simple as possible. Unless you add layers, you will end up with Hashes and Arrays. The approach and API should be familiar from projects like Rack or Faraday.
4
5
 
@@ -85,6 +85,9 @@ module GH
85
85
  req.body = Response.new(body).to_s if body
86
86
  end
87
87
  frontend.generate_response(key, response)
88
+ rescue GH::Error => error
89
+ error.info[:payload] = Response.new(body).to_s if body
90
+ raise error
88
91
  end
89
92
 
90
93
  # Public: ...
@@ -127,7 +130,7 @@ module GH
127
130
  end
128
131
 
129
132
  def full_url(key)
130
- uri = api_host + Addressable::URI.parse(key)
133
+ uri = api_host + Addressable::URI.parse(key.sub(/^\//, ''))
131
134
  raise ArgumentError, "URI out of scope: #{key}" if uri.host != api_host.host
132
135
  uri
133
136
  end
@@ -1,4 +1,4 @@
1
1
  module GH
2
2
  # Public: Library version.
3
- VERSION = "0.11.3"
3
+ VERSION = "0.12.0"
4
4
  end
@@ -8,7 +8,7 @@ describe GH::CustomLimit do
8
8
 
9
9
  it 'adds client_id and client_secret to a request' do
10
10
  headers = {
11
- "User-Agent" => "GH/0.11.2",
11
+ "User-Agent" => "GH/#{GH::VERSION}",
12
12
  "Accept" => "application/vnd.github.v3+json,application/vnd.github.beta+json;q=0.5,application/json;q=0.1",
13
13
  "Accept-Charset" => "utf-8"
14
14
  }
@@ -16,6 +16,11 @@ describe GH::Remote do
16
16
  expect { subject['foo'] }.to raise_error(GH::Error)
17
17
  end
18
18
 
19
+ it 'includes the request payload in errors' do
20
+ stub_request(:post, "https://api.github.com/foo").to_return(:status => 422)
21
+ expect { subject.post('foo', :foo => "bar") }.to raise_error { |error| error.message.should =~ /\{\s*"foo":\s*"bar"\s*\}/ }
22
+ end
23
+
19
24
  it 'parses the body' do
20
25
  stub_request(:get, "https://api.github.com/foo").to_return(:body => '{"foo":"bar"}')
21
26
  subject['foo']['foo'].should be == 'bar'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.3
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Haase
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-05 00:00:00.000000000 Z
11
+ date: 2013-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -133,6 +133,7 @@ files:
133
133
  - .travis.yml
134
134
  - Gemfile
135
135
  - Gemfile.lock
136
+ - LICENSE
136
137
  - README.md
137
138
  - Rakefile
138
139
  - gh.gemspec
@@ -217,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
218
  version: '0'
218
219
  requirements: []
219
220
  rubyforge_project:
220
- rubygems_version: 2.0.2
221
+ rubygems_version: 2.0.5
221
222
  signing_key:
222
223
  specification_version: 4
223
224
  summary: layered github client