octokit 3.5.2 → 3.6.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: b21490afb50e6acd65ac6cb66475251aeeb6e85a
4
- data.tar.gz: 331fd29bac0ba67105639ea7b0aef72a79f25c5d
3
+ metadata.gz: 59f95926a49217f6e7b37fafcfbb8f67c3514187
4
+ data.tar.gz: e3815c01033df0d167d677c6cef0d0e4f7f72e84
5
5
  SHA512:
6
- metadata.gz: 9de481f7dece4a7cc630c1df9429b6ebd8bff26dfe4c2bbe76edfb62abd274495c5cbcf9ed4fc530258003e83b025e346890c44477c50ccaaf77694571f22f2a
7
- data.tar.gz: 7d211ac73a89747179c67eededac39cc9a71fbd3135ec0a366d29ebdb29175a5448eb4e5a4b0ef746cd0af0efe0dd36af70a611f3cb5a9cd44c8829fea04d3f9
6
+ metadata.gz: 42798186a228a4dd0e72aebe2df3c05da5d36a342884e86fa71cb813eed8aa598a37b54263834510856683824d244b8225e7d4067a77a78ab36ea92b42d51840
7
+ data.tar.gz: b9d1a869713cd29d287fc1614d93784574d3641035ddd43d1e7de484e9a0cd4fbe14673482efafedefbd1a8ec54f8d97aa91f99ead7405fa7675f5308445d3e9
data/README.md CHANGED
@@ -566,7 +566,7 @@ Constraint][pvc] with two digits of precision. For example:
566
566
  spec.add_dependency 'octokit', '~> 3.0'
567
567
 
568
568
  [semver]: http://semver.org/
569
- [pvc]: http://docs.rubygems.org/read/chapter/16#page74
569
+ [pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint
570
570
 
571
571
  ## License
572
572
 
@@ -6,15 +6,12 @@ module Octokit
6
6
  # @see https://developer.github.com/v3/repos/commits/deployments/
7
7
  module Deployments
8
8
 
9
- DEPLOYMENTS_PREVIEW_MEDIA_TYPE = "application/vnd.github.cannonball-preview+json".freeze
10
-
11
9
  # List all deployments for a repository
12
10
  #
13
11
  # @param repo [Integer, String, Repository, Hash] A GitHub repository
14
12
  # @return [Array<Sawyer::Resource>] A list of deployments
15
13
  # @see https://developer.github.com/v3/repos/deployments/#list-deployments
16
14
  def deployments(repo, options = {})
17
- options = ensure_deployments_api_media_type(options)
18
15
  get("#{Repository.path repo}/deployments", options)
19
16
  end
20
17
  alias :list_deployments :deployments
@@ -23,14 +20,15 @@ module Octokit
23
20
  #
24
21
  # @param repo [Integer, String, Repository, Hash] A GitHub repository
25
22
  # @param ref [String] The ref to deploy
23
+ # @option options [String] :task Used by the deployment system to allow different execution paths. Defaults to "deploy".
26
24
  # @option options [String] :payload Meta info about the deployment
27
- # @option options [String] :force Optional parameter to bypass any ahead/behind checks or commit status checks. Default: false
28
- # @option options [String] :auto_merge Optional parameter to merge the default branch into the requested deployment branch if necessary. Default: false
25
+ # @option options [Boolean] :auto_merge Optional parameter to merge the default branch into the requested deployment branch if necessary. Default: true
26
+ # @option options [Array<String>] :required_contexts Optional array of status contexts verified against commit status checks.
27
+ # @option options [String] :environment Optional name for the target deployment environment (e.g., production, staging, qa). Default: "production"
29
28
  # @option options [String] :description Optional short description.
30
29
  # @return [Sawyer::Resource] A deployment
31
30
  # @see https://developer.github.com/v3/repos/deployments/#create-a-deployment
32
31
  def create_deployment(repo, ref, options = {})
33
- options = ensure_deployments_api_media_type(options)
34
32
  options[:ref] = ref
35
33
  post("#{Repository.path repo}/deployments", options)
36
34
  end
@@ -41,7 +39,6 @@ module Octokit
41
39
  # @return [Array<Sawyer::Resource>] A list of deployment statuses
42
40
  # @see https://developer.github.com/v3/repos/deployments/#list-deployment-statuses
43
41
  def deployment_statuses(deployment_url, options = {})
44
- options = ensure_deployments_api_media_type(options)
45
42
  deployment = get(deployment_url, :accept => options[:accept])
46
43
  get(deployment.rels[:statuses].href, options)
47
44
  end
@@ -54,30 +51,10 @@ module Octokit
54
51
  # @return [Sawyer::Resource] A deployment status
55
52
  # @see https://developer.github.com/v3/repos/deployments/#create-a-deployment-status
56
53
  def create_deployment_status(deployment_url, state, options = {})
57
- options = ensure_deployments_api_media_type(options)
58
54
  deployment = get(deployment_url, :accept => options[:accept])
59
55
  options[:state] = state.to_s.downcase
60
56
  post(deployment.rels[:statuses].href, options)
61
57
  end
62
-
63
- private
64
-
65
- def ensure_deployments_api_media_type(options = {})
66
- if options[:accept].nil?
67
- options[:accept] = DEPLOYMENTS_PREVIEW_MEDIA_TYPE
68
- warn_deployments_preview
69
- end
70
-
71
- options
72
- end
73
-
74
- def warn_deployments_preview
75
- octokit_warn <<-EOS
76
- WARNING: The preview version of the Deployments API is not yet suitable for production use.
77
- You can avoid this message by supplying an appropriate media type in the 'Accept' request
78
- header. See the blog post for details: http://git.io/o2XZRA
79
- EOS
80
- end
81
58
  end
82
59
  end
83
60
  end
@@ -143,21 +143,45 @@ module Octokit
143
143
 
144
144
  # Update an issue
145
145
  #
146
- # @param repo [Integer, String, Repository, Hash] A GitHub repository
147
- # @param number [Integer] Number ID of the issue
148
- # @param title [String] Updated title for the issue
149
- # @param body [String] Updated body of the issue
150
- # @param options [Hash] A customizable set of options.
151
- # @option options [String] :assignee User login.
152
- # @option options [Integer] :milestone Milestone number.
153
- # @option options [String] :labels List of comma separated Label names. Example: <tt>bug,ui,@high</tt>.
154
- # @option options [String] :state State of the issue. <tt>open</tt> or <tt>closed</tt>
146
+ # @overload update_issue(repo, number, title, body, options)
147
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
148
+ # @param number [Integer] Number ID of the issue
149
+ # @param title [String] Updated title for the issue
150
+ # @param body [String] Updated body of the issue
151
+ # @param options [Hash] A customizable set of options.
152
+ # @option options [String] :assignee User login.
153
+ # @option options [Integer] :milestone Milestone number.
154
+ # @option options [String] :labels List of comma separated Label names. Example: <tt>bug,ui,@high</tt>.
155
+ # @option options [String] :state State of the issue. <tt>open</tt> or <tt>closed</tt>
156
+ #
157
+ # @overload update_issue(repo, number, options)
158
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
159
+ # @param number [Integer] Number ID of the issue
160
+ # @param options [Hash] A customizable set of options.
161
+ # @option options [String] :title Updated title for the issue
162
+ # @option options [String] :body Updated body of the issue
163
+ # @option options [String] :assignee User login.
164
+ # @option options [Integer] :milestone Milestone number.
165
+ # @option options [String] :labels List of comma separated Label names. Example: <tt>bug,ui,@high</tt>.
166
+ # @option options [String] :state State of the issue. <tt>open</tt> or <tt>closed</tt>
155
167
  # @return [Sawyer::Resource] The updated Issue
156
168
  # @see https://developer.github.com/v3/issues/#edit-an-issue
169
+ #
157
170
  # @example Change the title of Issue #25
158
- # Octokit.update_issue("octokit/octokit.rb", "25", "A new title", "the same body"")
159
- def update_issue(repo, number, title, body, options = {})
160
- patch "#{Repository.path repo}/issues/#{number}", options.merge({:title => title, :body => body})
171
+ # Octokit.update_issue("octokit/octokit.rb", "25", "A new title", "the same body")
172
+ #
173
+ # @example Change only the assignee of Issue #25
174
+ # Octokit.update_issue("octokit/octokit.rb", "25", :assignee => "pengwynn")
175
+ def update_issue(repo, number, *args)
176
+ arguments = Arguments.new(args)
177
+ opts = arguments.options
178
+
179
+ if arguments.length > 0
180
+ opts[:title] = arguments.shift
181
+ opts[:body] = arguments.shift
182
+ end
183
+
184
+ patch "#{Repository.path repo}/issues/#{number}", opts
161
185
  end
162
186
 
163
187
  # Get all comments attached to issues for the repository
@@ -56,6 +56,9 @@ module Octokit
56
56
  # @param title [String] Title for the pull request
57
57
  # @param body [String] The body for the pull request. Supports GFM.
58
58
  # @return [Sawyer::Resource] The newly created pull request
59
+ # @example
60
+ # @client.create_pull_request("octokit/octokit.rb", "master", "feature-branch",
61
+ # "Pull Request title", "Pull Request body")
59
62
  def create_pull_request(repo, base, head, title, body, options = {})
60
63
  pull = {
61
64
  :base => base,
@@ -2,7 +2,7 @@ module Octokit
2
2
  # Custom error class for rescuing from all GitHub errors
3
3
  class Error < StandardError
4
4
 
5
- # Returns the appropriate Octokit::Error sublcass based
5
+ # Returns the appropriate Octokit::Error subclass based
6
6
  # on status and response message
7
7
  #
8
8
  # @param [Hash] response HTTP response
@@ -24,7 +24,7 @@ module Octokit
24
24
  info.limit = (response.headers['X-RateLimit-Limit'] || 1).to_i
25
25
  info.remaining = (response.headers['X-RateLimit-Remaining'] || 1).to_i
26
26
  info.resets_at = Time.at((response.headers['X-RateLimit-Reset'] || Time.now).to_i)
27
- info.resets_in = (info.resets_at - Time.now).to_i
27
+ info.resets_in = [(info.resets_at - Time.now).to_i, 0].max
28
28
  end
29
29
 
30
30
  info
@@ -2,6 +2,6 @@ module Octokit
2
2
 
3
3
  # Current version
4
4
  # @return [String]
5
- VERSION = "3.5.2".freeze
5
+ VERSION = "3.6.0".freeze
6
6
 
7
7
  end
@@ -5,7 +5,7 @@ require 'octokit/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.add_development_dependency 'bundler', '~> 1.0'
8
- spec.add_dependency 'sawyer', '~> 0.5.3'
8
+ spec.add_dependency 'sawyer', '>= 0.5.3', '~> 0.6.0'
9
9
  spec.authors = ["Wynn Netherland", "Erik Michaels-Ober", "Clint Shryock"]
10
10
  spec.description = %q{Simple wrapper for the GitHub API}
11
11
  spec.email = ['wynn.netherland@gmail.com', 'sferik@gmail.com', 'clint@ctshryock.com']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octokit
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.2
4
+ version: 3.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wynn Netherland
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-10-28 00:00:00.000000000 Z
13
+ date: 2014-12-02 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -30,16 +30,22 @@ dependencies:
30
30
  name: sawyer
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - "~>"
33
+ - - ">="
34
34
  - !ruby/object:Gem::Version
35
35
  version: 0.5.3
36
+ - - "~>"
37
+ - !ruby/object:Gem::Version
38
+ version: 0.6.0
36
39
  type: :runtime
37
40
  prerelease: false
38
41
  version_requirements: !ruby/object:Gem::Requirement
39
42
  requirements:
40
- - - "~>"
43
+ - - ">="
41
44
  - !ruby/object:Gem::Version
42
45
  version: 0.5.3
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: 0.6.0
43
49
  description: Simple wrapper for the GitHub API
44
50
  email:
45
51
  - wynn.netherland@gmail.com