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.
@@ -41,7 +41,6 @@ module Github
41
41
  #
42
42
  def initialize(options={}, &block)
43
43
  setup(options)
44
- client(options) if client_id? && client_secret?
45
44
  yield_or_eval(&block) if block_given?
46
45
  end
47
46
 
@@ -6,10 +6,10 @@ module Github
6
6
  attr_accessor :scopes
7
7
 
8
8
  # Setup OAuth2 instance
9
- def client(options={})
9
+ def client
10
10
  @client ||= ::OAuth2::Client.new(client_id, client_secret,
11
11
  {
12
- :site => options.fetch(:site) { Github.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 }
@@ -175,12 +175,12 @@ module Github
175
175
  #
176
176
  # = Examples
177
177
  # github = Github.new
178
- # github.issues.get 'user-name', 'repo-name', 'issue-id'
178
+ # github.issues.get 'user-name', 'repo-name', 'number'
179
179
  #
180
180
  def get(*args)
181
- arguments(args, :required => [:user, :repo, :issue_id])
181
+ arguments(args, :required => [:user, :repo, :number])
182
182
 
183
- get_request("/repos/#{user}/#{repo}/issues/#{issue_id}", arguments.params)
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
- # <tt>:milestone</tt> - Optional number - Milestone to associate this issue with
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', 'issue-id'
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, :issue_id]) do
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/#{issue_id}", params)
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 paginatoin parameters
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
@@ -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
  #
@@ -4,7 +4,7 @@ module Github
4
4
  module VERSION
5
5
  MAJOR = 0
6
6
  MINOR = 9
7
- PATCH = 4
7
+ PATCH = 5
8
8
  BUILD = nil
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.');
@@ -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(:options) { {} }
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 == 'https://github.com'
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 == 'https://github.com/login/oauth/authorize'
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 == 'https://github.com/login/oauth/access_token'
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
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-03-24 00:00:00.000000000Z
12
+ date: 2013-04-01 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hashie
16
- requirement: &2161138280 !ruby/object:Gem::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: *2161138280
24
+ version_requirements: *2160880680
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: faraday
27
- requirement: &2161137520 !ruby/object:Gem::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: *2161137520
35
+ version_requirements: *2160880120
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: multi_json
38
- requirement: &2161137020 !ruby/object:Gem::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: *2161137020
46
+ version_requirements: *2160879660
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: oauth2
49
- requirement: &2161136640 !ruby/object:Gem::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: *2161136640
57
+ version_requirements: *2160879260
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: nokogiri
60
- requirement: &2161098200 !ruby/object:Gem::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: *2161098200
68
+ version_requirements: *2160878720
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
- requirement: &2161097440 !ruby/object:Gem::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: *2161097440
79
+ version_requirements: *2160878220
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: cucumber
82
- requirement: &2161096720 !ruby/object:Gem::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: *2161096720
90
+ version_requirements: *2160877760
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: webmock
93
- requirement: &2161096260 !ruby/object:Gem::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: *2161096260
101
+ version_requirements: *2160877300
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: vcr
104
- requirement: &2161095800 !ruby/object:Gem::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: *2161095800
112
+ version_requirements: *2160876840
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: simplecov
115
- requirement: &2161095300 !ruby/object:Gem::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: *2161095300
123
+ version_requirements: *2160876380
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: coveralls
126
- requirement: &2161094600 !ruby/object:Gem::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: *2161094600
134
+ version_requirements: *2160875900
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: guard
137
- requirement: &2161094040 !ruby/object:Gem::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: *2161094040
145
+ version_requirements: *2160875500
146
146
  - !ruby/object:Gem::Dependency
147
147
  name: guard-rspec
148
- requirement: &2161093340 !ruby/object:Gem::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: *2161093340
156
+ version_requirements: *2160875040
157
157
  - !ruby/object:Gem::Dependency
158
158
  name: guard-cucumber
159
- requirement: &2161092740 !ruby/object:Gem::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: *2161092740
167
+ version_requirements: *2160874620
168
168
  - !ruby/object:Gem::Dependency
169
169
  name: rake
170
- requirement: &2161092120 !ruby/object:Gem::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: *2161092120
178
+ version_requirements: *2160874200
179
179
  - !ruby/object:Gem::Dependency
180
180
  name: bundler
181
- requirement: &2161091580 !ruby/object:Gem::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: *2161091580
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