octokit 4.6.2 → 6.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +5 -5
  2. data/CONTRIBUTING.md +14 -13
  3. data/LICENSE.md +1 -1
  4. data/README.md +239 -118
  5. data/Rakefile +12 -12
  6. data/lib/ext/sawyer/relation.rb +4 -2
  7. data/lib/octokit/arguments.rb +2 -2
  8. data/lib/octokit/authentication.rb +20 -14
  9. data/lib/octokit/client/actions_artifacts.rb +71 -0
  10. data/lib/octokit/client/actions_secrets.rb +59 -0
  11. data/lib/octokit/client/actions_workflow_jobs.rb +65 -0
  12. data/lib/octokit/client/actions_workflow_runs.rb +125 -0
  13. data/lib/octokit/client/actions_workflows.rb +68 -0
  14. data/lib/octokit/client/apps.rb +222 -0
  15. data/lib/octokit/client/checks.rb +200 -0
  16. data/lib/octokit/client/commit_branches.rb +20 -0
  17. data/lib/octokit/client/commit_comments.rb +8 -8
  18. data/lib/octokit/client/commit_pulls.rb +20 -0
  19. data/lib/octokit/client/commits.rb +31 -34
  20. data/lib/octokit/client/community_profile.rb +21 -0
  21. data/lib/octokit/client/contents.rb +25 -20
  22. data/lib/octokit/client/deployments.rb +25 -5
  23. data/lib/octokit/client/downloads.rb +5 -6
  24. data/lib/octokit/client/emojis.rb +3 -3
  25. data/lib/octokit/client/environments.rb +55 -0
  26. data/lib/octokit/client/events.rb +4 -4
  27. data/lib/octokit/client/feeds.rb +4 -5
  28. data/lib/octokit/client/gists.rb +7 -6
  29. data/lib/octokit/client/gitignore.rb +3 -3
  30. data/lib/octokit/client/hooks.rb +9 -19
  31. data/lib/octokit/client/issues.rb +60 -14
  32. data/lib/octokit/client/labels.rb +17 -17
  33. data/lib/octokit/client/legacy_search.rb +3 -3
  34. data/lib/octokit/client/licenses.rb +4 -7
  35. data/lib/octokit/client/markdown.rb +3 -3
  36. data/lib/octokit/client/marketplace.rb +56 -0
  37. data/lib/octokit/client/meta.rb +4 -5
  38. data/lib/octokit/client/milestones.rb +5 -5
  39. data/lib/octokit/client/notifications.rb +6 -10
  40. data/lib/octokit/client/oauth_applications.rb +116 -0
  41. data/lib/octokit/client/objects.rb +14 -14
  42. data/lib/octokit/client/organizations.rb +238 -61
  43. data/lib/octokit/client/pages.rb +5 -7
  44. data/lib/octokit/client/projects.rb +50 -70
  45. data/lib/octokit/client/pub_sub_hubbub.rb +16 -16
  46. data/lib/octokit/client/pull_requests.rb +58 -46
  47. data/lib/octokit/client/rate_limit.rb +11 -13
  48. data/lib/octokit/client/reactions.rb +6 -11
  49. data/lib/octokit/client/refs.rb +32 -19
  50. data/lib/octokit/client/releases.rb +14 -13
  51. data/lib/octokit/client/repositories.rb +195 -54
  52. data/lib/octokit/client/repository_invitations.rb +4 -11
  53. data/lib/octokit/client/reviews.rb +227 -0
  54. data/lib/octokit/client/say.rb +4 -5
  55. data/lib/octokit/client/search.rb +46 -17
  56. data/lib/octokit/client/service_status.rb +19 -9
  57. data/lib/octokit/client/source_import.rb +8 -13
  58. data/lib/octokit/client/stats.rb +12 -9
  59. data/lib/octokit/client/statuses.rb +6 -6
  60. data/lib/octokit/client/tokens.rb +31 -0
  61. data/lib/octokit/client/traffic.rb +6 -11
  62. data/lib/octokit/client/users.rb +106 -25
  63. data/lib/octokit/client.rb +66 -17
  64. data/lib/octokit/configurable.rb +42 -30
  65. data/lib/octokit/connection.rb +43 -21
  66. data/lib/octokit/default.rb +63 -34
  67. data/lib/octokit/enterprise_admin_client/admin_stats.rb +14 -15
  68. data/lib/octokit/enterprise_admin_client/license.rb +4 -5
  69. data/lib/octokit/enterprise_admin_client/orgs.rb +5 -6
  70. data/lib/octokit/enterprise_admin_client/search_indexing.rb +8 -9
  71. data/lib/octokit/enterprise_admin_client/users.rb +17 -16
  72. data/lib/octokit/enterprise_admin_client.rb +9 -3
  73. data/lib/octokit/enterprise_management_console_client/management_console.rb +33 -33
  74. data/lib/octokit/enterprise_management_console_client.rb +9 -3
  75. data/lib/octokit/error.rb +107 -26
  76. data/lib/octokit/gist.rb +4 -5
  77. data/lib/octokit/middleware/follow_redirects.rb +17 -13
  78. data/lib/octokit/organization.rb +3 -1
  79. data/lib/octokit/rate_limit.rb +11 -9
  80. data/lib/octokit/repo_arguments.rb +2 -3
  81. data/lib/octokit/repository.rb +27 -25
  82. data/lib/octokit/response/base_middleware.rb +10 -0
  83. data/lib/octokit/response/feed_parser.rb +5 -9
  84. data/lib/octokit/response/raise_error.rb +4 -6
  85. data/lib/octokit/user.rb +4 -2
  86. data/lib/octokit/version.rb +5 -3
  87. data/lib/octokit/warnable.rb +4 -5
  88. data/lib/octokit.rb +15 -8
  89. data/octokit.gemspec +13 -10
  90. metadata +55 -22
  91. data/lib/octokit/client/authorizations.rb +0 -244
  92. data/lib/octokit/preview.rb +0 -35
metadata CHANGED
@@ -1,51 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octokit
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.6.2
4
+ version: 6.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wynn Netherland
8
8
  - Erik Michaels-Ober
9
9
  - Clint Shryock
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-11-22 00:00:00.000000000 Z
13
+ date: 2023-04-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - "~>"
19
+ - - ">="
20
+ - !ruby/object:Gem::Version
21
+ version: '1'
22
+ - - "<"
20
23
  - !ruby/object:Gem::Version
21
- version: '1.0'
24
+ version: '3'
22
25
  type: :development
23
26
  prerelease: false
24
27
  version_requirements: !ruby/object:Gem::Requirement
25
28
  requirements:
26
- - - "~>"
29
+ - - ">="
27
30
  - !ruby/object:Gem::Version
28
- version: '1.0'
31
+ version: '1'
32
+ - - "<"
33
+ - !ruby/object:Gem::Version
34
+ version: '3'
29
35
  - !ruby/object:Gem::Dependency
30
- name: sawyer
36
+ name: faraday
31
37
  requirement: !ruby/object:Gem::Requirement
32
38
  requirements:
33
39
  - - ">="
34
40
  - !ruby/object:Gem::Version
35
- version: 0.5.3
36
- - - "~>"
41
+ version: '1'
42
+ - - "<"
37
43
  - !ruby/object:Gem::Version
38
- version: 0.8.0
44
+ version: '3'
39
45
  type: :runtime
40
46
  prerelease: false
41
47
  version_requirements: !ruby/object:Gem::Requirement
42
48
  requirements:
43
49
  - - ">="
44
50
  - !ruby/object:Gem::Version
45
- version: 0.5.3
51
+ version: '1'
52
+ - - "<"
53
+ - !ruby/object:Gem::Version
54
+ version: '3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: sawyer
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.9'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
46
66
  - - "~>"
47
67
  - !ruby/object:Gem::Version
48
- version: 0.8.0
68
+ version: '0.9'
49
69
  description: Simple wrapper for the GitHub API
50
70
  email:
51
71
  - wynn.netherland@gmail.com
@@ -65,13 +85,23 @@ files:
65
85
  - lib/octokit/arguments.rb
66
86
  - lib/octokit/authentication.rb
67
87
  - lib/octokit/client.rb
68
- - lib/octokit/client/authorizations.rb
88
+ - lib/octokit/client/actions_artifacts.rb
89
+ - lib/octokit/client/actions_secrets.rb
90
+ - lib/octokit/client/actions_workflow_jobs.rb
91
+ - lib/octokit/client/actions_workflow_runs.rb
92
+ - lib/octokit/client/actions_workflows.rb
93
+ - lib/octokit/client/apps.rb
94
+ - lib/octokit/client/checks.rb
95
+ - lib/octokit/client/commit_branches.rb
69
96
  - lib/octokit/client/commit_comments.rb
97
+ - lib/octokit/client/commit_pulls.rb
70
98
  - lib/octokit/client/commits.rb
99
+ - lib/octokit/client/community_profile.rb
71
100
  - lib/octokit/client/contents.rb
72
101
  - lib/octokit/client/deployments.rb
73
102
  - lib/octokit/client/downloads.rb
74
103
  - lib/octokit/client/emojis.rb
104
+ - lib/octokit/client/environments.rb
75
105
  - lib/octokit/client/events.rb
76
106
  - lib/octokit/client/feeds.rb
77
107
  - lib/octokit/client/gists.rb
@@ -82,9 +112,11 @@ files:
82
112
  - lib/octokit/client/legacy_search.rb
83
113
  - lib/octokit/client/licenses.rb
84
114
  - lib/octokit/client/markdown.rb
115
+ - lib/octokit/client/marketplace.rb
85
116
  - lib/octokit/client/meta.rb
86
117
  - lib/octokit/client/milestones.rb
87
118
  - lib/octokit/client/notifications.rb
119
+ - lib/octokit/client/oauth_applications.rb
88
120
  - lib/octokit/client/objects.rb
89
121
  - lib/octokit/client/organizations.rb
90
122
  - lib/octokit/client/pages.rb
@@ -97,12 +129,14 @@ files:
97
129
  - lib/octokit/client/releases.rb
98
130
  - lib/octokit/client/repositories.rb
99
131
  - lib/octokit/client/repository_invitations.rb
132
+ - lib/octokit/client/reviews.rb
100
133
  - lib/octokit/client/say.rb
101
134
  - lib/octokit/client/search.rb
102
135
  - lib/octokit/client/service_status.rb
103
136
  - lib/octokit/client/source_import.rb
104
137
  - lib/octokit/client/stats.rb
105
138
  - lib/octokit/client/statuses.rb
139
+ - lib/octokit/client/tokens.rb
106
140
  - lib/octokit/client/traffic.rb
107
141
  - lib/octokit/client/users.rb
108
142
  - lib/octokit/configurable.rb
@@ -120,10 +154,10 @@ files:
120
154
  - lib/octokit/gist.rb
121
155
  - lib/octokit/middleware/follow_redirects.rb
122
156
  - lib/octokit/organization.rb
123
- - lib/octokit/preview.rb
124
157
  - lib/octokit/rate_limit.rb
125
158
  - lib/octokit/repo_arguments.rb
126
159
  - lib/octokit/repository.rb
160
+ - lib/octokit/response/base_middleware.rb
127
161
  - lib/octokit/response/feed_parser.rb
128
162
  - lib/octokit/response/raise_error.rb
129
163
  - lib/octokit/user.rb
@@ -133,8 +167,9 @@ files:
133
167
  homepage: https://github.com/octokit/octokit.rb
134
168
  licenses:
135
169
  - MIT
136
- metadata: {}
137
- post_install_message:
170
+ metadata:
171
+ rubygems_mfa_required: 'true'
172
+ post_install_message:
138
173
  rdoc_options: []
139
174
  require_paths:
140
175
  - lib
@@ -142,17 +177,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
142
177
  requirements:
143
178
  - - ">="
144
179
  - !ruby/object:Gem::Version
145
- version: 2.0.0
180
+ version: 2.7.0
146
181
  required_rubygems_version: !ruby/object:Gem::Requirement
147
182
  requirements:
148
183
  - - ">="
149
184
  - !ruby/object:Gem::Version
150
185
  version: 1.3.5
151
186
  requirements: []
152
- rubyforge_project:
153
- rubygems_version: 2.4.5.1
154
- signing_key:
187
+ rubygems_version: 3.1.2
188
+ signing_key:
155
189
  specification_version: 4
156
190
  summary: Ruby toolkit for working with the GitHub API
157
191
  test_files: []
158
- has_rdoc:
@@ -1,244 +0,0 @@
1
- module Octokit
2
- class Client
3
-
4
- # Methods for the Authorizations API
5
- #
6
- # @see https://developer.github.com/v3/oauth_authorizations/#oauth-authorizations-api
7
- module Authorizations
8
-
9
- # List the authenticated user's authorizations
10
- #
11
- # API for users to manage their own tokens.
12
- # You can only access your own tokens, and only through
13
- # Basic Authentication.
14
- #
15
- # @return [Array<Sawyer::Resource>] A list of authorizations for the authenticated user
16
- # @see https://developer.github.com/v3/oauth_authorizations/#list-your-authorizations
17
- # @example List authorizations for user ctshryock
18
- # client = Octokit::Client.new(:login => 'ctshryock', :password => 'secret')
19
- # client.authorizations
20
- def authorizations(options = {})
21
- paginate 'authorizations', options
22
- end
23
-
24
- # Get a single authorization for the authenticated user.
25
- #
26
- # You can only access your own tokens, and only through
27
- # Basic Authentication.
28
- #
29
- # @return [Sawyer::Resource] A single authorization for the authenticated user
30
- # @see https://developer.github.com/v3/oauth_authorizations/#get-a-single-authorization
31
- # @example Show authorization for user ctshryock's Travis auth
32
- # client = Octokit::Client.new(:login => 'ctshryock', :password => 'secret')
33
- # client.authorization(999999)
34
- def authorization(number, options = {})
35
- get "authorizations/#{number}", options
36
- end
37
-
38
- # Create an authorization for the authenticated user.
39
- #
40
- # You can create your own tokens, and only through
41
- # Basic Authentication.
42
- #
43
- # @param options [Hash] A customizable set of options.
44
- # @option options [Array] :scopes A list of scopes that this authorization is in.
45
- # @option options [String] :note A note to remind you what the OAuth token is for.
46
- # @option options [String] :note_url A URL to remind you what app the OAuth token is for.
47
- # @option options [Boolean] :idempotent If true, will return an existing authorization if one has already been created.
48
- # @option options [String] :client_id Client Id 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
- #
51
- # @return [Sawyer::Resource] A single authorization for the authenticated user
52
- # @see https://developer.github.com/v3/oauth/#scopes Available scopes
53
- # @see https://developer.github.com/v3/oauth_authorizations/#create-a-new-authorization
54
- # @see https://developer.github.com/v3/oauth_authorizations/#get-or-create-an-authorization-for-a-specific-app
55
- # @example Create a new authorization for user ctshryock's project Zoidberg
56
- # client = Octokit::Client.new(:login => 'ctshryock', :password => 'secret')
57
- # client.create_authorization({:scopes => ["public_repo", "gist"], :note => "Why not Zoidberg?", :note_url=> "https://en.wikipedia.org/wiki/Zoidberg"})
58
- # @example Create a new OR return an existing authorization to be used by a specific client for user ctshryock's project Zoidberg
59
- # client = Octokit::Client.new(:login => 'ctshryock', :password => 'secret')
60
- # client.create_authorization({:idempotent => true, :client_id => 'xxxx', :client_secret => 'yyyy', :scopes => ["user"]})
61
- def create_authorization(options = {})
62
- # Techincally we can omit scopes as GitHub has a default, however the
63
- # API will reject us if we send a POST request with an empty body.
64
-
65
- if options.delete :idempotent
66
- client_id, client_secret = fetch_client_id_and_secret(options)
67
- raise ArgumentError.new("Client ID and Secret required for idempotent authorizations") unless client_id && client_secret
68
-
69
- if fingerprint = options.delete(:fingerprint)
70
- put "authorizations/clients/#{client_id}/#{fingerprint}", options.merge(:client_secret => client_secret)
71
- else
72
- put "authorizations/clients/#{client_id}", options.merge(:client_secret => client_secret)
73
- end
74
-
75
- else
76
- post 'authorizations', options
77
- end
78
- end
79
-
80
- # Update an authorization for the authenticated user.
81
- #
82
- # You can update your own tokens, but only through
83
- # Basic Authentication.
84
- #
85
- # @param options [Hash] A customizable set of options.
86
- # @option options [Array] :scopes Replace the authorization scopes with these.
87
- # @option options [Array] :add_scopes A list of scopes to add to this authorization.
88
- # @option options [Array] :remove_scopes A list of scopes to remove from this authorization.
89
- # @option options [String] :note A note to remind you what the OAuth token is for.
90
- # @option options [String] :note_url A URL to remind you what app the OAuth token is for.
91
- #
92
- # @return [Sawyer::Resource] A single (updated) authorization for the authenticated user
93
- # @see https://developer.github.com/v3/oauth_authorizations/#update-an-existing-authorization
94
- # @see https://developer.github.com/v3/oauth/#scopes for available scopes
95
- # @example Update the authorization for user ctshryock's project Zoidberg
96
- # client = Octokit::Client.new(:login => 'ctshryock', :password => 'secret')
97
- # client.update_authorization(999999, {:add_scopes => ["gist", "repo"], :note => "Why not Zoidberg possibly?"})
98
- def update_authorization(number, options = {})
99
- patch "authorizations/#{number}", options
100
- end
101
-
102
- # Delete an authorization for the authenticated user.
103
- #
104
- # You can delete your own tokens, and only through
105
- # Basic Authentication.
106
- #
107
- # @param number [Number] An existing Authorization ID
108
- #
109
- # @return [Boolean] Success
110
- # @see https://developer.github.com/v3/oauth_authorizations/#delete-an-authorization
111
- # @example Delete an authorization
112
- # client = Octokit::Client.new(:login => 'ctshryock', :password => 'secret')
113
- # client.delete_authorization(999999)
114
- def delete_authorization(number, options = {})
115
- boolean_from_response :delete, "authorizations/#{number}", options
116
- end
117
-
118
- # Check scopes for a token
119
- #
120
- # @param token [String] GitHub OAuth token
121
- # @param options [Hash] Header params for request
122
- # @return [Array<String>] OAuth scopes
123
- # @see https://developer.github.com/v3/oauth/#scopes
124
- def scopes(token = @access_token, options = {})
125
- raise ArgumentError.new("Access token required") if token.nil?
126
-
127
- auth = { "Authorization" => "token #{token}" }
128
- headers = (options.delete(:headers) || {}).merge(auth)
129
-
130
- agent.call(:get, "user", :headers => headers).
131
- headers['X-OAuth-Scopes'].
132
- to_s.
133
- split(',').
134
- map(&:strip).
135
- sort
136
- end
137
-
138
- # Check if a token is valid.
139
- #
140
- # Applications can check if a token is valid without rate limits.
141
- #
142
- # @param token [String] 40 character GitHub OAuth access token
143
- #
144
- # @return [Sawyer::Resource] A single authorization for the authenticated user
145
- # @see https://developer.github.com/v3/oauth_authorizations/#check-an-authorization
146
- # @example
147
- # client = Octokit::Client.new(:client_id => 'abcdefg12345', :client_secret => 'secret')
148
- # client.check_application_authorization('deadbeef1234567890deadbeef987654321')
149
- def check_application_authorization(token, options = {})
150
- opts = options.dup
151
- key = opts.delete(:client_id) || client_id
152
- secret = opts.delete(:client_secret) || client_secret
153
-
154
- as_app(key, secret) do |app_client|
155
- app_client.get "/applications/#{client_id}/tokens/#{token}", opts
156
- end
157
- end
158
-
159
- # Reset a token
160
- #
161
- # Applications can reset a token without requiring a user to re-authorize.
162
- #
163
- # @param token [String] 40 character GitHub OAuth access token
164
- #
165
- # @return [Sawyer::Resource] A single authorization for the authenticated user
166
- # @see https://developer.github.com/v3/oauth_authorizations/#reset-an-authorization
167
- # @example
168
- # client = Octokit::Client.new(:client_id => 'abcdefg12345', :client_secret => 'secret')
169
- # client.reset_application_authorization('deadbeef1234567890deadbeef987654321')
170
- def reset_application_authorization(token, options = {})
171
- opts = options.dup
172
- key = opts.delete(:client_id) || client_id
173
- secret = opts.delete(:client_secret) || client_secret
174
-
175
- as_app(key, secret) do |app_client|
176
- app_client.post "/applications/#{client_id}/tokens/#{token}", opts
177
- end
178
- end
179
-
180
- # Revoke a token
181
- #
182
- # Applications can revoke (delete) a token
183
- #
184
- # @param token [String] 40 character GitHub OAuth access token
185
- #
186
- # @return [Boolean] Result
187
- # @see https://developer.github.com/v3/oauth_authorizations/#revoke-an-authorization-for-an-application
188
- # @example
189
- # client = Octokit::Client.new(:client_id => 'abcdefg12345', :client_secret => 'secret')
190
- # client.revoke_application_authorization('deadbeef1234567890deadbeef987654321')
191
- def revoke_application_authorization(token, options = {})
192
- opts = options.dup
193
- key = opts.delete(:client_id) || client_id
194
- secret = opts.delete(:client_secret) || client_secret
195
-
196
- as_app(key, secret) do |app_client|
197
- app_client.delete "/applications/#{client_id}/tokens/#{token}", opts
198
-
199
- app_client.last_response.status == 204
200
- end
201
- rescue Octokit::NotFound
202
- false
203
- end
204
- alias :delete_application_authorization :revoke_application_authorization
205
-
206
- # Revoke all tokens for an app
207
- #
208
- # Applications can revoke all of their tokens in a single request
209
- #
210
- # @deprecated As of January 25th, 2016: https://developer.github.com/changes/2014-04-08-reset-api-tokens/
211
- # @return [Boolean] false
212
- def revoke_all_application_authorizations(options = {})
213
- octokit_warn("Deprecated: If you need to revoke all tokens for your application, you can do so via the settings page for your application.")
214
- false
215
- end
216
-
217
- # Get the URL to authorize a user for an application via the web flow
218
- #
219
- # @param app_id [String] Client Id we received when our application was registered with GitHub.
220
- # @option options [String] :redirect_uri The url to redirect to after authorizing.
221
- # @option options [String] :scope The scopes to request from the user.
222
- # @option options [String] :state A random string to protect against CSRF.
223
- # @return [String] The url to redirect the user to authorize.
224
- # @see Octokit::Client
225
- # @see https://developer.github.com/v3/oauth/#web-application-flow
226
- # @example
227
- # @client.authorize_url('xxxx')
228
- def authorize_url(app_id = client_id, options = {})
229
- if app_id.to_s.empty?
230
- raise Octokit::ApplicationCredentialsRequired.new "client_id required"
231
- end
232
- authorize_url = options.delete(:endpoint) || Octokit.web_endpoint
233
- authorize_url << "login/oauth/authorize?client_id=#{app_id}"
234
-
235
- require 'cgi'
236
- options.each do |key, value|
237
- authorize_url << "&#{key}=#{CGI.escape value}"
238
- end
239
-
240
- authorize_url
241
- end
242
- end
243
- end
244
- end
@@ -1,35 +0,0 @@
1
- module Octokit
2
-
3
- # Default setup options for preview features
4
- module Preview
5
-
6
- PREVIEW_TYPES = {
7
- :branch_protection => 'application/vnd.github.loki-preview+json'.freeze,
8
- :migrations => 'application/vnd.github.wyandotte-preview+json'.freeze,
9
- :licenses => 'application/vnd.github.drax-preview+json'.freeze,
10
- :source_imports => 'application/vnd.github.barred-rock-preview'.freeze,
11
- :reactions => 'application/vnd.github.squirrel-girl-preview'.freeze,
12
- :repository_invitations => 'application/vnd.github.swamp-thing-preview+json'.freeze,
13
- :issue_timelines => 'application/vnd.github.mockingbird-preview+json'.freeze,
14
- :pages => 'application/vnd.github.mister-fantastic-preview+json'.freeze,
15
- :projects => 'application/vnd.github.inertia-preview+json'.freeze,
16
- :traffic => 'application/vnd.github.spiderman-preview'.freeze
17
- }
18
-
19
- def ensure_api_media_type(type, options)
20
- if options[:accept].nil?
21
- options[:accept] = PREVIEW_TYPES[type]
22
- warn_preview(type)
23
- end
24
- options
25
- end
26
-
27
- def warn_preview(type)
28
- octokit_warn <<-EOS
29
- WARNING: The preview version of the #{type.to_s.capitalize} API is not yet suitable for production use.
30
- You can avoid this message by supplying an appropriate media type in the 'Accept' request
31
- header.
32
- EOS
33
- end
34
- end
35
- end