github_api 0.9.4 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/github_api/api.rb +0 -1
- data/lib/github_api/authorization.rb +2 -2
- data/lib/github_api/issues.rb +13 -7
- data/lib/github_api/paged_request.rb +1 -1
- data/lib/github_api/repos.rb +4 -0
- data/lib/github_api/version.rb +1 -1
- data/spec/github/authorization_spec.rb +5 -4
- metadata +34 -34
data/lib/github_api/api.rb
CHANGED
@@ -6,10 +6,10 @@ module Github
|
|
6
6
|
attr_accessor :scopes
|
7
7
|
|
8
8
|
# Setup OAuth2 instance
|
9
|
-
def client
|
9
|
+
def client
|
10
10
|
@client ||= ::OAuth2::Client.new(client_id, client_secret,
|
11
11
|
{
|
12
|
-
:site =>
|
12
|
+
:site => current_options.fetch(:site) { Github.site },
|
13
13
|
:authorize_url => 'login/oauth/authorize',
|
14
14
|
:token_url => 'login/oauth/access_token',
|
15
15
|
:ssl => { :verify => false }
|
data/lib/github_api/issues.rb
CHANGED
@@ -175,12 +175,12 @@ module Github
|
|
175
175
|
#
|
176
176
|
# = Examples
|
177
177
|
# github = Github.new
|
178
|
-
# github.issues.get 'user-name', 'repo-name', '
|
178
|
+
# github.issues.get 'user-name', 'repo-name', 'number'
|
179
179
|
#
|
180
180
|
def get(*args)
|
181
|
-
arguments(args, :required => [:user, :repo, :
|
181
|
+
arguments(args, :required => [:user, :repo, :number])
|
182
182
|
|
183
|
-
get_request("/repos/#{user}/#{repo}/issues/#{
|
183
|
+
get_request("/repos/#{user}/#{repo}/issues/#{number}", arguments.params)
|
184
184
|
end
|
185
185
|
alias :find :get
|
186
186
|
|
@@ -190,8 +190,14 @@ module Github
|
|
190
190
|
# <tt>:title</tt> - Required string
|
191
191
|
# <tt>:body</tt> - Optional string
|
192
192
|
# <tt>:assignee</tt> - Optional string - Login for the user that this issue should be assigned to.
|
193
|
-
#
|
193
|
+
# Only users with push access can set the assignee for new issues.
|
194
|
+
# The assignee is silently dropped otherwise.
|
195
|
+
# <tt>:milestone</tt> - Optional number - Milestone to associate this issue with.
|
196
|
+
# Only users with push access can set the milestone for new issues.
|
197
|
+
# The milestone is silently dropped otherwise.
|
194
198
|
# <tt>:labels</tt> - Optional array of strings - Labels to associate with this issue
|
199
|
+
# Only users with push access can set labels for new issues.
|
200
|
+
# Labels are silently dropped otherwise.
|
195
201
|
# = Examples
|
196
202
|
# github = Github.new :user => 'user-name', :repo => 'repo-name'
|
197
203
|
# github.issues.create
|
@@ -225,7 +231,7 @@ module Github
|
|
225
231
|
#
|
226
232
|
# = Examples
|
227
233
|
# github = Github.new
|
228
|
-
# github.issues.edit 'user-name', 'repo-name', '
|
234
|
+
# github.issues.edit 'user-name', 'repo-name', 'number'
|
229
235
|
# "title" => "Found a bug",
|
230
236
|
# "body" => "I'm having a problem with this.",
|
231
237
|
# "assignee" => "octocat",
|
@@ -236,12 +242,12 @@ module Github
|
|
236
242
|
# ]
|
237
243
|
#
|
238
244
|
def edit(*args)
|
239
|
-
arguments(args, :required => [:user, :repo, :
|
245
|
+
arguments(args, :required => [:user, :repo, :number]) do
|
240
246
|
sift VALID_ISSUE_PARAM_NAMES
|
241
247
|
end
|
242
248
|
params = arguments.params
|
243
249
|
|
244
|
-
patch_request("/repos/#{user}/#{repo}/issues/#{
|
250
|
+
patch_request("/repos/#{user}/#{repo}/issues/#{number}", params)
|
245
251
|
end
|
246
252
|
|
247
253
|
end # Issues
|
@@ -23,7 +23,7 @@ module Github
|
|
23
23
|
current_api.page ? current_api.page : FIRST_PAGE
|
24
24
|
end
|
25
25
|
|
26
|
-
# Perform http get request with
|
26
|
+
# Perform http get request with pagination parameters
|
27
27
|
#
|
28
28
|
def page_request(path, params={})
|
29
29
|
if params[PARAM_PER_PAGE] == NOT_FOUND
|
data/lib/github_api/repos.rb
CHANGED
@@ -39,6 +39,7 @@ module Github
|
|
39
39
|
team_id
|
40
40
|
auto_init
|
41
41
|
gitignore_template
|
42
|
+
default_branch
|
42
43
|
].freeze
|
43
44
|
|
44
45
|
VALID_REPO_TYPES = %w[ all public private member ].freeze
|
@@ -179,6 +180,8 @@ module Github
|
|
179
180
|
# <tt>:has_downloads</tt> Optional boolean - <tt>true</tt> to enable downloads for this repository
|
180
181
|
# <tt>:org</tt> Optional string - The organisation in which this repository will be created
|
181
182
|
# <tt>:team_id</tt> Optional number - The id of the team that will be granted access to this repository. This is only valid when creating a repo in an organization
|
183
|
+
# <tt>:auto_init</tt> Optional boolean - true to create an initial commit with empty README. Default is false.
|
184
|
+
# <tt>:gitignore_template</tt> Optional string - Desired language or platform .gitignore template to apply. Use the name of the template without the extension. For example, “Haskell” Ignored if auto_init parameter is not provided.
|
182
185
|
#
|
183
186
|
# = Examples
|
184
187
|
# github = Github.new
|
@@ -263,6 +266,7 @@ module Github
|
|
263
266
|
# * <tt>:has_issues</tt> Optional boolean - <tt>true</tt> to enable issues for this repository, <tt>false</tt> to disable them
|
264
267
|
# * <tt>:has_wiki</tt> Optional boolean - <tt>true</tt> to enable the wiki for this repository, <tt>false</tt> to disable it. Default is <tt>true</tt>
|
265
268
|
# * <tt>:has_downloads</tt> Optional boolean - <tt>true</tt> to enable downloads for this repository
|
269
|
+
# * <tt>:default_branch</tt> Optional string - Update the default branch for this repository.
|
266
270
|
#
|
267
271
|
# = Examples
|
268
272
|
#
|
data/lib/github_api/version.rb
CHANGED
@@ -6,7 +6,8 @@ describe Github::Authorization do
|
|
6
6
|
let(:client_id) { '234jl23j4l23j4l' }
|
7
7
|
let(:client_secret) { 'asasd79sdf9a7asfd7sfd97s' }
|
8
8
|
let(:code) { 'c9798sdf97df98ds'}
|
9
|
-
let(:
|
9
|
+
let(:site) { 'http://github-ent.example.com/' }
|
10
|
+
let(:options) { {:site => site} }
|
10
11
|
|
11
12
|
subject(:github) { Github.new options }
|
12
13
|
|
@@ -22,15 +23,15 @@ describe Github::Authorization do
|
|
22
23
|
end
|
23
24
|
|
24
25
|
it "should assign site from the options hash" do
|
25
|
-
github.client.site.should ==
|
26
|
+
github.client.site.should == site
|
26
27
|
end
|
27
28
|
|
28
29
|
it "should assign 'authorize_url" do
|
29
|
-
github.client.authorize_url.should ==
|
30
|
+
github.client.authorize_url.should == "#{site}login/oauth/authorize"
|
30
31
|
end
|
31
32
|
|
32
33
|
it "should assign 'token_url" do
|
33
|
-
github.client.token_url.should ==
|
34
|
+
github.client.token_url.should == "#{site}login/oauth/access_token"
|
34
35
|
end
|
35
36
|
end
|
36
37
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: github_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.5
|
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: 2013-
|
12
|
+
date: 2013-04-01 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hashie
|
16
|
-
requirement: &
|
16
|
+
requirement: &2160880680 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '1.2'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2160880680
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: faraday
|
27
|
-
requirement: &
|
27
|
+
requirement: &2160880120 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.8.1
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2160880120
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: multi_json
|
38
|
-
requirement: &
|
38
|
+
requirement: &2160879660 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '1.4'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2160879660
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: oauth2
|
49
|
-
requirement: &
|
49
|
+
requirement: &2160879260 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2160879260
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: nokogiri
|
60
|
-
requirement: &
|
60
|
+
requirement: &2160878720 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 1.5.2
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2160878720
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
|
-
requirement: &
|
71
|
+
requirement: &2160878220 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *2160878220
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: cucumber
|
82
|
-
requirement: &
|
82
|
+
requirement: &2160877760 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *2160877760
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: webmock
|
93
|
-
requirement: &
|
93
|
+
requirement: &2160877300 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ~>
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: 1.9.0
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *2160877300
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: vcr
|
104
|
-
requirement: &
|
104
|
+
requirement: &2160876840 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ~>
|
@@ -109,10 +109,10 @@ dependencies:
|
|
109
109
|
version: 2.4.0
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *2160876840
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: simplecov
|
115
|
-
requirement: &
|
115
|
+
requirement: &2160876380 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ~>
|
@@ -120,10 +120,10 @@ dependencies:
|
|
120
120
|
version: 0.7.1
|
121
121
|
type: :development
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *2160876380
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
125
|
name: coveralls
|
126
|
-
requirement: &
|
126
|
+
requirement: &2160875900 !ruby/object:Gem::Requirement
|
127
127
|
none: false
|
128
128
|
requirements:
|
129
129
|
- - ~>
|
@@ -131,10 +131,10 @@ dependencies:
|
|
131
131
|
version: 0.5.8
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
|
-
version_requirements: *
|
134
|
+
version_requirements: *2160875900
|
135
135
|
- !ruby/object:Gem::Dependency
|
136
136
|
name: guard
|
137
|
-
requirement: &
|
137
|
+
requirement: &2160875500 !ruby/object:Gem::Requirement
|
138
138
|
none: false
|
139
139
|
requirements:
|
140
140
|
- - ! '>='
|
@@ -142,10 +142,10 @@ dependencies:
|
|
142
142
|
version: '0'
|
143
143
|
type: :development
|
144
144
|
prerelease: false
|
145
|
-
version_requirements: *
|
145
|
+
version_requirements: *2160875500
|
146
146
|
- !ruby/object:Gem::Dependency
|
147
147
|
name: guard-rspec
|
148
|
-
requirement: &
|
148
|
+
requirement: &2160875040 !ruby/object:Gem::Requirement
|
149
149
|
none: false
|
150
150
|
requirements:
|
151
151
|
- - ! '>='
|
@@ -153,10 +153,10 @@ dependencies:
|
|
153
153
|
version: '0'
|
154
154
|
type: :development
|
155
155
|
prerelease: false
|
156
|
-
version_requirements: *
|
156
|
+
version_requirements: *2160875040
|
157
157
|
- !ruby/object:Gem::Dependency
|
158
158
|
name: guard-cucumber
|
159
|
-
requirement: &
|
159
|
+
requirement: &2160874620 !ruby/object:Gem::Requirement
|
160
160
|
none: false
|
161
161
|
requirements:
|
162
162
|
- - ! '>='
|
@@ -164,10 +164,10 @@ dependencies:
|
|
164
164
|
version: '0'
|
165
165
|
type: :development
|
166
166
|
prerelease: false
|
167
|
-
version_requirements: *
|
167
|
+
version_requirements: *2160874620
|
168
168
|
- !ruby/object:Gem::Dependency
|
169
169
|
name: rake
|
170
|
-
requirement: &
|
170
|
+
requirement: &2160874200 !ruby/object:Gem::Requirement
|
171
171
|
none: false
|
172
172
|
requirements:
|
173
173
|
- - ! '>='
|
@@ -175,10 +175,10 @@ dependencies:
|
|
175
175
|
version: '0'
|
176
176
|
type: :development
|
177
177
|
prerelease: false
|
178
|
-
version_requirements: *
|
178
|
+
version_requirements: *2160874200
|
179
179
|
- !ruby/object:Gem::Dependency
|
180
180
|
name: bundler
|
181
|
-
requirement: &
|
181
|
+
requirement: &2160873780 !ruby/object:Gem::Requirement
|
182
182
|
none: false
|
183
183
|
requirements:
|
184
184
|
- - ! '>='
|
@@ -186,7 +186,7 @@ dependencies:
|
|
186
186
|
version: '0'
|
187
187
|
type: :development
|
188
188
|
prerelease: false
|
189
|
-
version_requirements: *
|
189
|
+
version_requirements: *2160873780
|
190
190
|
description: ! ' Ruby wrapper that supports all of the GitHub API v3 methods(nearly
|
191
191
|
200). It''s build in a modular way, that is, you can either instantiate the whole
|
192
192
|
api wrapper Github.new or use parts of it e.i. Github::Repos.new if working solely
|