octokit 5.1.0 → 5.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: abc3f58113bc1ba895a10399af08ffa4cb77046d7ec70b58772fd562a7136f7c
4
- data.tar.gz: ccb63539ce291e0146c604643445ca0a4013d6329f6345f3dee4a92d01206970
3
+ metadata.gz: 971671d7bf27fc19d9cd0072a73bb39d2ed82dfcfff2c0bf1d897d889bb34d81
4
+ data.tar.gz: 12bf586942ad3004b5aaf109aa0cd394429742160f486b03ead76523ba6ddd0f
5
5
  SHA512:
6
- metadata.gz: ca2ff431a0b98c1e38ec32c6fe46c405d5f741a97b33b3288bf44c1cb6641da1ddbd91988114f2174a0740c75c5ab4a63b2b61111a77dfe06ce77ea2b02280dd
7
- data.tar.gz: 83638f66161513b9f437906515e3f83bc205b1003d9c7fa11d96579d3bab05b19adfd2969c4b59f44d568b9924c75f16fd5aee91b907d6dc3d655e816a9317b4
6
+ metadata.gz: 766b52be3c9bfb04e5c5d049617e211e1f2cdf66611c1634475688f87fa94ab2252a299147ef917a3eb634ced46558042fcf06364098cb5d60664d3481519cd3
7
+ data.tar.gz: f8f75a3e85310b927801f98290ac7cc7643b918715026e621e2bc5de6887eefda47c28fabb8ab14040df234011ced8b6488216a3ca8a64614eb528d488ebfc9f
@@ -14,7 +14,6 @@ module Octokit
14
14
  # @example Get community profile metrics for octokit/octokit.rb
15
15
  # @client.community_profile('octokit/octokit.rb')
16
16
  def community_profile(repo, options = {})
17
- options = ensure_api_media_type(:community_profile, options)
18
17
  get "#{Repository.path repo}/community/profile", options
19
18
  end
20
19
  end
@@ -131,7 +131,6 @@ module Octokit
131
131
  # @example List all issues events for issue #38 on octokit/octokit.rb
132
132
  # Octokit.issue_events("octokit/octokit.rb", 38)
133
133
  def issue_events(repo, number, options = {})
134
- options = ensure_api_media_type(:project_card_events, options)
135
134
  paginate "#{Repository.path repo}/issues/#{number}/events", options
136
135
  end
137
136
 
@@ -318,7 +318,6 @@ module Octokit
318
318
  # @example Get timeline for issue #1435 on octokit/octokit.rb
319
319
  # Octokit.issue_timeline("octokit/octokit.rb", 1435)
320
320
  def issue_timeline(repo, number, options = {})
321
- options = ensure_api_media_type(:issue_timelines, options)
322
321
  paginate "#{Repository.path repo}/issues/#{number}/timeline", options
323
322
  end
324
323
 
@@ -12,7 +12,6 @@ module Octokit
12
12
  # @example
13
13
  # Octokit.licenses
14
14
  def licenses(options = {})
15
- options = ensure_api_media_type(:licenses, options)
16
15
  paginate 'licenses', options
17
16
  end
18
17
 
@@ -24,7 +23,6 @@ module Octokit
24
23
  # @example
25
24
  # Octokit.license 'mit'
26
25
  def license(license_name, options = {})
27
- options = ensure_api_media_type(:licenses, options)
28
26
  get "licenses/#{license_name}", options
29
27
  end
30
28
 
@@ -37,7 +35,6 @@ module Octokit
37
35
  # @example
38
36
  # Octokit.repository_license_contents 'benbalter/licensee'
39
37
  def repository_license_contents(repo, options = {})
40
- options = ensure_api_media_type(:licenses, options)
41
38
  get "#{Repository.path repo}/license", options
42
39
  end
43
40
  end
@@ -19,7 +19,6 @@ module Octokit
19
19
  # client = Octokit::Client.new(:client_id => 'abcdefg12345', :client_secret => 'secret')
20
20
  # client.check_token('deadbeef1234567890deadbeef987654321')
21
21
  def check_token(access_token, options = {})
22
- options = ensure_api_media_type(:applications_api, options.dup)
23
22
  options[:access_token] = access_token
24
23
 
25
24
  key = options.delete(:client_id) || client_id
@@ -44,7 +43,6 @@ module Octokit
44
43
  # client = Octokit::Client.new(:client_id => 'abcdefg12345', :client_secret => 'secret')
45
44
  # client.reset_token('deadbeef1234567890deadbeef987654321')
46
45
  def reset_token(access_token, options = {})
47
- options = ensure_api_media_type(:applications_api, options.dup)
48
46
  options[:access_token] = access_token
49
47
 
50
48
  key = options.delete(:client_id) || client_id
@@ -69,7 +67,6 @@ module Octokit
69
67
  # client = Octokit::Client.new(:client_id => 'abcdefg12345', :client_secret => 'secret')
70
68
  # client.delete_token('deadbeef1234567890deadbeef987654321')
71
69
  def delete_app_token(access_token, options = {})
72
- options = ensure_api_media_type(:applications_api, options.dup)
73
70
  options[:access_token] = access_token
74
71
 
75
72
  key = options.delete(:client_id) || client_id
@@ -100,7 +97,6 @@ module Octokit
100
97
  # client = Octokit::Client.new(:client_id => 'abcdefg12345', :client_secret => 'secret')
101
98
  # client.delete_app_authorization('deadbeef1234567890deadbeef987654321')
102
99
  def delete_app_authorization(access_token, options = {})
103
- options = ensure_api_media_type(:applications_api, options.dup)
104
100
  options[:access_token] = access_token
105
101
 
106
102
  key = options.delete(:client_id) || client_id
@@ -305,9 +305,6 @@ module Octokit
305
305
  if options.key?(:permission)
306
306
  octokit_warn 'Deprecated: Passing :permission option to #create_team. Assign team repository permission by passing :permission to #add_team_repository instead.'
307
307
  end
308
- if options.key?(:parent_team_id)
309
- options = ensure_api_media_type(:nested_teams, options)
310
- end
311
308
  post "#{Organization.path org}/teams", options
312
309
  end
313
310
 
@@ -348,7 +345,6 @@ module Octokit
348
345
  # @example
349
346
  # @client.child_teams(100000, :accept => "application/vnd.github.hellcat-preview+json")
350
347
  def child_teams(team_id, options = {})
351
- options = ensure_api_media_type(:nested_teams, options)
352
348
  paginate "teams/#{team_id}/teams", options
353
349
  end
354
350
 
@@ -372,9 +368,6 @@ module Octokit
372
368
  # :permission => 'push'
373
369
  # })
374
370
  def update_team(team_id, options = {})
375
- if options.key?(:parent_team_id)
376
- options = ensure_api_media_type(:nested_teams, options)
377
- end
378
371
  patch "teams/#{team_id}", options
379
372
  end
380
373
 
@@ -733,7 +726,6 @@ module Octokit
733
726
  # @client.start_migration('github', ['github/dotfiles'])
734
727
  # @see https://docs.github.com/en/rest/reference/migrations#start-an-organization-migration
735
728
  def start_migration(org, repositories, options = {})
736
- options = ensure_api_media_type(:migrations, options)
737
729
  options[:repositories] = repositories
738
730
  post "#{Organization.path(org)}/migrations", options
739
731
  end
@@ -746,7 +738,6 @@ module Octokit
746
738
  # @return [Array<Sawyer::Resource>] Array of migration resources.
747
739
  # @see https://docs.github.com/en/rest/reference/migrations#list-organization-migrations
748
740
  def migrations(org, options = {})
749
- options = ensure_api_media_type(:migrations, options)
750
741
  paginate "#{Organization.path(org)}/migrations", options
751
742
  end
752
743
 
@@ -758,7 +749,6 @@ module Octokit
758
749
  # @param id [Integer] ID number of the migration.
759
750
  # @see https://docs.github.com/en/rest/reference/migrations#get-an-organization-migration-status
760
751
  def migration_status(org, id, options = {})
761
- options = ensure_api_media_type(:migrations, options)
762
752
  get "#{Organization.path(org)}/migrations/#{id}", options
763
753
  end
764
754
 
@@ -770,7 +760,6 @@ module Octokit
770
760
  # @param id [Integer] ID number of the migration.
771
761
  # @see https://docs.github.com/en/rest/reference/migrations#download-an-organization-migration-archive
772
762
  def migration_archive_url(org, id, options = {})
773
- options = ensure_api_media_type(:migrations, options)
774
763
  url = "#{Organization.path(org)}/migrations/#{id}/archive"
775
764
 
776
765
  response = client_without_redirects(options).get(url)
@@ -785,7 +774,6 @@ module Octokit
785
774
  # @param id [Integer] ID number of the migration.
786
775
  # @see https://docs.github.com/en/rest/reference/migrations#delete-an-organization-migration-archive
787
776
  def delete_migration_archive(org, id, options = {})
788
- options = ensure_api_media_type(:migrations, options)
789
777
  delete "#{Organization.path(org)}/migrations/#{id}/archive", options
790
778
  end
791
779
 
@@ -798,7 +786,6 @@ module Octokit
798
786
  # @param repo [String] Name of the repository.
799
787
  # @see https://docs.github.com/en/rest/reference/migrations#unlock-an-organization-repository
800
788
  def unlock_repository(org, id, repo, options = {})
801
- options = ensure_api_media_type(:migrations, options)
802
789
  delete "#{Organization.path(org)}/migrations/#{id}/repos/#{repo}/lock", options
803
790
  end
804
791
 
@@ -24,8 +24,7 @@ module Octokit
24
24
  # @example
25
25
  # Octokit.pages_build("github/developer.github.com", 5472601)
26
26
  def pages_build(repo, id, options = {})
27
- opts = ensure_api_media_type(:pages, options)
28
- get "#{Repository.path repo}/pages/builds/#{id}", opts
27
+ get "#{Repository.path repo}/pages/builds/#{id}", options
29
28
  end
30
29
 
31
30
  # List Pages builds for a repository
@@ -55,8 +54,7 @@ module Octokit
55
54
  # @return [Sawyer::Resource] Request result
56
55
  # @see https://developer.github.com/v3/repos/pages/#request-a-page-build
57
56
  def request_page_build(repo, options = {})
58
- opts = ensure_api_media_type(:pages, options)
59
- post "#{Repository.path repo}/pages/builds", opts
57
+ post "#{Repository.path repo}/pages/builds", options
60
58
  end
61
59
  end
62
60
  end
@@ -16,8 +16,7 @@ module Octokit
16
16
  # @example
17
17
  # @client.projects('octokit/octokit.rb')
18
18
  def projects(repo, options = {})
19
- opts = ensure_api_media_type(:projects, options)
20
- paginate "#{Repository.path repo}/projects", opts
19
+ paginate "#{Repository.path repo}/projects", options
21
20
  end
22
21
 
23
22
  # Create a project
@@ -35,9 +34,8 @@ module Octokit
35
34
  # @example Create project with name and body
36
35
  # @client.create_project('octokit/octokit.rb', 'bugs be gone', body: 'Fix all the bugs @joeyw creates')
37
36
  def create_project(repo, name, options = {})
38
- opts = ensure_api_media_type(:projects, options)
39
- opts[:name] = name
40
- post "#{Repository.path repo}/projects", opts
37
+ options[:name] = name
38
+ post "#{Repository.path repo}/projects", options
41
39
  end
42
40
 
43
41
  # List organization projects
@@ -50,8 +48,7 @@ module Octokit
50
48
  # @example
51
49
  # @client.org_projects("octokit")
52
50
  def org_projects(org, options = {})
53
- opts = ensure_api_media_type(:projects, options)
54
- paginate "orgs/#{org}/projects", opts
51
+ paginate "orgs/#{org}/projects", options
55
52
  end
56
53
  alias organization_projects org_projects
57
54
 
@@ -69,9 +66,8 @@ module Octokit
69
66
  # @example Create a project with name and body
70
67
  # @client.create_org_project("octokit", "octocan", body: 'Improve clients')
71
68
  def create_org_project(org, name, options = {})
72
- opts = ensure_api_media_type(:projects, options)
73
- opts[:name] = name
74
- post "orgs/#{org}/projects", opts
69
+ options[:name] = name
70
+ post "orgs/#{org}/projects", options
75
71
  end
76
72
  alias create_organization_project create_org_project
77
73
 
@@ -83,8 +79,7 @@ module Octokit
83
79
  # @example
84
80
  # Octokit.project(123942)
85
81
  def project(id, options = {})
86
- opts = ensure_api_media_type(:projects, options)
87
- get "projects/#{id}", opts
82
+ get "projects/#{id}", options
88
83
  end
89
84
 
90
85
  # Update a project
@@ -99,8 +94,7 @@ module Octokit
99
94
  # @example Update project name
100
95
  # @client.update_project(123942, name: 'New name')
101
96
  def update_project(id, options = {})
102
- opts = ensure_api_media_type(:projects, options)
103
- patch "projects/#{id}", opts
97
+ patch "projects/#{id}", options
104
98
  end
105
99
 
106
100
  # Delete a project
@@ -113,8 +107,7 @@ module Octokit
113
107
  # @example
114
108
  # @client.delete_project(123942)
115
109
  def delete_project(id, options = {})
116
- opts = ensure_api_media_type(:projects, options)
117
- boolean_from_response :delete, "projects/#{id}", opts
110
+ boolean_from_response :delete, "projects/#{id}", options
118
111
  end
119
112
 
120
113
  # List project columns
@@ -125,8 +118,7 @@ module Octokit
125
118
  # @example
126
119
  # @client.project_columns(123942)
127
120
  def project_columns(id, options = {})
128
- opts = ensure_api_media_type(:projects, options)
129
- paginate "projects/#{id}/columns", opts
121
+ paginate "projects/#{id}/columns", options
130
122
  end
131
123
 
132
124
  # Create a project column
@@ -140,9 +132,8 @@ module Octokit
140
132
  # @example
141
133
  # @client.create_project_column(123942, "To Dones")
142
134
  def create_project_column(id, name, options = {})
143
- opts = ensure_api_media_type(:projects, options)
144
- opts[:name] = name
145
- post "projects/#{id}/columns", opts
135
+ options[:name] = name
136
+ post "projects/#{id}/columns", options
146
137
  end
147
138
 
148
139
  # Get a project column by ID
@@ -153,8 +144,7 @@ module Octokit
153
144
  # @example
154
145
  # Octokit.project_column(30294)
155
146
  def project_column(id, options = {})
156
- opts = ensure_api_media_type(:projects, options)
157
- get "projects/columns/#{id}", opts
147
+ get "projects/columns/#{id}", options
158
148
  end
159
149
 
160
150
  # Update a project column
@@ -168,9 +158,8 @@ module Octokit
168
158
  # @example
169
159
  # @client.update_project_column(30294, "new column name")
170
160
  def update_project_column(id, name, options = {})
171
- opts = ensure_api_media_type(:projects, options)
172
- opts[:name] = name
173
- patch "projects/columns/#{id}", opts
161
+ options[:name] = name
162
+ patch "projects/columns/#{id}", options
174
163
  end
175
164
 
176
165
  # Delete a project column
@@ -183,8 +172,7 @@ module Octokit
183
172
  # @example
184
173
  # @client.delete_project_column(30294)
185
174
  def delete_project_column(id, options = {})
186
- opts = ensure_api_media_type(:projects, options)
187
- boolean_from_response :delete, "projects/columns/#{id}", opts
175
+ boolean_from_response :delete, "projects/columns/#{id}", options
188
176
  end
189
177
 
190
178
  # Move a project column
@@ -200,9 +188,8 @@ module Octokit
200
188
  # @example
201
189
  # @client.move_project_column(30294, "last")
202
190
  def move_project_column(id, position, options = {})
203
- opts = ensure_api_media_type(:projects, options)
204
- opts[:position] = position
205
- post "projects/columns/#{id}/moves", opts
191
+ options[:position] = position
192
+ post "projects/columns/#{id}/moves", options
206
193
  end
207
194
 
208
195
  # List columns cards
@@ -215,8 +202,7 @@ module Octokit
215
202
  # @example
216
203
  # @client.column_cards(30294)
217
204
  def column_cards(id, options = {})
218
- opts = ensure_api_media_type(:projects, options)
219
- paginate "projects/columns/#{id}/cards", opts
205
+ paginate "projects/columns/#{id}/cards", options
220
206
  end
221
207
 
222
208
  # Create project card
@@ -238,8 +224,7 @@ module Octokit
238
224
  # @example Create a project card for an repository issue
239
225
  # @client.create_project_card(123495, content_id: 1, content_type: 'Issue')
240
226
  def create_project_card(id, options = {})
241
- opts = ensure_api_media_type(:projects, options)
242
- post "projects/columns/#{id}/cards", opts
227
+ post "projects/columns/#{id}/cards", options
243
228
  end
244
229
 
245
230
  # Get a project card
@@ -252,8 +237,7 @@ module Octokit
252
237
  # @example
253
238
  # @client.project_card(123495)
254
239
  def project_card(id, options = {})
255
- opts = ensure_api_media_type(:projects, options)
256
- get "projects/columns/cards/#{id}", opts
240
+ get "projects/columns/cards/#{id}", options
257
241
  end
258
242
 
259
243
  # Update a project card
@@ -269,8 +253,7 @@ module Octokit
269
253
  # @example
270
254
  # @client.update_project_card(12345, note: 'new note')
271
255
  def update_project_card(id, options = {})
272
- opts = ensure_api_media_type(:projects, options)
273
- patch "projects/columns/cards/#{id}", opts
256
+ patch "projects/columns/cards/#{id}", options
274
257
  end
275
258
 
276
259
  # Move a project card
@@ -290,9 +273,8 @@ module Octokit
290
273
  # @example Move a card to the top of another column
291
274
  # @client.move_project_card(123495, 'top', column_id: 59402)
292
275
  def move_project_card(id, position, options = {})
293
- opts = ensure_api_media_type(:projects, options)
294
- opts[:position] = position
295
- post "projects/columns/cards/#{id}/moves", opts
276
+ options[:position] = position
277
+ post "projects/columns/cards/#{id}/moves", options
296
278
  end
297
279
 
298
280
  # Delete a project card
@@ -305,8 +287,7 @@ module Octokit
305
287
  # @example
306
288
  # @client.delete_project_card(123495)
307
289
  def delete_project_card(id, options = {})
308
- opts = ensure_api_media_type(:projects, options)
309
- boolean_from_response :delete, "projects/columns/cards/#{id}", opts
290
+ boolean_from_response :delete, "projects/columns/cards/#{id}", options
310
291
  end
311
292
  end # Projects
312
293
  end
@@ -17,7 +17,6 @@ module Octokit
17
17
  #
18
18
  # @return [Array<Sawyer::Resource>] Array of Hashes representing the reactions.
19
19
  def commit_comment_reactions(repo, id, options = {})
20
- options = ensure_api_media_type(:reactions, options)
21
20
  get "#{Repository.path repo}/comments/#{id}/reactions", options
22
21
  end
23
22
 
@@ -34,7 +33,7 @@ module Octokit
34
33
  #
35
34
  # @return [<Sawyer::Resource>] Hash representing the reaction
36
35
  def create_commit_comment_reaction(repo, id, reaction, options = {})
37
- options = ensure_api_media_type(:reactions, options.merge(content: reaction))
36
+ options = options.merge(content: reaction)
38
37
  post "#{Repository.path repo}/comments/#{id}/reactions", options
39
38
  end
40
39
 
@@ -49,7 +48,6 @@ module Octokit
49
48
  #
50
49
  # @return [Array<Sawyer::Resource>] Array of Hashes representing the reactions.
51
50
  def issue_reactions(repo, number, options = {})
52
- options = ensure_api_media_type(:reactions, options)
53
51
  get "#{Repository.path repo}/issues/#{number}/reactions", options
54
52
  end
55
53
 
@@ -67,7 +65,7 @@ module Octokit
67
65
  #
68
66
  # @return [<Sawyer::Resource>] Hash representing the reaction.
69
67
  def create_issue_reaction(repo, number, reaction, options = {})
70
- options = ensure_api_media_type(:reactions, options.merge(content: reaction))
68
+ options = options.merge(content: reaction)
71
69
  post "#{Repository.path repo}/issues/#{number}/reactions", options
72
70
  end
73
71
 
@@ -83,7 +81,6 @@ module Octokit
83
81
  #
84
82
  # @return [Array<Sawyer::Resource>] Array of Hashes representing the reactions.
85
83
  def issue_comment_reactions(repo, id, options = {})
86
- options = ensure_api_media_type(:reactions, options)
87
84
  get "#{Repository.path repo}/issues/comments/#{id}/reactions", options
88
85
  end
89
86
 
@@ -101,7 +98,7 @@ module Octokit
101
98
  #
102
99
  # @return [<Sawyer::Resource>] Hashes representing the reaction.
103
100
  def create_issue_comment_reaction(repo, id, reaction, options = {})
104
- options = ensure_api_media_type(:reactions, options.merge(content: reaction))
101
+ options = options.merge(content: reaction)
105
102
  post "#{Repository.path repo}/issues/comments/#{id}/reactions", options
106
103
  end
107
104
 
@@ -117,7 +114,6 @@ module Octokit
117
114
  #
118
115
  # @return [Array<Sawyer::Resource>] Array of Hashes representing the reactions.
119
116
  def pull_request_review_comment_reactions(repo, id, options = {})
120
- options = ensure_api_media_type(:reactions, options)
121
117
  get "#{Repository.path repo}/pulls/comments/#{id}/reactions", options
122
118
  end
123
119
 
@@ -135,7 +131,7 @@ module Octokit
135
131
  #
136
132
  # @return [<Sawyer::Resource>] Hash representing the reaction.
137
133
  def create_pull_request_review_comment_reaction(repo, id, reaction, options = {})
138
- options = ensure_api_media_type(:reactions, options.merge(content: reaction))
134
+ options = options.merge(content: reaction)
139
135
  post "#{Repository.path repo}/pulls/comments/#{id}/reactions", options
140
136
  end
141
137
 
@@ -150,7 +146,6 @@ module Octokit
150
146
  #
151
147
  # @return [Boolean] Return true if reaction was deleted, false otherwise.
152
148
  def delete_reaction(id, options = {})
153
- options = ensure_api_media_type(:reactions, options)
154
149
  boolean_from_response :delete, "reactions/#{id}", options
155
150
  end
156
151
  end
@@ -45,9 +45,6 @@ module Octokit
45
45
  # @return [Sawyer::Resource] Repository information
46
46
  def edit_repository(repo, options = {})
47
47
  repo = Repository.new(repo)
48
- if options.include? :is_template
49
- options = ensure_api_media_type(:template_repositories, options)
50
- end
51
48
  options[:name] ||= repo.name
52
49
  patch "repos/#{repo}", options
53
50
  end
@@ -158,9 +155,6 @@ module Octokit
158
155
  opts = options.dup
159
156
  organization = opts.delete :organization
160
157
  opts.merge! name: name
161
- if opts.include? :is_template
162
- opts = ensure_api_media_type(:template_repositories, opts)
163
- end
164
158
 
165
159
  if organization.nil?
166
160
  post 'user/repos', opts
@@ -193,7 +187,6 @@ module Octokit
193
187
  # @param options [Array<Integer>] :team_ids ID of the team or teams to add to the repository. Teams can only be added to organization-owned repositories.
194
188
  # @return [Sawyer::Resource] Repository info for the transferred repository
195
189
  def transfer_repository(repo, new_owner, options = {})
196
- options = ensure_api_media_type(:transfer_repository, options)
197
190
  post "#{Repository.path repo}/transfer", options.merge({ new_owner: new_owner })
198
191
  end
199
192
  alias transfer_repo transfer_repository
@@ -209,7 +202,6 @@ module Octokit
209
202
  # @return [Sawyer::Resource] Repository info for the new repository
210
203
  def create_repository_from_template(repo, name, options = {})
211
204
  options.merge! name: name
212
- options = ensure_api_media_type(:template_repositories, options)
213
205
  post "#{Repository.path repo}/generate", options
214
206
  end
215
207
  alias create_repo_from_template create_repository_from_template
@@ -429,8 +421,7 @@ module Octokit
429
421
  # @example List topics for octokit/octokit.rb
430
422
  # client.topics('octokit/octokit.rb')
431
423
  def topics(repo, options = {})
432
- opts = ensure_api_media_type(:topics, options)
433
- paginate "#{Repository.path repo}/topics", opts
424
+ paginate "#{Repository.path repo}/topics", options
434
425
  end
435
426
 
436
427
  # Replace all topics for a repository
@@ -446,8 +437,7 @@ module Octokit
446
437
  # @example Clear all topics for octokit/octokit.rb
447
438
  # client.replace_all_topics('octokit/octokit.rb', [])
448
439
  def replace_all_topics(repo, names, options = {})
449
- opts = ensure_api_media_type(:topics, options)
450
- put "#{Repository.path repo}/topics", opts.merge(names: names)
440
+ put "#{Repository.path repo}/topics", options.merge(names: names)
451
441
  end
452
442
 
453
443
  # List contributors to a repo
@@ -599,10 +589,9 @@ module Octokit
599
589
  # @example
600
590
  # @client.protect_branch('octokit/octokit.rb', 'master', foo)
601
591
  def protect_branch(repo, branch, options = {})
602
- opts = ensure_api_media_type(:branch_protection, options)
603
- opts[:restrictions] ||= nil
604
- opts[:required_status_checks] ||= nil
605
- put "#{Repository.path repo}/branches/#{branch}/protection", opts
592
+ options[:restrictions] ||= nil
593
+ options[:required_status_checks] ||= nil
594
+ put "#{Repository.path repo}/branches/#{branch}/protection", options
606
595
  end
607
596
 
608
597
  # Get branch protection summary
@@ -615,12 +604,9 @@ module Octokit
615
604
  # @example
616
605
  # @client.branch_protection('octokit/octokit.rb', 'master')
617
606
  def branch_protection(repo, branch, options = {})
618
- opts = ensure_api_media_type(:branch_protection, options)
619
- begin
620
- get "#{Repository.path repo}/branches/#{branch}/protection", opts
621
- rescue Octokit::BranchNotProtected
622
- nil
623
- end
607
+ get "#{Repository.path repo}/branches/#{branch}/protection", options
608
+ rescue Octokit::BranchNotProtected
609
+ nil
624
610
  end
625
611
 
626
612
  # Unlock a single branch from a repository
@@ -634,8 +620,7 @@ module Octokit
634
620
  # @example
635
621
  # @client.unprotect_branch('octokit/octokit.rb', 'master')
636
622
  def unprotect_branch(repo, branch, options = {})
637
- opts = ensure_api_media_type(:branch_protection, options)
638
- boolean_from_response :delete, "#{Repository.path repo}/branches/#{branch}/protection", opts
623
+ boolean_from_response :delete, "#{Repository.path repo}/branches/#{branch}/protection", options
639
624
  end
640
625
 
641
626
  # Rename a single branch from a repository
@@ -761,8 +746,7 @@ module Octokit
761
746
  # @example
762
747
  # @client.vulnerability_alerts_enabled?("octokit/octokit.rb")
763
748
  def vulnerability_alerts_enabled?(repo, options = {})
764
- opts = ensure_api_media_type(:vulnerability_alerts, options)
765
- boolean_from_response(:get, "#{Repository.path repo}/vulnerability-alerts", opts)
749
+ boolean_from_response(:get, "#{Repository.path repo}/vulnerability-alerts", options)
766
750
  end
767
751
 
768
752
  # Enable vulnerability alerts for a repository
@@ -775,8 +759,7 @@ module Octokit
775
759
  # @example Enable vulnerability alerts for a repository
776
760
  # @client.enable_vulnerability_alerts("octokit/octokit.rb")
777
761
  def enable_vulnerability_alerts(repo, options = {})
778
- opts = ensure_api_media_type(:vulnerability_alerts, options)
779
- boolean_from_response(:put, "#{Repository.path repo}/vulnerability-alerts", opts)
762
+ boolean_from_response(:put, "#{Repository.path repo}/vulnerability-alerts", options)
780
763
  end
781
764
 
782
765
  # Disable vulnerability alerts for a repository
@@ -789,8 +772,7 @@ module Octokit
789
772
  # @example Disable vulnerability alerts for a repository
790
773
  # @client.disable_vulnerability_alerts("octokit/octokit.rb")
791
774
  def disable_vulnerability_alerts(repo, options = {})
792
- opts = ensure_api_media_type(:vulnerability_alerts, options)
793
- boolean_from_response(:delete, "#{Repository.path repo}/vulnerability-alerts", opts)
775
+ boolean_from_response(:delete, "#{Repository.path repo}/vulnerability-alerts", options)
794
776
  end
795
777
  end
796
778
  end
@@ -31,7 +31,6 @@ module Octokit
31
31
  # @return [Sawyer::Resource] Search results object
32
32
  # @see https://developer.github.com/v3/search/#search-commits
33
33
  def search_commits(query, options = {})
34
- options = ensure_api_media_type(:commit_search, options)
35
34
  search 'search/commits', query, options
36
35
  end
37
36
 
@@ -42,7 +42,7 @@ module Octokit
42
42
  octokit_warn 'Octokit#start_source_import vcs parameter is now an option, please update your call before the next major Octokit version update.'
43
43
  arguments.options.merge!(vcs: vcs)
44
44
  end
45
- options = ensure_api_media_type(:source_imports, arguments.options.merge(vcs_url: vcs_url))
45
+ options = arguments.options.merge(vcs_url: vcs_url)
46
46
  put "#{Repository.path arguments.repo}/import", options
47
47
  end
48
48
 
@@ -55,7 +55,6 @@ module Octokit
55
55
  # @example
56
56
  # @client.source_import_progress("octokit/octokit.rb")
57
57
  def source_import_progress(repo, options = {})
58
- options = ensure_api_media_type(:source_imports, options)
59
58
  get "#{Repository.path repo}/import", options
60
59
  end
61
60
 
@@ -76,7 +75,6 @@ module Octokit
76
75
  # :vcs_password => "secret"
77
76
  # })
78
77
  def update_source_import(repo, options = {})
79
- options = ensure_api_media_type(:source_imports, options)
80
78
  patch "#{Repository.path repo}/import", options
81
79
  end
82
80
 
@@ -91,7 +89,6 @@ module Octokit
91
89
  # @example
92
90
  # @client.source_import_commit_authors("octokit/octokit.rb")
93
91
  def source_import_commit_authors(repo, options = {})
94
- options = ensure_api_media_type(:source_imports, options)
95
92
  get "#{Repository.path repo}/import/authors", options
96
93
  end
97
94
 
@@ -111,7 +108,7 @@ module Octokit
111
108
  # :name => "Hubot the Robot"
112
109
  # })
113
110
  def map_source_import_commit_author(author_url, values, options = {})
114
- options = ensure_api_media_type(:source_imports, options.merge(values))
111
+ options = options.merge(values)
115
112
  patch author_url, options
116
113
  end
117
114
 
@@ -124,7 +121,6 @@ module Octokit
124
121
  # @example
125
122
  # @client.cancel_source_import("octokit/octokit.rb")
126
123
  def cancel_source_import(repo, options = {})
127
- options = ensure_api_media_type(:source_imports, options)
128
124
  boolean_from_response :delete, "#{Repository.path repo}/import", options
129
125
  end
130
126
 
@@ -139,7 +135,6 @@ module Octokit
139
135
  # @example
140
136
  # @client.source_import_large_files("octokit/octokit.rb")
141
137
  def source_import_large_files(repo, options = {})
142
- options = ensure_api_media_type(:source_imports, options)
143
138
  get "#{Repository.path repo}/import/large_files", options
144
139
  end
145
140
 
@@ -153,7 +148,7 @@ module Octokit
153
148
  # @example
154
149
  # @client.opt_in_source_import_lfs("octokit/octokit.rb", "opt_in")
155
150
  def set_source_import_lfs_preference(repo, use_lfs, options = {})
156
- options = ensure_api_media_type(:source_imports, options.merge(use_lfs: use_lfs))
151
+ options = options.merge(use_lfs: use_lfs)
157
152
  patch "#{Repository.path repo}/import/lfs", options
158
153
  end
159
154
  end
@@ -14,8 +14,7 @@ module Octokit
14
14
  # @example
15
15
  # @client.top_referrers('octokit/octokit.rb')
16
16
  def top_referrers(repo, options = {})
17
- opts = ensure_api_media_type(:traffic, options)
18
- get "#{Repository.path repo}/traffic/popular/referrers", opts
17
+ get "#{Repository.path repo}/traffic/popular/referrers", options
19
18
  end
20
19
 
21
20
  # Get the top 10 popular contents over the last 14 days
@@ -26,8 +25,7 @@ module Octokit
26
25
  # @example
27
26
  # @client.top_paths('octokit/octokit.rb')
28
27
  def top_paths(repo, options = {})
29
- opts = ensure_api_media_type(:traffic, options)
30
- get "#{Repository.path repo}/traffic/popular/paths", opts
28
+ get "#{Repository.path repo}/traffic/popular/paths", options
31
29
  end
32
30
 
33
31
  # Get the total number of views and breakdown per day or week for the
@@ -43,8 +41,7 @@ module Octokit
43
41
  # @example Views per week
44
42
  # @client.views('octokit/octokit.rb', per: 'week')
45
43
  def views(repo, options = {})
46
- opts = ensure_api_media_type(:traffic, options)
47
- get "#{Repository.path repo}/traffic/views", opts
44
+ get "#{Repository.path repo}/traffic/views", options
48
45
  end
49
46
 
50
47
  # Get the total number of clones and breakdown per day or week for the
@@ -60,8 +57,7 @@ module Octokit
60
57
  # @example Clones per week
61
58
  # @client.clones('octokit/octokit.rb', per: 'week')
62
59
  def clones(repo, options = {})
63
- opts = ensure_api_media_type(:traffic, options)
64
- get "#{Repository.path repo}/traffic/clones", opts
60
+ get "#{Repository.path repo}/traffic/clones", options
65
61
  end
66
62
  end
67
63
  end
@@ -352,7 +352,6 @@ module Octokit
352
352
  # @client.start_migration(['octocat/hello-world'])
353
353
  # @see https://docs.github.com/en/rest/reference/migrations#start-a-user-migration
354
354
  def start_user_migration(repositories, options = {})
355
- options = ensure_api_media_type(:migrations, options)
356
355
  options[:repositories] = repositories
357
356
  post 'user/migrations', options
358
357
  end
@@ -364,7 +363,6 @@ module Octokit
364
363
  # @return [Array<Sawyer::Resource>] Array of migration resources.
365
364
  # @see https://docs.github.com/en/rest/reference/migrations#list-user-migrations
366
365
  def user_migrations(options = {})
367
- options = ensure_api_media_type(:migrations, options)
368
366
  paginate 'user/migrations', options
369
367
  end
370
368
 
@@ -375,7 +373,6 @@ module Octokit
375
373
  # @param id [Integer] ID number of the migration.
376
374
  # @see https://docs.github.com/en/rest/reference/migrations#get-a-user-migration-status
377
375
  def user_migration_status(id, options = {})
378
- options = ensure_api_media_type(:migrations, options)
379
376
  get "user/migrations/#{id}", options
380
377
  end
381
378
 
@@ -386,7 +383,6 @@ module Octokit
386
383
  # @param id [Integer] ID number of the migration.
387
384
  # @see https://docs.github.com/en/rest/reference/migrations#download-a-user-migration-archive
388
385
  def user_migration_archive_url(id, options = {})
389
- options = ensure_api_media_type(:migrations, options)
390
386
  url = "user/migrations/#{id}/archive"
391
387
 
392
388
  response = client_without_redirects(options).get(url)
@@ -400,7 +396,6 @@ module Octokit
400
396
  # @param id [Integer] ID number of the migration.
401
397
  # @see https://docs.github.com/en/rest/reference/migrations#delete-a-user-migration-archive
402
398
  def delete_user_migration_archive(id, options = {})
403
- options = ensure_api_media_type(:migrations, options)
404
399
  delete "user/migrations/#{id}/archive", options
405
400
  end
406
401
 
@@ -411,7 +406,6 @@ module Octokit
411
406
  # @param id [Integer] ID number of the migration.
412
407
  # @see https://docs.github.com/en/rest/reference/migrations#list-repositories-for-a-user-migration
413
408
  def user_migration_repositories(id, options = {})
414
- options = ensure_api_media_type(:migrations, options)
415
409
  get "user/migrations/#{id}/repositories", options
416
410
  end
417
411
 
@@ -423,7 +417,6 @@ module Octokit
423
417
  # @param repo [String] Name of the repository.
424
418
  # @see https://docs.github.com/en/rest/reference/migrations#unlock-a-user-repository
425
419
  def unlock_user_repository(id, repo, options = {})
426
- options = ensure_api_media_type(:migrations, options)
427
420
  delete "user/migrations/#{id}/repos/#{repo}/lock", options
428
421
  end
429
422
  end
@@ -11,7 +11,6 @@ require 'octokit/rate_limit'
11
11
  require 'octokit/repository'
12
12
  require 'octokit/user'
13
13
  require 'octokit/organization'
14
- require 'octokit/preview'
15
14
  require 'octokit/client/actions_secrets'
16
15
  require 'octokit/client/actions_workflows'
17
16
  require 'octokit/client/actions_workflow_jobs'
@@ -74,7 +73,6 @@ module Octokit
74
73
  include Octokit::Authentication
75
74
  include Octokit::Configurable
76
75
  include Octokit::Connection
77
- include Octokit::Preview
78
76
  include Octokit::Warnable
79
77
  include Octokit::Client::ActionsSecrets
80
78
  include Octokit::Client::Authorizations
@@ -7,7 +7,7 @@ module Octokit
7
7
 
8
8
  # Current minor release.
9
9
  # @return [Integer]
10
- MINOR = 1
10
+ MINOR = 2
11
11
 
12
12
  # Current patch level.
13
13
  # @return [Integer]
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: 5.1.0
4
+ version: 5.2.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: 2022-07-13 00:00:00.000000000 Z
13
+ date: 2022-08-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -152,7 +152,6 @@ files:
152
152
  - lib/octokit/gist.rb
153
153
  - lib/octokit/middleware/follow_redirects.rb
154
154
  - lib/octokit/organization.rb
155
- - lib/octokit/preview.rb
156
155
  - lib/octokit/rate_limit.rb
157
156
  - lib/octokit/repo_arguments.rb
158
157
  - lib/octokit/repository.rb
@@ -183,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
182
  - !ruby/object:Gem::Version
184
183
  version: 1.3.5
185
184
  requirements: []
186
- rubygems_version: 3.3.7
185
+ rubygems_version: 3.1.2
187
186
  signing_key:
188
187
  specification_version: 4
189
188
  summary: Ruby toolkit for working with the GitHub API
@@ -1,46 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Octokit
4
- # Default setup options for preview features
5
- module Preview
6
- PREVIEW_TYPES = {
7
- applications_api: 'application/vnd.github.doctor-strange-preview+json',
8
- branch_protection: 'application/vnd.github.luke-cage-preview+json',
9
- commit_search: 'application/vnd.github.cloak-preview+json',
10
- commit_pulls: 'application/vnd.github.groot-preview+json',
11
- commit_branches: 'application/vnd.github.groot-preview+json',
12
- migrations: 'application/vnd.github.wyandotte-preview+json',
13
- licenses: 'application/vnd.github.drax-preview+json',
14
- source_imports: 'application/vnd.github.barred-rock-preview',
15
- reactions: 'application/vnd.github.squirrel-girl-preview',
16
- transfer_repository: 'application/vnd.github.nightshade-preview+json',
17
- issue_timelines: 'application/vnd.github.mockingbird-preview+json',
18
- nested_teams: 'application/vnd.github.hellcat-preview+json',
19
- pages: 'application/vnd.github.mister-fantastic-preview+json',
20
- projects: 'application/vnd.github.inertia-preview+json',
21
- traffic: 'application/vnd.github.spiderman-preview',
22
- topics: 'application/vnd.github.mercy-preview+json',
23
- community_profile: 'application/vnd.github.black-panther-preview+json',
24
- strict_validation: 'application/vnd.github.speedy-preview+json',
25
- template_repositories: 'application/vnd.github.baptiste-preview+json',
26
- project_card_events: 'application/vnd.github.starfox-preview+json',
27
- vulnerability_alerts: 'application/vnd.github.dorian-preview+json'
28
- }.freeze
29
-
30
- def ensure_api_media_type(type, options)
31
- if options[:accept].nil?
32
- options[:accept] = PREVIEW_TYPES[type]
33
- warn_preview(type)
34
- end
35
- options
36
- end
37
-
38
- def warn_preview(type)
39
- octokit_warn <<~EOS
40
- WARNING: The preview version of the #{type.to_s.capitalize} API is not yet suitable for production use.
41
- You can avoid this message by supplying an appropriate media type in the 'Accept' request
42
- header.
43
- EOS
44
- end
45
- end
46
- end