ghee 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -15,7 +15,7 @@ Instantiate the client with auth token:
15
15
 
16
16
  Create an OAuth access token:
17
17
 
18
- user_name, password, scopes = "rauhryan", "secret", "repos, user"
18
+ user_name, password, scopes = "rauhryan", "secret", ["user","repos"]
19
19
  token = Ghee.create_token(user_name, password, scopes)
20
20
 
21
21
  ## Gists
@@ -87,6 +87,46 @@ Get a single repo:
87
87
 
88
88
  gh.repos("rauhryan", "ghee")
89
89
 
90
+ ### Pulls
91
+
92
+ List pull requests on a repo (see [List pull requests](http://developer.github.com/v3/pulls/#list-pull-requests) )
93
+
94
+
95
+ gh.repos("rauhryan", "ghee").pulls
96
+
97
+ gh.repos("rauhryan", "ghee").pulls({
98
+ :state => "closed" # optional
99
+ })
100
+
101
+ Get a single pull request on a repo (see [Get a single pull request](http://developer.github.com/v3/pulls/#get-a-single-pull-request) )
102
+
103
+ gh.repos("rauhryan", "ghee").pulls(1097)
104
+
105
+ Create a pull request (see [Create a pull request](http://developer.github.com/v3/pulls/#create-a-pull-request) )
106
+
107
+ gh.repos("rauhryan", "ghee").pulls.create({:title=>"take my awesome code!", :body=>"This code is so awesome. Let me tell you why...", :base=>"master", :head=>"octocat:awesomebranch")
108
+
109
+ Update a pull request (see [Update a pull request](http://developer.github.com/v3/pulls/#update-a-pull-request) )
110
+
111
+ gh.repos("rauhryan", "ghee").pulls(1097).patch({:title=>"New title", :body=>"New body", :state=>"closed"})
112
+
113
+ List commits on a pull request (see [List commits a pull request](http://developer.github.com/v3/pulls/#list-commits-on-a-pull-request) )
114
+
115
+ gh.repos("rauhryan", "ghee").pulls(1097).commits
116
+
117
+ List files on a pull request (see [List files a pull request](http://developer.github.com/v3/pulls/#list-pull-requests-files) )
118
+
119
+ gh.repos("rauhryan", "ghee").pulls(1097).files
120
+
121
+ Get if a pull request has been merged (see [Get if a pull request has been merged](http://developer.github.com/v3/pulls/#get-if-a-pull-request-has-been-merged) )
122
+
123
+ gh.repos("rauhryan", "ghee").pulls(1097).merged? #=> true
124
+
125
+ Merge a pull request (see [Merge a pull request](http://developer.github.com/v3/pulls/#merge-a-pull-request-merge-buttontrade) )
126
+
127
+ gh.repos("rauhryan", "ghee").pulls(1097).merge!
128
+ gh.repos("rauhryan", "ghee").pulls(1097).merge!("It's like hitting the Merge Button(TM)")
129
+
90
130
  ### Commits
91
131
 
92
132
  List commits on a repo:
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
23
23
  s.add_runtime_dependency 'multi_json'
24
24
  s.add_runtime_dependency 'yajl-ruby'
25
25
  s.add_development_dependency 'rake'
26
- s.add_development_dependency 'json'
26
+ s.add_development_dependency 'json_pure'
27
27
  s.add_development_dependency 'rspec', '~>2.0'
28
28
  s.add_development_dependency 'webmock'
29
29
  s.add_development_dependency 'vcr'
@@ -22,6 +22,7 @@ require 'ghee/api/keys'
22
22
  require 'ghee/api/watchers'
23
23
  require 'ghee/api/emails'
24
24
  require 'ghee/api/followers'
25
+ require 'ghee/api/pulls'
25
26
 
26
27
  class Ghee
27
28
  attr_reader :connection
@@ -14,7 +14,9 @@ class Ghee
14
14
  end
15
15
 
16
16
  def remove(emails)
17
- connection.run_request(:delete,path_prefix, emails,nil).status == 204
17
+ connection.delete(path_prefix) do |req|
18
+ req.body = emails
19
+ end.status == 204
18
20
  end
19
21
  end
20
22
  end
@@ -0,0 +1,49 @@
1
+ class Ghee
2
+
3
+ # API module encapsulates all of API endpoints
4
+ # implemented thus far
5
+ #
6
+ module API
7
+
8
+ # The Repos module handles all of the Github Repo
9
+ # API endpoints
10
+ #
11
+ module Repos
12
+
13
+ module Pulls
14
+ class Proxy < ::Ghee::ResourceProxy
15
+ include Ghee::CUD
16
+
17
+ def commits
18
+ connection.get("#{path_prefix}/commits").body
19
+ end
20
+
21
+ def files
22
+ connection.get("#{path_prefix}/files").body
23
+ end
24
+
25
+ def merge?
26
+ connection.get("#{path_prefix}/merge").status == 204
27
+ end
28
+
29
+ def merge!(message=nil)
30
+ params = message ? {:commit_message=>message} : {}
31
+ connection.put("#{path_prefix}/merge", params).body
32
+ end
33
+ end
34
+ end
35
+
36
+ # Gists::Proxy inherits from Ghee::Proxy and
37
+ # enables defining methods on the proxy object
38
+ #
39
+ class Proxy < ::Ghee::ResourceProxy
40
+ def pulls(number=nil, params={})
41
+ params = number if number.is_a?Hash
42
+ prefix = (!number.is_a?(Hash) and number) ? "#{path_prefix}/pulls/#{number}" : "#{path_prefix}/pulls"
43
+ Ghee::API::Repos::Pulls::Proxy.new(connection, prefix, params)
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+
@@ -1,4 +1,4 @@
1
1
  # encoding: UTF-8
2
2
  class Ghee
3
- VERSION = "0.9.0"
3
+ VERSION = "0.9.1"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ghee
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-04-14 00:00:00.000000000Z
13
+ date: 2012-04-21 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: faraday
17
- requirement: &70292263270720 !ruby/object:Gem::Requirement
17
+ requirement: &70256779529360 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70292263270720
25
+ version_requirements: *70256779529360
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: faraday_middleware
28
- requirement: &70292263270280 !ruby/object:Gem::Requirement
28
+ requirement: &70256779528920 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *70292263270280
36
+ version_requirements: *70256779528920
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: multi_json
39
- requirement: &70292263269860 !ruby/object:Gem::Requirement
39
+ requirement: &70256779528500 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0'
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *70292263269860
47
+ version_requirements: *70256779528500
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: yajl-ruby
50
- requirement: &70292263269440 !ruby/object:Gem::Requirement
50
+ requirement: &70256779528080 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: '0'
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *70292263269440
58
+ version_requirements: *70256779528080
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: rake
61
- requirement: &70292263269020 !ruby/object:Gem::Requirement
61
+ requirement: &70256779527660 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: '0'
67
67
  type: :development
68
68
  prerelease: false
69
- version_requirements: *70292263269020
69
+ version_requirements: *70256779527660
70
70
  - !ruby/object:Gem::Dependency
71
- name: json
72
- requirement: &70292263268600 !ruby/object:Gem::Requirement
71
+ name: json_pure
72
+ requirement: &70256779527240 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ! '>='
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: '0'
78
78
  type: :development
79
79
  prerelease: false
80
- version_requirements: *70292263268600
80
+ version_requirements: *70256779527240
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: rspec
83
- requirement: &70292263268100 !ruby/object:Gem::Requirement
83
+ requirement: &70256779526740 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ~>
@@ -88,10 +88,10 @@ dependencies:
88
88
  version: '2.0'
89
89
  type: :development
90
90
  prerelease: false
91
- version_requirements: *70292263268100
91
+ version_requirements: *70256779526740
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: webmock
94
- requirement: &70292263267680 !ruby/object:Gem::Requirement
94
+ requirement: &70256779526320 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - ! '>='
@@ -99,10 +99,10 @@ dependencies:
99
99
  version: '0'
100
100
  type: :development
101
101
  prerelease: false
102
- version_requirements: *70292263267680
102
+ version_requirements: *70256779526320
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: vcr
105
- requirement: &70292263267220 !ruby/object:Gem::Requirement
105
+ requirement: &70256779525860 !ruby/object:Gem::Requirement
106
106
  none: false
107
107
  requirements:
108
108
  - - ! '>='
@@ -110,10 +110,10 @@ dependencies:
110
110
  version: '0'
111
111
  type: :development
112
112
  prerelease: false
113
- version_requirements: *70292263267220
113
+ version_requirements: *70256779525860
114
114
  - !ruby/object:Gem::Dependency
115
115
  name: ZenTest
116
- requirement: &70292257168360 !ruby/object:Gem::Requirement
116
+ requirement: &70256779525440 !ruby/object:Gem::Requirement
117
117
  none: false
118
118
  requirements:
119
119
  - - ! '>='
@@ -121,10 +121,10 @@ dependencies:
121
121
  version: '0'
122
122
  type: :development
123
123
  prerelease: false
124
- version_requirements: *70292257168360
124
+ version_requirements: *70256779525440
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: autotest-growl
127
- requirement: &70292257167940 !ruby/object:Gem::Requirement
127
+ requirement: &70256779525020 !ruby/object:Gem::Requirement
128
128
  none: false
129
129
  requirements:
130
130
  - - ! '>='
@@ -132,7 +132,7 @@ dependencies:
132
132
  version: '0'
133
133
  type: :development
134
134
  prerelease: false
135
- version_requirements: *70292257167940
135
+ version_requirements: *70256779525020
136
136
  description: A complete, simple, and intuitive ruby API for all things Github.
137
137
  email:
138
138
  - rauh.ryan@gmail.com
@@ -165,6 +165,7 @@ files:
165
165
  - lib/ghee/api/labels.rb
166
166
  - lib/ghee/api/milestones.rb
167
167
  - lib/ghee/api/orgs.rb
168
+ - lib/ghee/api/pulls.rb
168
169
  - lib/ghee/api/repos.rb
169
170
  - lib/ghee/api/users.rb
170
171
  - lib/ghee/api/watchers.rb