gh 0.2.4 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -9,15 +9,18 @@ require 'gh'
9
9
  puts GH['users/rkh']['name']
10
10
  ```
11
11
 
12
- This will by default use all the middleware that ships with GH, in the following order
12
+ This will by default use all the middleware that ships with GH, in the following order:
13
13
 
14
14
  * `GH::Remote` - sends HTTP requests to GitHub and parses the response
15
15
  * `GH::Normalizer` - renames fields consistenly, adds hypermedia links if possible
16
- * `GH::Cache` - caches the responses (will use Rails cache if in Rails, in-memory cache otherwise)
17
16
  * `GH::LazyLoader` - will load missing fields when accessed (handy for dealing with incomplete data without sending to many requests)
18
17
  * `GH::LinkFollower` - will add content of hypermedia links as fields (lazyly), allows you to traverse relations
19
18
  * `GH::MergeCommit` - adds infos about merge commits to pull request payloads
20
19
 
20
+ This middleware ships with the `gh` library but is not added by default:
21
+
22
+ * `GH::Cache` - caches the responses (will use Rails cache if in Rails, in-memory cache otherwise)
23
+
21
24
  ## Main Entry Points
22
25
 
23
26
  Every layer has two main entry points:
@@ -112,7 +115,8 @@ I hope so, we use it in production for [Travis CI](http://travis-ci.org/). The w
112
115
 
113
116
  ## History
114
117
 
115
- * 2012-04-13: 0.2.3 - added support for merge commits
118
+ * 2012-04-15: 0.3.0 - added API for posting to github, fix merge commit, disable cache by default
119
+ * 2012-04-13: 0.2.4 - added support for merge commits
116
120
  * 2012-04-12: 0.2.3 - better normalization
117
121
  * 2012-04-10: 0.2.2 - improved link following
118
122
  * 2012-04-10: 0.2.1 - bug fix release
data/gh.gemspec CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
7
7
  s.version = GH::VERSION
8
8
  s.authors = ["Konstantin Haase"]
9
9
  s.email = ["konstantin.mailinglists@googlemail.com"]
10
- s.homepage = ""
10
+ s.homepage = "http://gh.rkh.im/"
11
11
  s.summary = %q{layered github client}
12
12
  s.description = %q{multi-layer client for the github api v3}
13
13
 
data/lib/gh.rb CHANGED
@@ -3,16 +3,17 @@ require 'backports'
3
3
  require 'forwardable'
4
4
 
5
5
  module GH
6
- autoload :Cache, 'gh/cache'
7
- autoload :Case, 'gh/case'
8
- autoload :LazyLoader, 'gh/lazy_loader'
9
- autoload :LinkFollower, 'gh/link_follower'
10
- autoload :MergeCommit, 'gh/merge_commit'
11
- autoload :Normalizer, 'gh/normalizer'
12
- autoload :Remote, 'gh/remote'
13
- autoload :Response, 'gh/response'
14
- autoload :Stack, 'gh/stack'
15
- autoload :Wrapper, 'gh/wrapper'
6
+ autoload :Cache, 'gh/cache'
7
+ autoload :Case, 'gh/case'
8
+ autoload :LazyLoader, 'gh/lazy_loader'
9
+ autoload :LinkFollower, 'gh/link_follower'
10
+ autoload :MergeCommit, 'gh/merge_commit'
11
+ autoload :Normalizer, 'gh/normalizer'
12
+ autoload :Remote, 'gh/remote'
13
+ autoload :Response, 'gh/response'
14
+ autoload :ResponseWrapper, 'gh/response_wrapper'
15
+ autoload :Stack, 'gh/stack'
16
+ autoload :Wrapper, 'gh/wrapper'
16
17
 
17
18
  def self.with(backend)
18
19
  backend = DefaultStack.build(backend) if Hash === backend
@@ -31,13 +32,13 @@ module GH
31
32
  end
32
33
 
33
34
  extend SingleForwardable
34
- def_delegators :current, :api_host, :[], :reset, :load
35
+ def_delegators :current, :api_host, :[], :reset, :load, :post
35
36
 
36
37
  DefaultStack = Stack.new do
37
38
  use LinkFollower
38
39
  use MergeCommit
39
40
  use LazyLoader
40
- use Cache
41
+ #use Cache
41
42
  use Normalizer
42
43
  use Remote
43
44
  end
@@ -6,16 +6,30 @@ module GH
6
6
  wraps GH::Normalizer
7
7
  double_dispatch
8
8
 
9
+ def setup(backend, options)
10
+ @ssl = options[:ssl]
11
+ super
12
+ end
13
+
9
14
  def modify_hash(hash)
10
- hash = super
11
- setup_lazy_loading(hash) if hash.include? 'mergeable' and hash['mergeable']
12
- hash
15
+ setup_lazy_loading(super)
13
16
  end
14
17
 
15
18
  private
16
19
 
17
20
  def lazy_load(hash, key)
18
- return unless key =~ /^(merge|head)_commit$/
21
+ return unless key =~ /^(merge|head)_commit$/ and hash.include? 'mergeable'
22
+
23
+ # FIXME: Rick said "this will become part of the API"
24
+ # until then, please look the other way
25
+ while hash['mergable'].nil?
26
+ url = hash['_links']['html']['href'] + '/mergeable'
27
+ case http(:get, url).body
28
+ when "true" then hash['mergable'] = true
29
+ when "false" then hash['mergable'] = false
30
+ end
31
+ end
32
+
19
33
  link = hash['_links']['self']['href'].gsub(%r{/pulls/(\d+)$}, '/git/refs/pull/\1')
20
34
  commits = self[link].map do |data|
21
35
  ref = data['ref']
@@ -47,13 +47,17 @@ module GH
47
47
  corrected
48
48
  end
49
49
 
50
+ TIME_KEYS = %w[date timestamp committed_at created_at merged_at closed_at datetime time]
51
+ TIME_PATTERN = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\S*$/
52
+
50
53
  def modify_time(hash, key, value)
51
- return unless key == 'timestamp'
52
- time = Time.at(value)
53
- rescue TypeError
54
- time = Time.parse(value.to_s)
55
- ensure
56
- hash['date'] = time.xmlschema if time
54
+ return unless TIME_KEYS.include? key or TIME_PATTERN === value
55
+ should_be = key == 'timestamp' ? 'date' : key
56
+ raise ArgumentError if RUBY_VERSION < "1.9" and value == "" # TODO: remove this line. duh.
57
+ time = Time.at(value) rescue Time.parse(value.to_s)
58
+ hash[should_be] = time.utc.xmlschema if time
59
+ rescue ArgumentError, TypeError
60
+ hash[should_be] = value
57
61
  end
58
62
 
59
63
  def modify_user(hash)
@@ -0,0 +1,4 @@
1
+ module GH
2
+ class Pagination < Wrapper
3
+ end
4
+ end
@@ -38,7 +38,11 @@ module GH
38
38
  @prefix << "#{username}:#{password}@" if username and password
39
39
  @prefix << @api_host.host
40
40
 
41
- @connection = Faraday.new(:url => api_host) do |builder|
41
+ faraday_options = {:url => api_host}
42
+ faraday_options[:ssl] = options[:ssl] if options[:ssl]
43
+ faraday_options.merge! options[:faraday_options] if options[:faraday_options]
44
+
45
+ @connection = Faraday.new(faraday_options) do |builder|
42
46
  builder.request(:token_auth, token) if token
43
47
  builder.request(:basic_auth, username, password) if username and password
44
48
  builder.request(:retry)
@@ -62,7 +66,20 @@ module GH
62
66
  # Raises Faraday::Error::ClientError if the resource returns a status between 400 and 599.
63
67
  # Returns the Response.
64
68
  def [](key)
65
- response = connection.get(path_for(key), headers)
69
+ response = http(:get, path_for(key), headers)
70
+ modify(response.body, response.headers)
71
+ end
72
+
73
+ # Internal: ...
74
+ def http(verb, url, headers = {}, &block)
75
+ connection.run_request(verb, url, nil, headers, &block)
76
+ end
77
+
78
+ # Public: ...
79
+ def post(key, body)
80
+ response = http(:post, path_for(key), headers) do |req|
81
+ req.body = Response.new({}, body).to_s
82
+ end
66
83
  modify(response.body, response.headers)
67
84
  end
68
85
 
@@ -0,0 +1,11 @@
1
+ require 'gh'
2
+ require 'delegate'
3
+
4
+ module GH
5
+ ResponseWrapper = DelegateClass(Response) unless const_defined?
6
+ class ResponseWrapper
7
+ def to_gh
8
+ self
9
+ end
10
+ end
11
+ end
@@ -11,6 +11,8 @@ module GH
11
11
  # use GH::Remote, username: "admin", password: "admin"
12
12
  # end
13
13
  class Stack
14
+ attr_reader :options
15
+
14
16
  # Public: Generates a new wrapper stack from the given block.
15
17
  #
16
18
  # options - Hash of options that will be passed to all layers upon initialization.
@@ -1,4 +1,4 @@
1
1
  module GH
2
2
  # Public: Library version.
3
- VERSION = "0.2.4"
3
+ VERSION = "0.3.0"
4
4
  end
@@ -30,6 +30,12 @@ module GH
30
30
  # Public: Returns the URI used for sending out web request.
31
31
  def_delegator :backend, :api_host
32
32
 
33
+ # Internal: ...
34
+ def_delegator :backend, :http
35
+
36
+ # Public: ...
37
+ def_delegator :backend, :post
38
+
33
39
  # Public: Retrieves resources from Github.
34
40
  def self.[](key)
35
41
  new[key]
@@ -181,6 +187,7 @@ module GH
181
187
  fields[key]
182
188
  end
183
189
  end
190
+ hash
184
191
  end
185
192
 
186
193
  def path_for(key)
@@ -4,4 +4,11 @@ describe GH do
4
4
  it 'allows doing requests right from the GH object' do
5
5
  GH['users/rkh']['name'].should be == "Konstantin Haase"
6
6
  end
7
+
8
+ it 'allows posting to github' do
9
+ stub_request(:post, "https://api.github.com/somewhere").
10
+ with(:body => "{\"foo\":\"bar\"}").to_return(:status => 200, :body => '{"hi": "ho"}', :headers => {})
11
+ response = GH.post "somewhere", "foo" => "bar"
12
+ response['hi'].should be == 'ho'
13
+ end
7
14
  end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe GH::MergeCommit do
4
+ let(:file) { File.expand_path('../pull_request_hook.json', __FILE__) }
5
+ let(:payload) { File.read file }
6
+ let(:gh) { GH.load payload }
7
+ let(:pull_request) { gh['pull_request'] }
8
+
9
+ before do
10
+ stub_request(:get, "https://github.com/travis-repos/test-project-1/pull/1/mergeable").
11
+ to_return(:status => 200, :body => "true", :headers => {})
12
+ end
13
+
14
+ it 'adds merge commits' do
15
+ pull_request['merge_commit']['sha'].should_not be_nil
16
+ end
17
+ end
@@ -208,12 +208,27 @@ describe GH::Normalizer do
208
208
  context 'time' do
209
209
  it 'transforms timestamps stored in "timestamp" to a date in "date"' do
210
210
  normalize 'timestamp' => 1234
211
- normalized['date'].should be == Time.at(1234).xmlschema
211
+ normalized['date'].should be == "1970-01-01T00:20:34Z"
212
212
  end
213
213
 
214
214
  it 'transforms dates stored in "timestamp" to a date in "date"' do
215
215
  normalize 'timestamp' => "2012-04-12T17:29:51+02:00"
216
- normalized['date'].should be == Time.parse("2012-04-12T17:29:51+02:00").xmlschema
216
+ normalized['date'].should be == "2012-04-12T15:29:51Z"
217
+ end
218
+
219
+ it 'changes date to UTC' do
220
+ normalize 'date' => "2012-04-12T17:29:51+02:00"
221
+ normalized['date'].should be == "2012-04-12T15:29:51Z"
222
+ end
223
+
224
+ it 'changes any time entry to UTC' do
225
+ normalize 'foo' => "2012-04-12T17:29:51+02:00"
226
+ normalized['foo'].should be == "2012-04-12T15:29:51Z"
227
+ end
228
+
229
+ it 'does not choke on empty values' do
230
+ normalize 'date' => ""
231
+ normalized['date'].should be == ""
217
232
  end
218
233
  end
219
234
 
@@ -0,0 +1,23 @@
1
+ ---
2
+ - !binary "c2VydmVy": !binary |-
3
+ bmdpbngvMS4wLjEz
4
+ !binary "ZGF0ZQ==": !binary |-
5
+ RnJpLCAxMyBBcHIgMjAxMiAxNDowNjo1OSBHTVQ=
6
+ !binary "Y29udGVudC10eXBl": !binary |-
7
+ YXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOA==
8
+ !binary "dHJhbnNmZXItZW5jb2Rpbmc=": !binary |-
9
+ Y2h1bmtlZA==
10
+ !binary "Y29ubmVjdGlvbg==": !binary |-
11
+ a2VlcC1hbGl2ZQ==
12
+ !binary "c3RhdHVz": !binary |-
13
+ MjAwIE9L
14
+ !binary "eC1yYXRlbGltaXQtbGltaXQ=": !binary |-
15
+ NTAwMA==
16
+ !binary "ZXRhZw==": !binary |-
17
+ ImFjM2FmYzYzZWEyMDlkMzYxOWFhNDM3NDU3NTA1OWQ4Ig==
18
+ !binary "eC1yYXRlbGltaXQtcmVtYWluaW5n": !binary |-
19
+ NDk4OA==
20
+ - ! '{"pushed_at":"2012-04-13T11:02:59Z","homepage":"http://travis-ci.org","svn_url":"https://github.com/rkh/test-project-1","source":{"pushed_at":"2012-04-11T15:50:22Z","homepage":"http://travis-ci.org","svn_url":"https://github.com/travis-repos/test-project-1","has_issues":false,"updated_at":"2012-04-11T15:50:22Z","forks":6,"has_downloads":true,"ssh_url":"git@github.com:travis-repos/test-project-1.git","git_url":"git://github.com/travis-repos/test-project-1.git","language":"Ruby","clone_url":"https://github.com/travis-repos/test-project-1.git","fork":false,"mirror_url":null,"created_at":"2011-04-14T18:23:41Z","url":"https://api.github.com/repos/travis-repos/test-project-1","has_wiki":false,"size":140,"private":false,"description":"Test
21
+ dummy repository for testing Travis CI","owner":{"gravatar_id":"dad32d44d4850d2bc9485ee115ab4227","url":"https://api.github.com/users/travis-repos","avatar_url":"https://secure.gravatar.com/avatar/dad32d44d4850d2bc9485ee115ab4227?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","id":864347,"login":"travis-repos"},"name":"test-project-1","watchers":8,"html_url":"https://github.com/travis-repos/test-project-1","id":1615549,"open_issues":3},"has_issues":false,"updated_at":"2012-04-13T11:02:59Z","forks":0,"has_downloads":true,"ssh_url":"git@github.com:rkh/test-project-1.git","git_url":"git://github.com/rkh/test-project-1.git","parent":{"pushed_at":"2012-04-11T15:50:22Z","homepage":"http://travis-ci.org","svn_url":"https://github.com/travis-repos/test-project-1","has_issues":false,"updated_at":"2012-04-11T15:50:22Z","forks":6,"has_downloads":true,"ssh_url":"git@github.com:travis-repos/test-project-1.git","git_url":"git://github.com/travis-repos/test-project-1.git","language":"Ruby","clone_url":"https://github.com/travis-repos/test-project-1.git","fork":false,"mirror_url":null,"created_at":"2011-04-14T18:23:41Z","url":"https://api.github.com/repos/travis-repos/test-project-1","has_wiki":false,"size":140,"private":false,"description":"Test
22
+ dummy repository for testing Travis CI","owner":{"gravatar_id":"dad32d44d4850d2bc9485ee115ab4227","url":"https://api.github.com/users/travis-repos","avatar_url":"https://secure.gravatar.com/avatar/dad32d44d4850d2bc9485ee115ab4227?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","id":864347,"login":"travis-repos"},"name":"test-project-1","watchers":8,"html_url":"https://github.com/travis-repos/test-project-1","id":1615549,"open_issues":3},"language":"Ruby","clone_url":"https://github.com/rkh/test-project-1.git","fork":true,"mirror_url":null,"created_at":"2012-02-13T15:17:57Z","url":"https://api.github.com/repos/rkh/test-project-1","has_wiki":true,"size":116,"private":false,"description":"Test
23
+ dummy repository for testing Travis CI","owner":{"gravatar_id":"5c2b452f6eea4a6d84c105ebd971d2a4","url":"https://api.github.com/users/rkh","avatar_url":"https://secure.gravatar.com/avatar/5c2b452f6eea4a6d84c105ebd971d2a4?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","id":30442,"login":"rkh"},"name":"test-project-1","watchers":1,"html_url":"https://github.com/rkh/test-project-1","id":3431064,"open_issues":0}'
@@ -0,0 +1,21 @@
1
+ ---
2
+ - !binary "c2VydmVy": !binary |-
3
+ bmdpbngvMS4wLjEz
4
+ !binary "ZGF0ZQ==": !binary |-
5
+ RnJpLCAxMyBBcHIgMjAxMiAxNDowNjo1OSBHTVQ=
6
+ !binary "Y29udGVudC10eXBl": !binary |-
7
+ YXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOA==
8
+ !binary "dHJhbnNmZXItZW5jb2Rpbmc=": !binary |-
9
+ Y2h1bmtlZA==
10
+ !binary "Y29ubmVjdGlvbg==": !binary |-
11
+ a2VlcC1hbGl2ZQ==
12
+ !binary "c3RhdHVz": !binary |-
13
+ MjAwIE9L
14
+ !binary "eC1yYXRlbGltaXQtbGltaXQ=": !binary |-
15
+ NTAwMA==
16
+ !binary "ZXRhZw==": !binary |-
17
+ IjczYzFhNzljMGI5MGJkYTFiNGMxOTY5ZDdhNzVmMzc3Ig==
18
+ !binary "eC1yYXRlbGltaXQtcmVtYWluaW5n": !binary |-
19
+ NDk4OQ==
20
+ - ! '{"pushed_at":"2012-04-11T15:50:22Z","homepage":"http://travis-ci.org","svn_url":"https://github.com/travis-repos/test-project-1","has_issues":false,"updated_at":"2012-04-11T15:50:22Z","forks":6,"has_downloads":true,"ssh_url":"git@github.com:travis-repos/test-project-1.git","git_url":"git://github.com/travis-repos/test-project-1.git","language":"Ruby","clone_url":"https://github.com/travis-repos/test-project-1.git","organization":{"gravatar_id":"dad32d44d4850d2bc9485ee115ab4227","url":"https://api.github.com/users/travis-repos","avatar_url":"https://secure.gravatar.com/avatar/dad32d44d4850d2bc9485ee115ab4227?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","id":864347,"login":"travis-repos"},"fork":false,"mirror_url":null,"created_at":"2011-04-14T18:23:41Z","url":"https://api.github.com/repos/travis-repos/test-project-1","has_wiki":false,"size":140,"private":false,"description":"Test
21
+ dummy repository for testing Travis CI","owner":{"gravatar_id":"dad32d44d4850d2bc9485ee115ab4227","url":"https://api.github.com/users/travis-repos","avatar_url":"https://secure.gravatar.com/avatar/dad32d44d4850d2bc9485ee115ab4227?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","id":864347,"login":"travis-repos"},"name":"test-project-1","watchers":8,"html_url":"https://github.com/travis-repos/test-project-1","id":1615549,"open_issues":3}'
@@ -0,0 +1,20 @@
1
+ ---
2
+ - !binary "c2VydmVy": !binary |-
3
+ bmdpbngvMS4wLjEz
4
+ !binary "ZGF0ZQ==": !binary |-
5
+ RnJpLCAxMyBBcHIgMjAxMiAxNDoyMDo1OCBHTVQ=
6
+ !binary "Y29udGVudC10eXBl": !binary |-
7
+ YXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOA==
8
+ !binary "dHJhbnNmZXItZW5jb2Rpbmc=": !binary |-
9
+ Y2h1bmtlZA==
10
+ !binary "Y29ubmVjdGlvbg==": !binary |-
11
+ a2VlcC1hbGl2ZQ==
12
+ !binary "c3RhdHVz": !binary |-
13
+ MjAwIE9L
14
+ !binary "eC1yYXRlbGltaXQtbGltaXQ=": !binary |-
15
+ NTAwMA==
16
+ !binary "ZXRhZw==": !binary |-
17
+ ImY4OTFjOGE4Y2FmYmY3ZTUzMTNhMThiN2M1NDY2MTE4Ig==
18
+ !binary "eC1yYXRlbGltaXQtcmVtYWluaW5n": !binary |-
19
+ NDk4Ng==
20
+ - ! '[{"object":{"type":"commit","sha":"01eae10530ca65b51474b2d950365967ebdf3023","url":"https://api.github.com/repos/travis-repos/test-project-1/git/commits/01eae10530ca65b51474b2d950365967ebdf3023"},"url":"https://api.github.com/repos/travis-repos/test-project-1/git/refs/pull/1/head","ref":"refs/pull/1/head"},{"object":{"type":"commit","sha":"ca3c0a44ec1d9bf8557d2653aa1b79fcc9ff5f5d","url":"https://api.github.com/repos/travis-repos/test-project-1/git/commits/ca3c0a44ec1d9bf8557d2653aa1b79fcc9ff5f5d"},"url":"https://api.github.com/repos/travis-repos/test-project-1/git/refs/pull/1/merge","ref":"refs/pull/1/merge"}]'
@@ -0,0 +1,24 @@
1
+ ---
2
+ - !binary "c2VydmVy": !binary |-
3
+ bmdpbngvMS4wLjEz
4
+ !binary "ZGF0ZQ==": !binary |-
5
+ RnJpLCAxMyBBcHIgMjAxMiAxNDoxOToxMSBHTVQ=
6
+ !binary "Y29udGVudC10eXBl": !binary |-
7
+ YXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOA==
8
+ !binary "dHJhbnNmZXItZW5jb2Rpbmc=": !binary |-
9
+ Y2h1bmtlZA==
10
+ !binary "Y29ubmVjdGlvbg==": !binary |-
11
+ a2VlcC1hbGl2ZQ==
12
+ !binary "c3RhdHVz": !binary |-
13
+ MjAwIE9L
14
+ !binary "eC1yYXRlbGltaXQtbGltaXQ=": !binary |-
15
+ NTAwMA==
16
+ !binary "ZXRhZw==": !binary |-
17
+ IjdmYzRhYTU2Y2ExZTk1ZWY4MjY4NWY0MDA1Y2U5OTJmIg==
18
+ !binary "eC1yYXRlbGltaXQtcmVtYWluaW5n": !binary |-
19
+ NDk4Nw==
20
+ - ! '{"deletions":3,"issue_url":"https://github.com/travis-repos/test-project-1/issues/1","merged_by":null,"comments":0,"updated_at":"2012-04-13T13:35:24Z","state":"open","_links":{"comments":{"href":"https://api.github.com/repos/travis-repos/test-project-1/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/travis-repos/test-project-1/pulls/1/comments"},"self":{"href":"https://api.github.com/repos/travis-repos/test-project-1/pulls/1"},"html":{"href":"https://github.com/travis-repos/test-project-1/pull/1"}},"diff_url":"https://github.com/travis-repos/test-project-1/pull/1.diff","changed_files":2,"merged_at":null,"user":{"gravatar_id":"5c2b452f6eea4a6d84c105ebd971d2a4","avatar_url":"https://secure.gravatar.com/avatar/5c2b452f6eea4a6d84c105ebd971d2a4?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/rkh","id":30442,"login":"rkh"},"commits":3,"title":"PLEASE
21
+ DO NOT TOUCH THIS PULL REQUEST","merged":false,"closed_at":null,"created_at":"2012-02-14T14:00:48Z","url":"https://api.github.com/repos/travis-repos/test-project-1/pulls/1","base":{"repo":{"homepage":"http://travis-ci.org","has_wiki":false,"has_issues":false,"updated_at":"2012-04-11T15:50:22Z","forks":6,"svn_url":"https://github.com/travis-repos/test-project-1","ssh_url":"git@github.com:travis-repos/test-project-1.git","language":"Ruby","open_issues":3,"fork":false,"clone_url":"https://github.com/travis-repos/test-project-1.git","git_url":"git://github.com/travis-repos/test-project-1.git","pushed_at":"2012-04-11T15:50:22Z","created_at":"2011-04-14T18:23:41Z","url":"https://api.github.com/repos/travis-repos/test-project-1","size":140,"private":false,"mirror_url":null,"description":"Test
22
+ dummy repository for testing Travis CI","owner":{"gravatar_id":"dad32d44d4850d2bc9485ee115ab4227","avatar_url":"https://secure.gravatar.com/avatar/dad32d44d4850d2bc9485ee115ab4227?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","url":"https://api.github.com/users/travis-repos","id":864347,"login":"travis-repos"},"name":"test-project-1","has_downloads":true,"watchers":8,"html_url":"https://github.com/travis-repos/test-project-1","id":1615549},"sha":"4a90c0ad9187c8735e1bcbf39a0291a21284994a","label":"travis-repos:master","user":{"gravatar_id":"dad32d44d4850d2bc9485ee115ab4227","avatar_url":"https://secure.gravatar.com/avatar/dad32d44d4850d2bc9485ee115ab4227?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","url":"https://api.github.com/users/travis-repos","id":864347,"login":"travis-repos"},"ref":"master"},"number":1,"patch_url":"https://github.com/travis-repos/test-project-1/pull/1.patch","review_comments":0,"head":{"repo":{"homepage":"http://travis-ci.org","has_wiki":true,"has_issues":false,"updated_at":"2012-04-13T11:02:59Z","forks":0,"svn_url":"https://github.com/rkh/test-project-1","ssh_url":"git@github.com:rkh/test-project-1.git","language":"Ruby","open_issues":0,"fork":true,"clone_url":"https://github.com/rkh/test-project-1.git","git_url":"git://github.com/rkh/test-project-1.git","pushed_at":"2012-04-13T11:02:59Z","created_at":"2012-02-13T15:17:57Z","url":"https://api.github.com/repos/rkh/test-project-1","size":116,"private":false,"mirror_url":null,"description":"Test
23
+ dummy repository for testing Travis CI","owner":{"gravatar_id":"5c2b452f6eea4a6d84c105ebd971d2a4","avatar_url":"https://secure.gravatar.com/avatar/5c2b452f6eea4a6d84c105ebd971d2a4?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/rkh","id":30442,"login":"rkh"},"name":"test-project-1","has_downloads":true,"watchers":1,"html_url":"https://github.com/rkh/test-project-1","id":3431064},"sha":"01eae10530ca65b51474b2d950365967ebdf3023","label":"rkh:master","user":{"gravatar_id":"5c2b452f6eea4a6d84c105ebd971d2a4","avatar_url":"https://secure.gravatar.com/avatar/5c2b452f6eea4a6d84c105ebd971d2a4?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/rkh","id":30442,"login":"rkh"},"ref":"master"},"body":"please
24
+ do not touch. we are using this pull request to generate fixtures for tests\r\n\r\nkthxbai","html_url":"https://github.com/travis-repos/test-project-1/pull/1","id":826379,"mergeable":true,"additions":3}'
@@ -0,0 +1,21 @@
1
+ ---
2
+ - !binary "c2VydmVy": !binary |-
3
+ bmdpbngvMS4wLjEz
4
+ !binary "ZGF0ZQ==": !binary |-
5
+ RnJpLCAxMyBBcHIgMjAxMiAxNDowNjo1OCBHTVQ=
6
+ !binary "Y29udGVudC10eXBl": !binary |-
7
+ YXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOA==
8
+ !binary "dHJhbnNmZXItZW5jb2Rpbmc=": !binary |-
9
+ Y2h1bmtlZA==
10
+ !binary "Y29ubmVjdGlvbg==": !binary |-
11
+ a2VlcC1hbGl2ZQ==
12
+ !binary "c3RhdHVz": !binary |-
13
+ MjAwIE9L
14
+ !binary "eC1yYXRlbGltaXQtbGltaXQ=": !binary |-
15
+ NTAwMA==
16
+ !binary "ZXRhZw==": !binary |-
17
+ ImNkMzI3YTA4NGIyZDVjZmNjMzkzMzJjM2I4NjA3OTcxIg==
18
+ !binary "eC1yYXRlbGltaXQtcmVtYWluaW5n": !binary |-
19
+ NDk5MA==
20
+ - ! '{"type":"Organization","public_repos":51,"location":null,"avatar_url":"https://secure.gravatar.com/avatar/dad32d44d4850d2bc9485ee115ab4227?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","public_gists":0,"created_at":"2011-06-21T13:46:24Z","email":null,"url":"https://api.github.com/orgs/travis-repos","company":null,"name":"Travis
21
+ Repositories","html_url":"https://github.com/travis-repos","blog":null,"id":864347,"followers":0,"following":0,"login":"travis-repos"}'
@@ -0,0 +1 @@
1
+ {"number":1,"repository":{"name":"test-project-1","created_at":"2011-04-14T18:23:41Z","size":140,"has_wiki":false,"clone_url":"https://github.com/travis-repos/test-project-1.git","updated_at":"2012-04-11T15:50:22Z","private":false,"watchers":8,"url":"https://api.github.com/repos/travis-repos/test-project-1","git_url":"git://github.com/travis-repos/test-project-1.git","ssh_url":"git@github.com:travis-repos/test-project-1.git","fork":false,"language":"Ruby","id":1615549,"pushed_at":"2012-04-11T15:50:22Z","svn_url":"https://github.com/travis-repos/test-project-1","mirror_url":null,"open_issues":3,"has_downloads":true,"has_issues":false,"homepage":"http://travis-ci.org","description":"Test dummy repository for testing Travis CI","forks":6,"html_url":"https://github.com/travis-repos/test-project-1","owner":{"gravatar_id":"dad32d44d4850d2bc9485ee115ab4227","avatar_url":"https://secure.gravatar.com/avatar/dad32d44d4850d2bc9485ee115ab4227?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","url":"https://api.github.com/users/travis-repos","id":864347,"login":"travis-repos"}},"pull_request":{"number":1,"issue_url":"https://github.com/travis-repos/test-project-1/issues/1","head":{"label":"rkh:master","repo":{"name":"test-project-1","has_wiki":true,"size":116,"created_at":"2012-02-13T15:17:57Z","clone_url":"https://github.com/rkh/test-project-1.git","watchers":1,"private":false,"updated_at":"2012-04-13T11:02:59Z","git_url":"git://github.com/rkh/test-project-1.git","language":"Ruby","fork":true,"ssh_url":"git@github.com:rkh/test-project-1.git","url":"https://api.github.com/repos/rkh/test-project-1","pushed_at":"2012-04-13T11:02:59Z","svn_url":"https://github.com/rkh/test-project-1","id":3431064,"open_issues":0,"has_downloads":true,"mirror_url":null,"homepage":"http://travis-ci.org","has_issues":false,"forks":0,"description":"Test dummy repository for testing Travis CI","html_url":"https://github.com/rkh/test-project-1","owner":{"avatar_url":"https://secure.gravatar.com/avatar/5c2b452f6eea4a6d84c105ebd971d2a4?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"5c2b452f6eea4a6d84c105ebd971d2a4","url":"https://api.github.com/users/rkh","id":30442,"login":"rkh"}},"sha":"01eae10530ca65b51474b2d950365967ebdf3023","ref":"master","user":{"avatar_url":"https://secure.gravatar.com/avatar/5c2b452f6eea4a6d84c105ebd971d2a4?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"5c2b452f6eea4a6d84c105ebd971d2a4","url":"https://api.github.com/users/rkh","id":30442,"login":"rkh"}},"changed_files":2,"merged_by":null,"merged":false,"created_at":"2012-02-14T14:00:48Z","comments":0,"title":"PLEASE DO NOT TOUCH THIS PULL REQUEST","body":"please do not touch. we are using this pull request to generate fixtures for tests kthxbai","additions":3,"updated_at":"2012-04-13T13:35:24Z","diff_url":"https://github.com/travis-repos/test-project-1/pull/1.diff","_links":{"html":{"href":"https://github.com/travis-repos/test-project-1/pull/1"},"self":{"href":"https://api.github.com/repos/travis-repos/test-project-1/pulls/1"},"comments":{"href":"https://api.github.com/repos/travis-repos/test-project-1/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/travis-repos/test-project-1/pulls/1/comments"}},"url":"https://api.github.com/repos/travis-repos/test-project-1/pulls/1","id":826379,"patch_url":"https://github.com/travis-repos/test-project-1/pull/1.patch","mergeable":null,"closed_at":null,"commits":3,"merged_at":null,"html_url":"https://github.com/travis-repos/test-project-1/pull/1","review_comments":0,"user":{"avatar_url":"https://secure.gravatar.com/avatar/5c2b452f6eea4a6d84c105ebd971d2a4?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"5c2b452f6eea4a6d84c105ebd971d2a4","url":"https://api.github.com/users/rkh","id":30442,"login":"rkh"},"deletions":3,"state":"open","base":{"label":"travis-repos:master","repo":{"name":"test-project-1","has_wiki":false,"size":140,"created_at":"2011-04-14T18:23:41Z","clone_url":"https://github.com/travis-repos/test-project-1.git","watchers":8,"private":false,"updated_at":"2012-04-11T15:50:22Z","git_url":"git://github.com/travis-repos/test-project-1.git","language":"Ruby","fork":false,"ssh_url":"git@github.com:travis-repos/test-project-1.git","url":"https://api.github.com/repos/travis-repos/test-project-1","pushed_at":"2012-04-11T15:50:22Z","svn_url":"https://github.com/travis-repos/test-project-1","id":1615549,"open_issues":3,"has_downloads":true,"mirror_url":null,"homepage":"http://travis-ci.org","has_issues":false,"forks":6,"description":"Test dummy repository for testing Travis CI","html_url":"https://github.com/travis-repos/test-project-1","owner":{"avatar_url":"https://secure.gravatar.com/avatar/dad32d44d4850d2bc9485ee115ab4227?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","gravatar_id":"dad32d44d4850d2bc9485ee115ab4227","url":"https://api.github.com/users/travis-repos","id":864347,"login":"travis-repos"}},"sha":"4a90c0ad9187c8735e1bcbf39a0291a21284994a","ref":"master","user":{"avatar_url":"https://secure.gravatar.com/avatar/dad32d44d4850d2bc9485ee115ab4227?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","gravatar_id":"dad32d44d4850d2bc9485ee115ab4227","url":"https://api.github.com/users/travis-repos","id":864347,"login":"travis-repos"}}},"sender":{"gravatar_id":"5c2b452f6eea4a6d84c105ebd971d2a4","avatar_url":"https://secure.gravatar.com/avatar/5c2b452f6eea4a6d84c105ebd971d2a4?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/rkh","id":30442,"login":"rkh"},"action":"synchronize"}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-12 00:00:00.000000000 Z
12
+ date: 2012-04-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70165430138860 !ruby/object:Gem::Requirement
16
+ requirement: &70094428645420 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70165430138860
24
+ version_requirements: *70094428645420
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: webmock
27
- requirement: &70165430138420 !ruby/object:Gem::Requirement
27
+ requirement: &70094428644560 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70165430138420
35
+ version_requirements: *70094428644560
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: faraday
38
- requirement: &70165430137880 !ruby/object:Gem::Requirement
38
+ requirement: &70094428644060 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0.7'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70165430137880
46
+ version_requirements: *70094428644060
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: backports
49
- requirement: &70165430137340 !ruby/object:Gem::Requirement
49
+ requirement: &70094428643520 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '2.3'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70165430137340
57
+ version_requirements: *70094428643520
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: multi_json
60
- requirement: &70165430136480 !ruby/object:Gem::Requirement
60
+ requirement: &70094428643060 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '1.0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70165430136480
68
+ version_requirements: *70094428643060
69
69
  description: multi-layer client for the github api v3
70
70
  email:
71
71
  - konstantin.mailinglists@googlemail.com
@@ -87,8 +87,10 @@ files:
87
87
  - lib/gh/link_follower.rb
88
88
  - lib/gh/merge_commit.rb
89
89
  - lib/gh/normalizer.rb
90
+ - lib/gh/pagination.rb
90
91
  - lib/gh/remote.rb
91
92
  - lib/gh/response.rb
93
+ - lib/gh/response_wrapper.rb
92
94
  - lib/gh/stack.rb
93
95
  - lib/gh/version.rb
94
96
  - lib/gh/wrapper.rb
@@ -96,19 +98,26 @@ files:
96
98
  - spec/gh_spec.rb
97
99
  - spec/lazy_loader_spec.rb
98
100
  - spec/link_follower_spec.rb
101
+ - spec/merge_commit_spec.rb
99
102
  - spec/normalizer_spec.rb
103
+ - spec/payloads/repos/rkh/test-project-1.yml
100
104
  - spec/payloads/repos/sinatra/sinatra/issues/56/comments.yml
101
105
  - spec/payloads/repos/sinatra/sinatra/issues/comments/383214.yml
102
106
  - spec/payloads/repos/sinatra/sinatra/pulls/56.yml
107
+ - spec/payloads/repos/travis-repos/test-project-1.yml
108
+ - spec/payloads/repos/travis-repos/test-project-1/git/refs/pull/1.yml
109
+ - spec/payloads/repos/travis-repos/test-project-1/pulls/1.yml
103
110
  - spec/payloads/users/rkh.yml
104
111
  - spec/payloads/users/rtomayko.yml
105
112
  - spec/payloads/users/svenfuchs.yml
113
+ - spec/payloads/users/travis-repos.yml
114
+ - spec/pull_request_hook.json
106
115
  - spec/remote_spec.rb
107
116
  - spec/response_spec.rb
108
117
  - spec/spec_helper.rb
109
118
  - spec/stack_spec.rb
110
119
  - spec/wrapper_spec.rb
111
- homepage: ''
120
+ homepage: http://gh.rkh.im/
112
121
  licenses: []
113
122
  post_install_message:
114
123
  rdoc_options: []
@@ -137,13 +146,20 @@ test_files:
137
146
  - spec/gh_spec.rb
138
147
  - spec/lazy_loader_spec.rb
139
148
  - spec/link_follower_spec.rb
149
+ - spec/merge_commit_spec.rb
140
150
  - spec/normalizer_spec.rb
151
+ - spec/payloads/repos/rkh/test-project-1.yml
141
152
  - spec/payloads/repos/sinatra/sinatra/issues/56/comments.yml
142
153
  - spec/payloads/repos/sinatra/sinatra/issues/comments/383214.yml
143
154
  - spec/payloads/repos/sinatra/sinatra/pulls/56.yml
155
+ - spec/payloads/repos/travis-repos/test-project-1.yml
156
+ - spec/payloads/repos/travis-repos/test-project-1/git/refs/pull/1.yml
157
+ - spec/payloads/repos/travis-repos/test-project-1/pulls/1.yml
144
158
  - spec/payloads/users/rkh.yml
145
159
  - spec/payloads/users/rtomayko.yml
146
160
  - spec/payloads/users/svenfuchs.yml
161
+ - spec/payloads/users/travis-repos.yml
162
+ - spec/pull_request_hook.json
147
163
  - spec/remote_spec.rb
148
164
  - spec/response_spec.rb
149
165
  - spec/spec_helper.rb