octokit 3.7.0 → 3.7.1

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: 1f2a4c4a887142b38092500f915ae1e76045a088
4
- data.tar.gz: 8b6a457b671dda7b59e4d95a9e21bf02326a0ff1
3
+ metadata.gz: 2ed9c913826b2d42443b7ba5790e5c1a64eacf8c
4
+ data.tar.gz: 417bda71bdee949b4d4285750e2567c629df7027
5
5
  SHA512:
6
- metadata.gz: dcca491b69213f7fd2fe9aee6c439c7751b7d77802a2f8328e64456e6f3bc5739eef054e2640294df1c6430d820adef26d1d30aba1243c4b7fe7a377441b8169
7
- data.tar.gz: d6e871030302eb322560f7534ff8ea963d616c455e711666a860c784443933a34e89ec6dc4bbf658e55ea6136d8c090e357b37b92743199c0760f508a2c2d34a
6
+ metadata.gz: 71b430500419af8f9cfd601400a519d6476490ec8d9fdb81487f346137e40b6f8cc2254f01671031475ea96cd7478b7d5598a29827f566f234f4ffc6f1a8cd2e
7
+ data.tar.gz: 6dc2cb4d23e657ae56d573bd8beb705120e3a01a28a73bfcb5b0786e478dcf47f813a34ae6536d82adf8d41bd6a5d84e1a114a32a65054364d23bdc6b3d7738f
data/README.md CHANGED
@@ -497,7 +497,7 @@ Octokit uses environmental variables for storing credentials used in testing.
497
497
  If you are testing an API endpoint that doesn't require authentication, you
498
498
  can get away without any additional configuration. For the most part, tests
499
499
  use an authenticated client, using a token stored in `ENV['OCTOKIT_TEST_GITHUB_TOKEN']`.
500
- There are several different authenticating method's used accross the api.
500
+ There are several different authenticating method's used across the api.
501
501
  Here is the full list of configurable environmental variables for testing
502
502
  Octokit:
503
503
 
@@ -77,7 +77,7 @@ module Octokit
77
77
  #
78
78
  # @param repo [Integer, String, Repository, Hash] A GitHub repository
79
79
  # @param title [String] A descriptive title
80
- # @param body [String] A concise description
80
+ # @param body [String] An optional concise description
81
81
  # @param options [Hash] A customizable set of options.
82
82
  # @option options [String] :assignee User login.
83
83
  # @option options [Integer] :milestone Milestone number.
@@ -86,7 +86,7 @@ module Octokit
86
86
  # @see https://developer.github.com/v3/issues/#create-an-issue
87
87
  # @example Create a new Issues for a repository
88
88
  # Octokit.create_issue("sferik/rails_admin", 'Updated Docs', 'Added some extra links')
89
- def create_issue(repo, title, body, options = {})
89
+ def create_issue(repo, title, body = nil, options = {})
90
90
  options[:labels] = case options[:labels]
91
91
  when String
92
92
  options[:labels].split(",").map(&:strip)
@@ -95,7 +95,9 @@ module Octokit
95
95
  else
96
96
  []
97
97
  end
98
- post "#{Repository.path repo}/issues", options.merge({:title => title, :body => body})
98
+ parameters = { :title => title }
99
+ parameters[:body] = body unless body.nil?
100
+ post "#{Repository.path repo}/issues", options.merge(parameters)
99
101
  end
100
102
  alias :open_issue :create_issue
101
103
 
@@ -28,7 +28,7 @@ module Octokit
28
28
  # @example Get the "V3 Addition" label from octokit/octokit.rb
29
29
  # Octokit.labels("octokit/octokit.rb", "V3 Addition")
30
30
  def label(repo, name, options = {})
31
- get "#{Repository.path repo}/labels/#{CGI.escape(name)}", options
31
+ get "#{Repository.path repo}/labels/#{name}", options
32
32
  end
33
33
 
34
34
  # Add a label to a repository
@@ -56,7 +56,7 @@ module Octokit
56
56
  # @example Update the label "Version 1.0" with new color "#cceeaa"
57
57
  # Octokit.update_label("octokit/octokit.rb", "Version 1.0", {:color => "cceeaa"})
58
58
  def update_label(repo, label, options = {})
59
- patch "#{Repository.path repo}/labels/#{CGI.escape(label)}", options
59
+ patch "#{Repository.path repo}/labels/#{label}", options
60
60
  end
61
61
 
62
62
  # Delete a label from a repository.
@@ -70,7 +70,7 @@ module Octokit
70
70
  # @example Delete the label "Version 1.0" from the repository.
71
71
  # Octokit.delete_label!("octokit/octokit.rb", "Version 1.0")
72
72
  def delete_label!(repo, label, options = {})
73
- boolean_from_response :delete, "#{Repository.path repo}/labels/#{CGI.escape(label)}", options
73
+ boolean_from_response :delete, "#{Repository.path repo}/labels/#{label}", options
74
74
  end
75
75
 
76
76
  # Remove a label from an Issue
@@ -85,7 +85,7 @@ module Octokit
85
85
  # @example Remove the label "Version 1.0" from the repository.
86
86
  # Octokit.remove_label("octokit/octokit.rb", 23, "Version 1.0")
87
87
  def remove_label(repo, number, label, options = {})
88
- delete "#{Repository.path repo}/issues/#{number}/labels/#{CGI.escape(label)}", options
88
+ delete "#{Repository.path repo}/issues/#{number}/labels/#{label}", options
89
89
  end
90
90
 
91
91
  # Remove all label from an Issue
@@ -54,18 +54,18 @@ module Octokit
54
54
  # a merge to a base of another repo.
55
55
  # @param head [String] The branch (or git ref) where your changes are implemented.
56
56
  # @param title [String] Title for the pull request
57
- # @param body [String] The body for the pull request. Supports GFM.
57
+ # @param body [String] The body for the pull request (optional). Supports GFM.
58
58
  # @return [Sawyer::Resource] The newly created pull request
59
59
  # @example
60
60
  # @client.create_pull_request("octokit/octokit.rb", "master", "feature-branch",
61
61
  # "Pull Request title", "Pull Request body")
62
- def create_pull_request(repo, base, head, title, body, options = {})
62
+ def create_pull_request(repo, base, head, title, body = nil, options = {})
63
63
  pull = {
64
64
  :base => base,
65
65
  :head => head,
66
66
  :title => title,
67
- :body => body,
68
67
  }
68
+ pull[:body] = body unless body.nil?
69
69
  post "#{Repository.path repo}/pulls", options.merge(pull)
70
70
  end
71
71
 
@@ -181,7 +181,7 @@ module Octokit
181
181
  # @return [Array<Sawyer::Resource>] List of comments
182
182
  def pull_request_comments(repo, number, options = {})
183
183
  # return the comments for a pull request
184
- get "#{Repository.path repo}/pulls/#{number}/comments", options
184
+ paginate("#{Repository.path repo}/pulls/#{number}/comments", options)
185
185
  end
186
186
  alias :pull_comments :pull_request_comments
187
187
  alias :review_comments :pull_request_comments
@@ -23,8 +23,8 @@ module Octokit
23
23
  # @option options [String] :target_commitish Specifies the commitish value that determines where the Git tag is created from.
24
24
  # @option options [String] :name Name for the release
25
25
  # @option options [String] :body Content for release notes
26
- # @option options [String] :draft Mark this release as a draft
27
- # @option options [String] :prerelease Mark this release as a pre-release
26
+ # @option options [Boolean] :draft Mark this release as a draft
27
+ # @option options [Boolean] :prerelease Mark this release as a pre-release
28
28
  # @return [Sawyer::Resource] The release
29
29
  # @see https://developer.github.com/v3/repos/releases/#create-a-release
30
30
  def create_release(repo, tag_name, options = {})
@@ -47,8 +47,8 @@ module Octokit
47
47
  # @option options [String] :target_commitish Specifies the commitish value that determines where the Git tag is created from.
48
48
  # @option options [String] :name Name for the release
49
49
  # @option options [String] :body Content for release notes
50
- # @option options [String] :draft Mark this release as a draft
51
- # @option options [String] :prerelease Mark this release as a pre-release
50
+ # @option options [Boolean] :draft Mark this release as a draft
51
+ # @option options [Boolean] :prerelease Mark this release as a pre-release
52
52
  # @return [Sawyer::Resource] The release
53
53
  # @see https://developer.github.com/v3/repos/releases/#edit-a-release
54
54
  def update_release(url, options = {})
@@ -14,7 +14,7 @@ module Octokit
14
14
  USER_AGENT = "Octokit Ruby Gem #{Octokit::VERSION}".freeze
15
15
 
16
16
  # Default media type
17
- MEDIA_TYPE = "application/vnd.github.v3+json"
17
+ MEDIA_TYPE = "application/vnd.github.v3+json".freeze
18
18
 
19
19
  # Default WEB endpoint
20
20
  WEB_ENDPOINT = "https://github.com".freeze
@@ -62,6 +62,8 @@ module Octokit
62
62
  Octokit::TooManyRequests
63
63
  elsif body =~ /login attempts exceeded/i
64
64
  Octokit::TooManyLoginAttempts
65
+ elsif body =~ /abuse/i
66
+ Octokit::AbuseDetected
65
67
  else
66
68
  Octokit::Forbidden
67
69
  end
@@ -187,6 +189,10 @@ module Octokit
187
189
  # and body matches 'login attempts exceeded'
188
190
  class TooManyLoginAttempts < Forbidden; end
189
191
 
192
+ # Raised when GitHub returns a 403 HTTP status code
193
+ # and body matches 'abuse'
194
+ class AbuseDetected < Forbidden; end
195
+
190
196
  # Raised when GitHub returns a 404 HTTP status code
191
197
  class NotFound < ClientError; end
192
198
 
@@ -18,6 +18,9 @@ module Octokit
18
18
  @id = repo
19
19
  when String
20
20
  @owner, @name = repo.split('/')
21
+ unless @owner && @name
22
+ raise ArgumentError, "Invalid Repository. Use user/repo format."
23
+ end
21
24
  when Repository
22
25
  @owner = repo.owner
23
26
  @name = repo.name
@@ -1,7 +1,17 @@
1
1
  module Octokit
2
+ # Current major release.
3
+ # @return [Integer]
4
+ MAJOR = 3
2
5
 
3
- # Current version
4
- # @return [String]
5
- VERSION = "3.7.0".freeze
6
+ # Current minor release.
7
+ # @return [Integer]
8
+ MINOR = 7
9
+
10
+ # Current patch level.
11
+ # @return [Integer]
12
+ PATCH = 1
6
13
 
14
+ # Full release version.
15
+ # @return [String]
16
+ VERSION = [MAJOR, MINOR, PATCH].join('.').freeze
7
17
  end
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.7.0
4
+ version: 3.7.1
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-12-03 00:00:00.000000000 Z
13
+ date: 2015-02-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler