octokit 4.25.1 → 5.2.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
  SHA256:
3
- metadata.gz: 6695a62a334c075c819ed311e120304371fa63ebfd7845934f14f05e55a48650
4
- data.tar.gz: b524bb910c9b0ec61175cd5a51eaef2e661e2aaf98febf2ada808c25a9b78a50
3
+ metadata.gz: 971671d7bf27fc19d9cd0072a73bb39d2ed82dfcfff2c0bf1d897d889bb34d81
4
+ data.tar.gz: 12bf586942ad3004b5aaf109aa0cd394429742160f486b03ead76523ba6ddd0f
5
5
  SHA512:
6
- metadata.gz: 1f67309dce35a4ced6b92a0ccee172029b8e3abb43b5756324a59317cfe151730078397f77549a4d378caccad870a02430585932eb07a5a02508064f92832d58
7
- data.tar.gz: 935a184f81f8a7836811aa3e9a6f94303bb6b924167db7ff7ded77e45fdd31ff34fabce1d4a54590eb6eacccceedf0518dbfb1e8e6075b4adf9e2f9fea88a267
6
+ metadata.gz: 766b52be3c9bfb04e5c5d049617e211e1f2cdf66611c1634475688f87fa94ab2252a299147ef917a3eb634ced46558042fcf06364098cb5d60664d3481519cd3
7
+ data.tar.gz: f8f75a3e85310b927801f98290ac7cc7643b918715026e621e2bc5de6887eefda47c28fabb8ab14040df234011ced8b6488216a3ca8a64614eb528d488ebfc9f
data/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Octokit
2
2
 
3
+ > **Note**
4
+ > We've recently renamed the `4-stable` branch to `main`. This might affect you if you're making changes to Octokit's code locally. For more details and for the steps to reconfigure your local clone for the new branch name, check out [this post](https://github.com/octokit/octokit.rb/discussions/1455).
5
+
3
6
  Ruby toolkit for the GitHub API.
4
7
 
5
8
  ![logo](https://docs.github.com/assets/images/gundamcat.png)
@@ -740,8 +743,6 @@ when writing new specs.
740
743
  This library aims to support and is [tested against][actions] the following Ruby
741
744
  implementations:
742
745
 
743
- * Ruby 2.5
744
- * Ruby 2.6
745
746
  * Ruby 2.7
746
747
  * Ruby 3.0
747
748
  * Ruby 3.1
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Octokit
4
+ class Client
5
+ # Methods for the Actions Workflows jobs API
6
+ #
7
+ # @see https://docs.github.com/rest/actions/workflow-jobs
8
+ module ActionsWorkflowJobs
9
+ # Get a job for a workflow run
10
+ #
11
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
12
+ # @param job_id [Integer, String] Id of the job
13
+ #
14
+ # @return [Sawyer::Resource] Job information
15
+ # @see https://docs.github.com/rest/actions/workflow-jobs#get-a-job-for-a-workflow-run
16
+ def workflow_run_job(repo, job_id, options = {})
17
+ get "#{Repository.path repo}/actions/jobs/#{job_id}", options
18
+ end
19
+
20
+ # Download job logs for a workflow run
21
+ #
22
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
23
+ # @param job_id [Integer, String] Id of the job
24
+ #
25
+ # @return [String] URL to the archived log files of the job
26
+ # @see https://docs.github.com/rest/actions/workflow-jobs#download-job-logs-for-a-workflow-run
27
+ def workflow_run_job_logs(repo, job_id, options = {})
28
+ url = "#{Repository.path repo}/actions/jobs/#{job_id}/logs"
29
+
30
+ response = client_without_redirects.head(url, options)
31
+ response.headers['Location']
32
+ end
33
+
34
+ # List jobs for a workflow run attempt
35
+ #
36
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
37
+ # @param run_id [Integer, String] Id of the workflow run
38
+ # @param attempt_number [Integer, String] Attempt number of the workflow run
39
+ #
40
+ # @return [Sawyer::Resource] Jobs information
41
+ # @see https://docs.github.com/rest/actions/workflow-jobs#list-jobs-for-a-workflow-run-attempt
42
+ def workflow_run_attempt_jobs(repo, run_id, attempt_number, options = {})
43
+ paginate "#{Repository.path repo}/actions/runs/#{run_id}/attempts/#{attempt_number}/jobs", options
44
+ end
45
+ alias list_workflow_run_attempt_jobs workflow_run_attempt_jobs
46
+
47
+ # List jobs for a workflow run
48
+ #
49
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
50
+ # @param run_id [Integer, String] Id of the workflow run
51
+ # @option options [String] :filter Optional filtering by a `completed_at` timestamp
52
+ #
53
+ # @return [Sawyer::Resource] Jobs information
54
+ # @see https://docs.github.com/rest/actions/workflow-jobs#list-jobs-for-a-workflow-run
55
+ def workflow_run_jobs(repo, run_id, options = {})
56
+ paginate "#{Repository.path repo}/actions/runs/#{run_id}/jobs", options
57
+ end
58
+ alias list_workflow_run_jobs workflow_run_jobs
59
+ end
60
+ end
61
+ end
@@ -2,6 +2,9 @@
2
2
 
3
3
  module Octokit
4
4
  class Client
5
+ # Methods for the Actions Workflows runs API
6
+ #
7
+ # @see https://docs.github.com/rest/actions/workflow-runs
5
8
  module ActionsWorkflowRuns
6
9
  # List all runs for a repository workflow
7
10
  #
@@ -92,7 +95,7 @@ module Octokit
92
95
  response.headers['Location']
93
96
  end
94
97
 
95
- # Delets all log files of a workflow run
98
+ # Delete all log files of a workflow run
96
99
  #
97
100
  # @param repo [Integer, String, Repository, Hash] A GitHub repository
98
101
  # @param id [Integer] Id of a workflow run
@@ -102,6 +105,17 @@ module Octokit
102
105
  def delete_workflow_run_logs(repo, id, options = {})
103
106
  boolean_from_response :delete, "#{Repository.path repo}/actions/runs/#{id}/logs", options
104
107
  end
108
+
109
+ # Get workflow run usage
110
+ #
111
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
112
+ # @param id [Integer] Id of a workflow run
113
+ #
114
+ # @return [Sawyer::Resource] Run usage
115
+ # @see https://developer.github.com/v3/actions/workflow-runs/#get-workflow-run-usage
116
+ def workflow_run_usage(repo, id, options = {})
117
+ get "#{Repository.path repo}/actions/runs/#{id}/timing", options
118
+ end
105
119
  end
106
120
  end
107
121
  end
@@ -39,6 +39,28 @@ module Octokit
39
39
  def workflow_dispatch(repo, id, ref, options = {})
40
40
  boolean_from_response :post, "#{Repository.path repo}/actions/workflows/#{id}/dispatches", options.merge({ ref: ref })
41
41
  end
42
+
43
+ # Enable a workflow
44
+ #
45
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
46
+ # @param id [Integer, String] Id or file name of the workflow
47
+ #
48
+ # @return [Boolean] True if workflow was enabled, false otherwise
49
+ # @see https://docs.github.com/en/rest/actions/workflows#enable-a-workflow
50
+ def workflow_enable(repo, id, options = {})
51
+ boolean_from_response :put, "#{Repository.path repo}/actions/workflows/#{id}/enable", options
52
+ end
53
+
54
+ # Disable a workflow
55
+ #
56
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
57
+ # @param id [Integer, String] Id or file name of the workflow
58
+ #
59
+ # @return [Boolean] True if workflow was disabled, false otherwise
60
+ # @see https://docs.github.com/en/rest/actions/workflows#disable-a-workflow
61
+ def workflow_disable(repo, id, options = {})
62
+ boolean_from_response :put, "#{Repository.path repo}/actions/workflows/#{id}/disable", options
63
+ end
42
64
  end
43
65
  end
44
66
  end
@@ -29,9 +29,9 @@ module Octokit
29
29
 
30
30
  def find_integration_installations(options = {})
31
31
  octokit_warn(
32
- 'Deprecated: Octokit::Client::Apps#find_integration_installations '\
33
- 'method is deprecated. Please update your call to use '\
34
- 'Octokit::Client::Apps#find_app_installations before the next major '\
32
+ 'Deprecated: Octokit::Client::Apps#find_integration_installations ' \
33
+ 'method is deprecated. Please update your call to use ' \
34
+ 'Octokit::Client::Apps#find_app_installations before the next major ' \
35
35
  'Octokit version update.'
36
36
  )
37
37
  find_app_installations(options)
@@ -76,9 +76,9 @@ module Octokit
76
76
 
77
77
  def create_integration_installation_access_token(installation, options = {})
78
78
  octokit_warn(
79
- 'Deprecated: Octokit::Client::Apps#create_integration_installation_access_token '\
80
- 'method is deprecated. Please update your call to use '\
81
- 'Octokit::Client::Apps#create_app_installation_access_token before the next major '\
79
+ 'Deprecated: Octokit::Client::Apps#create_integration_installation_access_token ' \
80
+ 'method is deprecated. Please update your call to use ' \
81
+ 'Octokit::Client::Apps#create_app_installation_access_token before the next major ' \
82
82
  'Octokit version update.'
83
83
  )
84
84
  create_app_installation_access_token(installation, options)
@@ -136,9 +136,9 @@ module Octokit
136
136
 
137
137
  def list_integration_installation_repositories(options = {})
138
138
  octokit_warn(
139
- 'Deprecated: Octokit::Client::Apps#list_integration_installation_repositories '\
140
- 'method is deprecated. Please update your call to use '\
141
- 'Octokit::Client::Apps#list_app_installation_repositories before the next major '\
139
+ 'Deprecated: Octokit::Client::Apps#list_integration_installation_repositories ' \
140
+ 'method is deprecated. Please update your call to use ' \
141
+ 'Octokit::Client::Apps#list_app_installation_repositories before the next major ' \
142
142
  'Octokit version update.'
143
143
  )
144
144
  list_app_installation_repositories(options)
@@ -160,9 +160,9 @@ module Octokit
160
160
 
161
161
  def add_repository_to_integration_installation(installation, repo, options = {})
162
162
  octokit_warn(
163
- 'Deprecated: Octokit::Client::Apps#add_repository_to_integration_installation '\
164
- 'method is deprecated. Please update your call to use '\
165
- 'Octokit::Client::Apps#add_repository_to_app_installation before the next major '\
163
+ 'Deprecated: Octokit::Client::Apps#add_repository_to_integration_installation ' \
164
+ 'method is deprecated. Please update your call to use ' \
165
+ 'Octokit::Client::Apps#add_repository_to_app_installation before the next major ' \
166
166
  'Octokit version update.'
167
167
  )
168
168
  add_repository_to_app_installation(installation, repo, options)
@@ -184,9 +184,9 @@ module Octokit
184
184
 
185
185
  def remove_repository_from_integration_installation(installation, repo, options = {})
186
186
  octokit_warn(
187
- 'Deprecated: Octokit::Client::Apps#remove_repository_from_integration_installation '\
188
- 'method is deprecated. Please update your call to use '\
189
- 'Octokit::Client::Apps#remove_repository_from_app_installation before the next major '\
187
+ 'Deprecated: Octokit::Client::Apps#remove_repository_from_integration_installation ' \
188
+ 'method is deprecated. Please update your call to use ' \
189
+ 'Octokit::Client::Apps#remove_repository_from_app_installation before the next major ' \
190
190
  'Octokit version update.'
191
191
  )
192
192
  remove_repository_from_app_installation(installation, repo, options)
@@ -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
@@ -18,11 +18,11 @@ module Octokit
18
18
  # client.subscribe("https://github.com/joshk/devise_imapable/events/push", "github://Email?address=josh.kalderimis@gmail.com")
19
19
  def subscribe(topic, callback, secret = nil)
20
20
  options = {
21
- "hub.callback": callback,
22
- "hub.mode": 'subscribe',
23
- "hub.topic": topic
21
+ 'hub.callback': callback,
22
+ 'hub.mode': 'subscribe',
23
+ 'hub.topic': topic
24
24
  }
25
- options.merge!("hub.secret": secret) unless secret.nil?
25
+ options.merge!('hub.secret': secret) unless secret.nil?
26
26
 
27
27
  response = pub_sub_hubbub_request(options)
28
28
 
@@ -40,9 +40,9 @@ module Octokit
40
40
  # client.unsubscribe("https://github.com/joshk/devise_imapable/events/push", "github://Email?address=josh.kalderimis@gmail.com")
41
41
  def unsubscribe(topic, callback)
42
42
  options = {
43
- "hub.callback": callback,
44
- "hub.mode": 'unsubscribe',
45
- "hub.topic": topic
43
+ 'hub.callback': callback,
44
+ 'hub.mode': 'unsubscribe',
45
+ 'hub.topic': topic
46
46
  }
47
47
  response = pub_sub_hubbub_request(options)
48
48