octokit 2.4.0 → 2.5.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: f629afcf00490756d9918174b9c80cff0afe64ab
4
- data.tar.gz: 7e27860c840368c6285551ca8354a563d6542922
3
+ metadata.gz: 8c21feeb271532d08aa8fab12592183f7b641475
4
+ data.tar.gz: 54713209e7ff15a840bde44b91f20ef838f411d1
5
5
  SHA512:
6
- metadata.gz: 810ded7876d09f26e4a77ce387cc20db3a7e4c439d948d9bc5f6543dd62be4dca6b3ac1932683c35ebb78ef91a5876e696f1db201f352239261f15609575b07f
7
- data.tar.gz: 44cf44e3501922f0bf8ff533c7f053355cd77f1e76df6df36de132367cad3147f5e3e72e85223cf74be62cdc4d7e55c144a931e5662d2f249585267ca2577236
6
+ metadata.gz: 73e5cd0618ca59735e3edfca2f76d264dc32f964cd48fdeeee738480fbf2f0ffeab399e6ebeb73f3707b8ec94043f54070811e5d6eb2b17ca62aa584652bc0f2
7
+ data.tar.gz: 78266ae30f9cd5e5f85a4b13c81bd0903854fb94a89c44eff851413b872d2bc40043a53a20e625faaa4659a21def7c7a32e3fbc8a53434f01b9cfbec92ab79fe
data/README.md CHANGED
@@ -195,7 +195,7 @@ user = client.users 'defunkt'
195
195
  Many GitHub API resources are [paginated][]. While you may be tempted to start
196
196
  adding `:page` parameters to your calls, the API returns links to the next,
197
197
  previous, and last pages for you in the `Link` response header as [Hypermedia
198
- link relations](docs/hypermedia.md).
198
+ link relations](#hypermedia-agent).
199
199
 
200
200
  ```ruby
201
201
  issues = Octokit.issues 'rails/rails', :per_page => 100
@@ -46,7 +46,7 @@ module Octokit
46
46
  # @option options [String] :note_url A URL to remind you what app the OAuth token is for.
47
47
  # @option options [Boolean] :idempotent If true, will return an existing authorization if one has already been created.
48
48
  # @option options [String] :client_id Client Id we received when our application was registered with GitHub.
49
- # @option options [String] :client_id Client Secret we received when our application was registered with GitHub.
49
+ # @option options [String] :client_secret Client Secret we received when our application was registered with GitHub.
50
50
  #
51
51
  # @return [Sawyer::Resource] A single authorization for the authenticated user
52
52
  # @see http://developer.github.com/v3/oauth/#scopes Available scopes
@@ -6,6 +6,7 @@ module Octokit
6
6
  # @see http://developer.github.com/v3/repos/releases/
7
7
  module Releases
8
8
 
9
+ # @private
9
10
  PREVIEW_MEDIA_TYPE = "application/vnd.github.manifold-preview".freeze
10
11
 
11
12
  # List releases for a repository
@@ -15,6 +16,7 @@ module Octokit
15
16
  # @see http://developer.github.com/v3/repos/releases/#list-releases-for-a-repository
16
17
  def releases(repo, options = {})
17
18
  options[:accept] ||= PREVIEW_MEDIA_TYPE
19
+ warn_releases_preview
18
20
  paginate "repos/#{Repository.new(repo)}/releases", options
19
21
  end
20
22
  alias :list_releases :releases
@@ -32,6 +34,7 @@ module Octokit
32
34
  # @see http://developer.github.com/v3/repos/releases/#create-a-release
33
35
  def create_release(repo, tag_name, options = {})
34
36
  options[:accept] ||= PREVIEW_MEDIA_TYPE
37
+ warn_releases_preview
35
38
  opts = options.merge(:tag_name => tag_name)
36
39
  post "repos/#{Repository.new(repo)}/releases", opts
37
40
  end
@@ -43,13 +46,13 @@ module Octokit
43
46
  # @see http://developer.github.com/v3/repos/releases/#get-a-single-release
44
47
  def release(url, options = {})
45
48
  options[:accept] ||= PREVIEW_MEDIA_TYPE
49
+ warn_releases_preview
46
50
  get url, options
47
51
  end
48
52
 
49
53
  # Update a release
50
54
  #
51
55
  # @param url [String] URL for the release as returned from .releases
52
- # @param tag_name [String] Git tag from which to create release
53
56
  # @option options [String] :target_commitish Specifies the commitish value that determines where the Git tag is created from.
54
57
  # @option options [String] :name Name for the release
55
58
  # @option options [String] :body Content for release notes
@@ -59,6 +62,7 @@ module Octokit
59
62
  # @see http://developer.github.com/v3/repos/releases/#edit-a-release
60
63
  def update_release(url, options = {})
61
64
  options[:accept] ||= PREVIEW_MEDIA_TYPE
65
+ warn_releases_preview
62
66
  patch url, options
63
67
  end
64
68
  alias :edit_release :update_release
@@ -70,6 +74,7 @@ module Octokit
70
74
  # @see http://developer.github.com/v3/repos/releases/#delete-a-release
71
75
  def delete_release(url, options = {})
72
76
  options[:accept] ||= PREVIEW_MEDIA_TYPE
77
+ warn_releases_preview
73
78
  boolean_from_response(:delete, url, options)
74
79
  end
75
80
 
@@ -80,19 +85,21 @@ module Octokit
80
85
  # @see http://developer.github.com/v3/repos/releases/#list-assets-for-a-release
81
86
  def release_assets(release_url, options = {})
82
87
  options[:accept] ||= PREVIEW_MEDIA_TYPE
88
+ warn_releases_preview
83
89
  paginate release(release_url).rels[:assets].href, options
84
90
  end
85
91
 
86
92
  # Upload a release asset
87
93
  #
88
94
  # @param release_url [String] URL for the release as returned from .releases
89
- # @param file [String] Path to file to upload
95
+ # @param path_or_file [String] Path to file to upload
90
96
  # @option options [String] :content_type The MIME type for the file to upload
91
97
  # @option options [String] :name The name for the file
92
98
  # @return [Sawyer::Resource] The release asset
93
99
  # @see http://developer.github.com/v3/repos/releases/#upload-a-release-asset
94
100
  def upload_asset(release_url, path_or_file, options = {})
95
101
  options[:accept] ||= PREVIEW_MEDIA_TYPE
102
+ warn_releases_preview
96
103
  file = path_or_file.respond_to?(:read) ? path_or_file : File.new(path_or_file, "r+b")
97
104
  options[:content_type] ||= content_type_from_file(file)
98
105
  raise Octokit::MissingContentType.new if options[:content_type].nil?
@@ -114,6 +121,7 @@ module Octokit
114
121
  # @see http://developer.github.com/v3/repos/releases/#get-a-single-release-asset
115
122
  def release_asset(asset_url, options = {})
116
123
  options[:accept] ||= PREVIEW_MEDIA_TYPE
124
+ warn_releases_preview
117
125
  get(asset_url, options)
118
126
  end
119
127
 
@@ -126,6 +134,7 @@ module Octokit
126
134
  # @see http://developer.github.com/v3/repos/releases/#get-a-single-release-asset
127
135
  def update_release_asset(asset_url, options = {})
128
136
  options[:accept] ||= PREVIEW_MEDIA_TYPE
137
+ warn_releases_preview
129
138
  patch(asset_url, options)
130
139
  end
131
140
  alias :edit_release_asset :update_release_asset
@@ -137,6 +146,7 @@ module Octokit
137
146
  # @see http://developer.github.com/v3/repos/releases/#delete-a-release-asset
138
147
  def delete_release_asset(asset_url, options = {})
139
148
  options[:accept] ||= PREVIEW_MEDIA_TYPE
149
+ warn_releases_preview
140
150
  boolean_from_response(:delete, asset_url, options)
141
151
  end
142
152
 
@@ -151,6 +161,13 @@ module Octokit
151
161
  msg = "Please pass content_type or install mime-types gem to guess content type from file"
152
162
  raise Octokit::MissingContentType.new msg
153
163
  end
164
+
165
+ def warn_releases_preview
166
+ warn <<-EOS
167
+ WARNING: The preview version of the Releases API is not yet suitable for production use.
168
+ See the blog post for details: http://git.io/gMY9sA
169
+ EOS
170
+ end
154
171
  end
155
172
  end
156
173
  end
@@ -18,6 +18,7 @@ module Octokit
18
18
  when 403 then error_for_403(body)
19
19
  when 404 then Octokit::NotFound
20
20
  when 406 then Octokit::NotAcceptable
21
+ when 409 then Octokit::Conflict
21
22
  when 415 then Octokit::UnsupportedMediaType
22
23
  when 422 then Octokit::UnprocessableEntity
23
24
  when 400..499 then Octokit::ClientError
@@ -184,6 +185,9 @@ module Octokit
184
185
  # Raised when GitHub returns a 406 HTTP status code
185
186
  class NotAcceptable < ClientError; end
186
187
 
188
+ # Raised when GitHub returns a 409 HTTP status code
189
+ class Conflict < ClientError; end
190
+
187
191
  # Raised when GitHub returns a 414 HTTP status code
188
192
  class UnsupportedMediaType < ClientError; end
189
193
 
@@ -2,6 +2,6 @@ module Octokit
2
2
 
3
3
  # Current version
4
4
  # @return [String]
5
- VERSION = "2.4.0".freeze
5
+ VERSION = "2.5.0".freeze
6
6
 
7
7
  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: 2.4.0
4
+ version: 2.5.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: 2013-10-07 00:00:00.000000000 Z
13
+ date: 2013-10-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler