octokit 4.15.0 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +2 -4
  3. data/README.md +104 -80
  4. data/Rakefile +5 -3
  5. data/lib/ext/sawyer/relation.rb +4 -2
  6. data/lib/octokit/arguments.rb +2 -2
  7. data/lib/octokit/authentication.rb +12 -14
  8. data/lib/octokit/client/actions_artifacts.rb +71 -0
  9. data/lib/octokit/client/actions_secrets.rb +59 -0
  10. data/lib/octokit/client/actions_workflow_jobs.rb +65 -0
  11. data/lib/octokit/client/actions_workflow_runs.rb +125 -0
  12. data/lib/octokit/client/actions_workflows.rb +68 -0
  13. data/lib/octokit/client/apps.rb +53 -53
  14. data/lib/octokit/client/checks.rb +18 -29
  15. data/lib/octokit/client/commit_branches.rb +20 -0
  16. data/lib/octokit/client/commit_comments.rb +8 -8
  17. data/lib/octokit/client/commit_pulls.rb +2 -2
  18. data/lib/octokit/client/commits.rb +31 -34
  19. data/lib/octokit/client/community_profile.rb +2 -3
  20. data/lib/octokit/client/contents.rb +24 -21
  21. data/lib/octokit/client/deployments.rb +16 -6
  22. data/lib/octokit/client/downloads.rb +5 -6
  23. data/lib/octokit/client/emojis.rb +3 -3
  24. data/lib/octokit/client/events.rb +4 -4
  25. data/lib/octokit/client/feeds.rb +4 -5
  26. data/lib/octokit/client/gists.rb +6 -6
  27. data/lib/octokit/client/gitignore.rb +3 -3
  28. data/lib/octokit/client/hooks.rb +9 -19
  29. data/lib/octokit/client/issues.rb +14 -15
  30. data/lib/octokit/client/labels.rb +10 -10
  31. data/lib/octokit/client/legacy_search.rb +3 -3
  32. data/lib/octokit/client/licenses.rb +3 -6
  33. data/lib/octokit/client/markdown.rb +3 -3
  34. data/lib/octokit/client/marketplace.rb +4 -4
  35. data/lib/octokit/client/meta.rb +4 -5
  36. data/lib/octokit/client/milestones.rb +5 -5
  37. data/lib/octokit/client/notifications.rb +6 -6
  38. data/lib/octokit/client/oauth_applications.rb +116 -0
  39. data/lib/octokit/client/objects.rb +14 -14
  40. data/lib/octokit/client/organizations.rb +112 -70
  41. data/lib/octokit/client/pages.rb +5 -7
  42. data/lib/octokit/client/projects.rb +44 -64
  43. data/lib/octokit/client/pub_sub_hubbub.rb +16 -16
  44. data/lib/octokit/client/pull_requests.rb +52 -42
  45. data/lib/octokit/client/rate_limit.rb +9 -11
  46. data/lib/octokit/client/reactions.rb +6 -11
  47. data/lib/octokit/client/refs.rb +32 -19
  48. data/lib/octokit/client/releases.rb +13 -13
  49. data/lib/octokit/client/repositories.rb +123 -69
  50. data/lib/octokit/client/repository_invitations.rb +3 -3
  51. data/lib/octokit/client/reviews.rb +7 -7
  52. data/lib/octokit/client/say.rb +4 -5
  53. data/lib/octokit/client/search.rb +24 -11
  54. data/lib/octokit/client/service_status.rb +19 -9
  55. data/lib/octokit/client/source_import.rb +7 -12
  56. data/lib/octokit/client/stats.rb +10 -9
  57. data/lib/octokit/client/statuses.rb +5 -5
  58. data/lib/octokit/client/tokens.rb +31 -0
  59. data/lib/octokit/client/traffic.rb +6 -11
  60. data/lib/octokit/client/users.rb +104 -24
  61. data/lib/octokit/client.rb +44 -18
  62. data/lib/octokit/configurable.rb +34 -30
  63. data/lib/octokit/connection.rb +28 -26
  64. data/lib/octokit/default.rb +46 -35
  65. data/lib/octokit/enterprise_admin_client/admin_stats.rb +13 -14
  66. data/lib/octokit/enterprise_admin_client/license.rb +3 -4
  67. data/lib/octokit/enterprise_admin_client/orgs.rb +3 -4
  68. data/lib/octokit/enterprise_admin_client/search_indexing.rb +7 -8
  69. data/lib/octokit/enterprise_admin_client/users.rb +5 -4
  70. data/lib/octokit/enterprise_admin_client.rb +9 -3
  71. data/lib/octokit/enterprise_management_console_client/management_console.rb +32 -32
  72. data/lib/octokit/enterprise_management_console_client.rb +8 -2
  73. data/lib/octokit/error.rb +72 -27
  74. data/lib/octokit/gist.rb +2 -3
  75. data/lib/octokit/middleware/follow_redirects.rb +15 -11
  76. data/lib/octokit/organization.rb +3 -1
  77. data/lib/octokit/rate_limit.rb +3 -3
  78. data/lib/octokit/repo_arguments.rb +2 -3
  79. data/lib/octokit/repository.rb +24 -24
  80. data/lib/octokit/response/base_middleware.rb +10 -0
  81. data/lib/octokit/response/feed_parser.rb +5 -9
  82. data/lib/octokit/response/raise_error.rb +4 -6
  83. data/lib/octokit/user.rb +4 -2
  84. data/lib/octokit/version.rb +4 -2
  85. data/lib/octokit/warnable.rb +4 -5
  86. data/lib/octokit.rb +15 -8
  87. data/octokit.gemspec +12 -10
  88. metadata +25 -17
  89. data/lib/octokit/client/authorizations.rb +0 -250
  90. data/lib/octokit/preview.rb +0 -46
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Octokit
4
+ class Client
5
+ # Methods for the Actions Artifacts API
6
+ #
7
+ # @see https://developer.github.com/v3/actions/artifacts
8
+ module ActionsArtifacts
9
+ # List all artifacts for a repository
10
+ #
11
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
12
+ #
13
+ # @return [Sawyer::Resource] the total count and an array of artifacts
14
+ # @see https://developer.github.com/v3/actions/artifacts#list-artifacts-for-a-repository
15
+ def repository_artifacts(repo, options = {})
16
+ paginate "#{Repository.path repo}/actions/artifacts", options do |data, last_response|
17
+ data.artifacts.concat last_response.data.artifacts
18
+ end
19
+ end
20
+
21
+ # List all artifacts for a workflow run
22
+ #
23
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
24
+ # @param workflow_run_id [Integer] Id of a workflow run
25
+ #
26
+ # @return [Sawyer::Resource] the total count and an array of artifacts
27
+ # @see https://docs.github.com/en/rest/actions/artifacts#list-workflow-run-artifacts
28
+ def workflow_run_artifacts(repo, workflow_run_id, options = {})
29
+ paginate "#{Repository.path repo}/actions/runs/#{workflow_run_id}/artifacts", options do |data, last_response|
30
+ data.artifacts.concat last_response.data.artifacts
31
+ end
32
+ end
33
+
34
+ # Get an artifact
35
+ #
36
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
37
+ # @param id [Integer] Id of an artifact
38
+ #
39
+ # @return [Sawyer::Resource] Artifact information
40
+ # @see https://docs.github.com/en/rest/actions/artifacts#get-an-artifact
41
+ def artifact(repo, id, options = {})
42
+ get "#{Repository.path repo}/actions/artifacts/#{id}", options
43
+ end
44
+
45
+ # Get a download URL for an artifact
46
+ #
47
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
48
+ # @param id [Integer] Id of an artifact
49
+ #
50
+ # @return [String] URL to the .zip archive of the artifact
51
+ # @see https://docs.github.com/en/rest/actions/artifacts#download-an-artifact
52
+ def artifact_download_url(repo, id, options = {})
53
+ url = "#{Repository.path repo}/actions/artifacts/#{id}/zip"
54
+
55
+ response = client_without_redirects.head(url, options)
56
+ response.headers['Location']
57
+ end
58
+
59
+ # Delete an artifact
60
+ #
61
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
62
+ # @param id [Integer] Id of an artifact
63
+ #
64
+ # @return [Boolean] Return true if the artifact was successfully deleted
65
+ # @see https://docs.github.com/en/rest/actions/artifacts#delete-an-artifact
66
+ def delete_artifact(repo, id, options = {})
67
+ boolean_from_response :delete, "#{Repository.path repo}/actions/artifacts/#{id}", options
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Octokit
4
+ class Client
5
+ # Methods for the Actions Secrets API
6
+ #
7
+ # @see https://developer.github.com/v3/actions/secrets/
8
+ module ActionsSecrets
9
+ # Get public key for secrets encryption
10
+ #
11
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
12
+ # @return [Hash] key_id and key
13
+ # @see https://developer.github.com/v3/actions/secrets/#get-your-public-key
14
+ def get_public_key(repo)
15
+ get "#{Repository.path repo}/actions/secrets/public-key"
16
+ end
17
+
18
+ # List secrets
19
+ #
20
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
21
+ # @return [Hash] total_count and list of secrets (each item is hash with name, created_at and updated_at)
22
+ # @see https://developer.github.com/v3/actions/secrets/#list-secrets-for-a-repository
23
+ def list_secrets(repo)
24
+ paginate "#{Repository.path repo}/actions/secrets" do |data, last_response|
25
+ data.secrets.concat last_response.data.secrets
26
+ end
27
+ end
28
+
29
+ # Get a secret
30
+ #
31
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
32
+ # @param name [String] Name of secret
33
+ # @return [Hash] name, created_at and updated_at
34
+ # @see https://developer.github.com/v3/actions/secrets/#get-a-secret
35
+ def get_secret(repo, name)
36
+ get "#{Repository.path repo}/actions/secrets/#{name}"
37
+ end
38
+
39
+ # Create or update secrets
40
+ #
41
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
42
+ # @param name [String] Name of secret
43
+ # @param options [Hash] encrypted_value and key_id
44
+ # @see https://developer.github.com/v3/actions/secrets/#create-or-update-a-secret-for-a-repository
45
+ def create_or_update_secret(repo, name, options)
46
+ put "#{Repository.path repo}/actions/secrets/#{name}", options
47
+ end
48
+
49
+ # Delete a secret
50
+ #
51
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
52
+ # @param name [String] Name of secret
53
+ # @see https://developer.github.com/v3/actions/secrets/#delete-a-secret-from-a-repository
54
+ def delete_secret(repo, name)
55
+ boolean_from_response :delete, "#{Repository.path repo}/actions/secrets/#{name}"
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,65 @@
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 do |data, last_response|
44
+ data.jobs.concat last_response.data.jobs
45
+ end
46
+ end
47
+ alias list_workflow_run_attempt_jobs workflow_run_attempt_jobs
48
+
49
+ # List jobs for a workflow run
50
+ #
51
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
52
+ # @param run_id [Integer, String] Id of the workflow run
53
+ # @option options [String] :filter Optional filtering by a `completed_at` timestamp
54
+ #
55
+ # @return [Sawyer::Resource] Jobs information
56
+ # @see https://docs.github.com/rest/actions/workflow-jobs#list-jobs-for-a-workflow-run
57
+ def workflow_run_jobs(repo, run_id, options = {})
58
+ paginate "#{Repository.path repo}/actions/runs/#{run_id}/jobs", options do |data, last_response|
59
+ data.jobs.concat last_response.data.jobs
60
+ end
61
+ end
62
+ alias list_workflow_run_jobs workflow_run_jobs
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,125 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Octokit
4
+ class Client
5
+ # Methods for the Actions Workflows runs API
6
+ #
7
+ # @see https://docs.github.com/rest/actions/workflow-runs
8
+ module ActionsWorkflowRuns
9
+ # List all runs for a repository workflow
10
+ #
11
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
12
+ # @param workflow [Integer, String] Id or file name of the workflow
13
+ # @option options [String] :actor Optional filtering by a user
14
+ # @option options [String] :branch Optional filtering by a branch
15
+ # @option options [String] :event Optional filtering by the event type
16
+ # @option options [String] :status Optional filtering by a status or conclusion
17
+ #
18
+ # @return [Sawyer::Resource] the total count and an array of workflows
19
+ # @see https://developer.github.com/v3/actions/workflow-runs/#list-workflow-runs
20
+ def workflow_runs(repo, workflow, options = {})
21
+ paginate "#{Repository.path repo}/actions/workflows/#{workflow}/runs", options do |data, last_response|
22
+ data.workflow_runs.concat last_response.data.workflow_runs
23
+ end
24
+ end
25
+ alias list_workflow_runs workflow_runs
26
+
27
+ # List all workflow runs for a repository
28
+ #
29
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
30
+ # @option options [String] :actor Optional filtering by the login of a user
31
+ # @option options [String] :branch Optional filtering by a branch
32
+ # @option options [String] :event Optional filtering by the event type (e.g. push, pull_request, issue)
33
+ # @option options [String] :status Optional filtering by a status or conclusion (e.g. success, completed...)
34
+ #
35
+ # @return [Sawyer::Resource] the total count and an array of workflows
36
+ # @see https://developer.github.com/v3/actions/workflow-runs/#list-repository-workflow-runs
37
+ def repository_workflow_runs(repo, options = {})
38
+ paginate "#{Repository.path repo}/actions/runs", options do |data, last_response|
39
+ data.workflow_runs.concat last_response.data.workflow_runs
40
+ end
41
+ end
42
+ alias list_repository_workflow_runs repository_workflow_runs
43
+
44
+ # Get a workflow run
45
+ #
46
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
47
+ # @param id [Integer] Id of a workflow run
48
+ #
49
+ # @return [Sawyer::Resource] Run information
50
+ # @see https://developer.github.com/v3/actions/workflow-runs/#get-a-workflow-run
51
+ def workflow_run(repo, id, options = {})
52
+ get "#{Repository.path repo}/actions/runs/#{id}", options
53
+ end
54
+
55
+ # Re-runs a workflow run
56
+ #
57
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
58
+ # @param id [Integer] Id of a workflow run
59
+ #
60
+ # @return [Boolean] Returns true if the re-run request was accepted
61
+ # @see https://developer.github.com/v3/actions/workflow-runs/#re-run-a-workflow
62
+ def rerun_workflow_run(repo, id, options = {})
63
+ boolean_from_response :post, "#{Repository.path repo}/actions/runs/#{id}/rerun", options
64
+ end
65
+
66
+ # Cancels a workflow run
67
+ #
68
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
69
+ # @param id [Integer] Id of a workflow run
70
+ #
71
+ # @return [Boolean] Returns true if the cancellation was accepted
72
+ # @see https://developer.github.com/v3/actions/workflow-runs/#cancel-a-workflow-run
73
+ def cancel_workflow_run(repo, id, options = {})
74
+ boolean_from_response :post, "#{Repository.path repo}/actions/runs/#{id}/cancel", options
75
+ end
76
+
77
+ # Deletes a workflow run
78
+ #
79
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
80
+ # @param id [Integer] Id of a workflow run
81
+ #
82
+ # @return [Boolean] Returns true if the run is deleted
83
+ # @see https://docs.github.com/en/rest/reference/actions#delete-a-workflow-run
84
+ def delete_workflow_run(repo, id, options = {})
85
+ boolean_from_response :delete, "#{Repository.path repo}/actions/runs/#{id}", options
86
+ end
87
+
88
+ # Get a download url for archived log files of a workflow run
89
+ #
90
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
91
+ # @param id [Integer] Id of a workflow run
92
+ #
93
+ # @return [String] URL to the archived log files of the run
94
+ # @see https://developer.github.com/v3/actions/workflow-runs/#download-workflow-run-logs
95
+ def workflow_run_logs(repo, id, options = {})
96
+ url = "#{Repository.path repo}/actions/runs/#{id}/logs"
97
+
98
+ response = client_without_redirects.head(url, options)
99
+ response.headers['Location']
100
+ end
101
+
102
+ # Delete all log files of a workflow run
103
+ #
104
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
105
+ # @param id [Integer] Id of a workflow run
106
+ #
107
+ # @return [Boolean] Returns true if the logs are deleted
108
+ # @see https://developer.github.com/v3/actions/workflow-runs/#delete-workflow-run-logs
109
+ def delete_workflow_run_logs(repo, id, options = {})
110
+ boolean_from_response :delete, "#{Repository.path repo}/actions/runs/#{id}/logs", options
111
+ end
112
+
113
+ # Get workflow run usage
114
+ #
115
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
116
+ # @param id [Integer] Id of a workflow run
117
+ #
118
+ # @return [Sawyer::Resource] Run usage
119
+ # @see https://developer.github.com/v3/actions/workflow-runs/#get-workflow-run-usage
120
+ def workflow_run_usage(repo, id, options = {})
121
+ get "#{Repository.path repo}/actions/runs/#{id}/timing", options
122
+ end
123
+ end
124
+ end
125
+ end
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Octokit
4
+ class Client
5
+ # Methods for the Actions Workflows API
6
+ #
7
+ # @see https://developer.github.com/v3/actions/workflows
8
+ module ActionsWorkflows
9
+ # Get the workflows in a repository
10
+ #
11
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
12
+ #
13
+ # @return [Sawyer::Resource] the total count and an array of workflows
14
+ # @see https://developer.github.com/v3/actions/workflows/#list-repository-workflows
15
+ def workflows(repo, options = {})
16
+ paginate "#{Repository.path repo}/actions/workflows", options do |data, last_response|
17
+ data.workflows.concat last_response.data.workflows
18
+ end
19
+ end
20
+ alias list_workflows workflows
21
+
22
+ # Get single workflow in a repository
23
+ #
24
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
25
+ # @param id [Integer, String] Id or file name of the workflow
26
+ #
27
+ # @return [Sawyer::Resource] A single workflow
28
+ # @see https://developer.github.com/v3/actions/workflows/#get-a-workflow
29
+ def workflow(repo, id, options = {})
30
+ get "#{Repository.path repo}/actions/workflows/#{id}", options
31
+ end
32
+
33
+ # Create a workflow dispatch event
34
+ #
35
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
36
+ # @param id [Integer, String] Id or file name of the workflow
37
+ # @param ref [String] A SHA, branch name, or tag name
38
+ #
39
+ # @return [Boolean] True if event was dispatched, false otherwise
40
+ # @see https://docs.github.com/en/rest/reference/actions#create-a-workflow-dispatch-event
41
+ def workflow_dispatch(repo, id, ref, options = {})
42
+ boolean_from_response :post, "#{Repository.path repo}/actions/workflows/#{id}/dispatches", options.merge({ ref: ref })
43
+ end
44
+
45
+ # Enable a workflow
46
+ #
47
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
48
+ # @param id [Integer, String] Id or file name of the workflow
49
+ #
50
+ # @return [Boolean] True if workflow was enabled, false otherwise
51
+ # @see https://docs.github.com/en/rest/actions/workflows#enable-a-workflow
52
+ def workflow_enable(repo, id, options = {})
53
+ boolean_from_response :put, "#{Repository.path repo}/actions/workflows/#{id}/enable", options
54
+ end
55
+
56
+ # Disable a workflow
57
+ #
58
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
59
+ # @param id [Integer, String] Id or file name of the workflow
60
+ #
61
+ # @return [Boolean] True if workflow was disabled, false otherwise
62
+ # @see https://docs.github.com/en/rest/actions/workflows#disable-a-workflow
63
+ def workflow_disable(repo, id, options = {})
64
+ boolean_from_response :put, "#{Repository.path repo}/actions/workflows/#{id}/disable", options
65
+ end
66
+ end
67
+ end
68
+ end
@@ -1,28 +1,38 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Octokit
2
4
  class Client
3
-
4
5
  # Methods for the Apps API
5
6
  module Apps
7
+ # Get the authenticated App
8
+ #
9
+ # @param options [Hash] A customizable set of options
10
+ #
11
+ # @see https://developer.github.com/v3/apps/#get-the-authenticated-app
12
+ #
13
+ # @return [Sawyer::Resource] App information
14
+ def app(options = {})
15
+ get 'app', options
16
+ end
6
17
 
7
18
  # Find all installations that belong to an App
8
19
  #
9
20
  # @param options [Hash] A customizable set of options
10
21
  #
11
- # @see https://developer.github.com/v3/apps/#find-installations
22
+ # @see https://developer.github.com/v3/apps/#list-installations
12
23
  #
13
24
  # @return [Array<Sawyer::Resource>] the total_count and an array of installations
14
25
  def find_app_installations(options = {})
15
- opts = ensure_api_media_type(:integrations, options)
16
- paginate "app/installations", opts
26
+ paginate 'app/installations', options
17
27
  end
18
28
  alias find_installations find_app_installations
19
29
 
20
30
  def find_integration_installations(options = {})
21
31
  octokit_warn(
22
- "Deprecated: Octokit::Client::Apps#find_integration_installations "\
23
- "method is deprecated. Please update your call to use "\
24
- "Octokit::Client::Apps#find_app_installations before the next major "\
25
- "Octokit version update."
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
+ 'Octokit version update.'
26
36
  )
27
37
  find_app_installations(options)
28
38
  end
@@ -31,12 +41,11 @@ module Octokit
31
41
  #
32
42
  # @param options [Hash] A customizable set of options
33
43
  #
34
- # @see https://developer.github.com/v3/apps/#list-installations-for-user
44
+ # @see https://developer.github.com/v3/apps/installations/#list-installations-for-a-user
35
45
  #
36
46
  # @return [Sawyer::Resource] the total_count and an array of installations
37
47
  def find_user_installations(options = {})
38
- opts = ensure_api_media_type(:integrations, options)
39
- paginate("user/installations", opts) do |data, last_response|
48
+ paginate('user/installations', options) do |data, last_response|
40
49
  data.installations.concat last_response.data.installations
41
50
  end
42
51
  end
@@ -45,12 +54,11 @@ module Octokit
45
54
  #
46
55
  # @param id [Integer] Installation id
47
56
  #
48
- # @see https://developer.github.com/v3/apps/#get-a-single-installation
57
+ # @see https://developer.github.com/v3/apps/#get-an-installation
49
58
  #
50
59
  # @return [Sawyer::Resource] Installation information
51
60
  def installation(id, options = {})
52
- opts = ensure_api_media_type(:integrations, options)
53
- get "app/installations/#{id}", opts
61
+ get "app/installations/#{id}", options
54
62
  end
55
63
 
56
64
  # Create a new installation token
@@ -58,21 +66,20 @@ module Octokit
58
66
  # @param installation [Integer] The id of a GitHub App Installation
59
67
  # @param options [Hash] A customizable set of options
60
68
  #
61
- # @see https://developer.github.com/v3/apps/#find-installations
69
+ # @see https://developer.github.com/v3/apps/#create-a-new-installation-token
62
70
  #
63
71
  # @return [<Sawyer::Resource>] An installation token
64
72
  def create_app_installation_access_token(installation, options = {})
65
- opts = ensure_api_media_type(:integrations, options)
66
- post "app/installations/#{installation}/access_tokens", opts
73
+ post "app/installations/#{installation}/access_tokens", options
67
74
  end
68
75
  alias create_installation_access_token create_app_installation_access_token
69
76
 
70
77
  def create_integration_installation_access_token(installation, options = {})
71
78
  octokit_warn(
72
- "Deprecated: Octokit::Client::Apps#create_integration_installation_access_token "\
73
- "method is deprecated. Please update your call to use "\
74
- "Octokit::Client::Apps#create_app_installation_access_token before the next major "\
75
- "Octokit version update."
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
+ 'Octokit version update.'
76
83
  )
77
84
  create_app_installation_access_token(installation, options)
78
85
  end
@@ -82,12 +89,11 @@ module Octokit
82
89
  # @param organization [String] Organization GitHub login
83
90
  # @param options [Hash] A customizable set of options
84
91
  #
85
- # @see https://developer.github.com/v3/apps/#find-organization-installation
92
+ # @see https://developer.github.com/v3/apps/#get-an-organization-installation
86
93
  #
87
94
  # @return [Sawyer::Resource] Installation information
88
95
  def find_organization_installation(organization, options = {})
89
- opts = ensure_api_media_type(:integrations, options)
90
- get "#{Organization.path(organization)}/installation", opts
96
+ get "#{Organization.path(organization)}/installation", options
91
97
  end
92
98
 
93
99
  # Enables an app to find the repository's installation information.
@@ -95,12 +101,11 @@ module Octokit
95
101
  # @param repo [String] A GitHub repository
96
102
  # @param options [Hash] A customizable set of options
97
103
  #
98
- # @see https://developer.github.com/v3/apps/#find-repository-installation
104
+ # @see https://developer.github.com/v3/apps/#get-a-repository-installation
99
105
  #
100
106
  # @return [Sawyer::Resource] Installation information
101
107
  def find_repository_installation(repo, options = {})
102
- opts = ensure_api_media_type(:integrations, options)
103
- get "#{Repository.path(repo)}/installation", opts
108
+ get "#{Repository.path(repo)}/installation", options
104
109
  end
105
110
 
106
111
  # Enables an app to find the user's installation information.
@@ -108,23 +113,22 @@ module Octokit
108
113
  # @param user [String] GitHub user login
109
114
  # @param options [Hash] A customizable set of options
110
115
  #
111
- # @see https://developer.github.com/v3/apps/#find-user-installation
116
+ # @see https://developer.github.com/v3/apps/#get-a-user-installation
112
117
  #
113
118
  # @return [Sawyer::Resource] Installation information
114
119
  def find_user_installation(user, options = {})
115
- opts = ensure_api_media_type(:integrations, options)
116
- get "#{User.path(user)}/installation", opts
120
+ get "#{User.path(user)}/installation", options
117
121
  end
118
122
 
119
123
  # List repositories that are accessible to the authenticated installation
120
124
  #
121
125
  # @param options [Hash] A customizable set of options
126
+ #
122
127
  # @see https://developer.github.com/v3/apps/installations/#list-repositories
123
128
  #
124
129
  # @return [Sawyer::Resource] the total_count and an array of repositories
125
130
  def list_app_installation_repositories(options = {})
126
- opts = ensure_api_media_type(:integrations, options)
127
- paginate("installation/repositories", opts) do |data, last_response|
131
+ paginate('installation/repositories', options) do |data, last_response|
128
132
  data.repositories.concat last_response.data.repositories
129
133
  end
130
134
  end
@@ -132,10 +136,10 @@ module Octokit
132
136
 
133
137
  def list_integration_installation_repositories(options = {})
134
138
  octokit_warn(
135
- "Deprecated: Octokit::Client::Apps#list_integration_installation_repositories "\
136
- "method is deprecated. Please update your call to use "\
137
- "Octokit::Client::Apps#list_app_installation_repositories before the next major "\
138
- "Octokit version update."
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
+ 'Octokit version update.'
139
143
  )
140
144
  list_app_installation_repositories(options)
141
145
  end
@@ -150,17 +154,16 @@ module Octokit
150
154
  #
151
155
  # @return [Boolean] Success
152
156
  def add_repository_to_app_installation(installation, repo, options = {})
153
- opts = ensure_api_media_type(:integrations, options)
154
- boolean_from_response :put, "user/installations/#{installation}/repositories/#{repo}", opts
157
+ boolean_from_response :put, "user/installations/#{installation}/repositories/#{repo}", options
155
158
  end
156
159
  alias add_repo_to_installation add_repository_to_app_installation
157
160
 
158
161
  def add_repository_to_integration_installation(installation, repo, options = {})
159
162
  octokit_warn(
160
- "Deprecated: Octokit::Client::Apps#add_repository_to_integration_installation "\
161
- "method is deprecated. Please update your call to use "\
162
- "Octokit::Client::Apps#add_repository_to_app_installation before the next major "\
163
- "Octokit version update."
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
+ 'Octokit version update.'
164
167
  )
165
168
  add_repository_to_app_installation(installation, repo, options)
166
169
  end
@@ -175,17 +178,16 @@ module Octokit
175
178
  #
176
179
  # @return [Boolean] Success
177
180
  def remove_repository_from_app_installation(installation, repo, options = {})
178
- opts = ensure_api_media_type(:integrations, options)
179
- boolean_from_response :delete, "user/installations/#{installation}/repositories/#{repo}", opts
181
+ boolean_from_response :delete, "user/installations/#{installation}/repositories/#{repo}", options
180
182
  end
181
183
  alias remove_repo_from_installation remove_repository_from_app_installation
182
184
 
183
185
  def remove_repository_from_integration_installation(installation, repo, options = {})
184
186
  octokit_warn(
185
- "Deprecated: Octokit::Client::Apps#remove_repository_from_integration_installation "\
186
- "method is deprecated. Please update your call to use "\
187
- "Octokit::Client::Apps#remove_repository_from_app_installation before the next major "\
188
- "Octokit version update."
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
+ 'Octokit version update.'
189
191
  )
190
192
  remove_repository_from_app_installation(installation, repo, options)
191
193
  end
@@ -195,12 +197,11 @@ module Octokit
195
197
  # @param installation [Integer] The id of a GitHub App Installation
196
198
  # @param options [Hash] A customizable set of options
197
199
  #
198
- # @see https://developer.github.com/apps/building-integrations/setting-up-and-registering-github-apps/identifying-users-for-github-apps/
200
+ # @see https://developer.github.com/v3/apps/installations/#list-repositories-accessible-to-the-user-for-an-installation
199
201
  #
200
202
  # @return [Sawyer::Resource] the total_count and an array of repositories
201
203
  def find_installation_repositories_for_user(installation, options = {})
202
- opts = ensure_api_media_type(:integrations, options)
203
- paginate("user/installations/#{installation}/repositories", opts) do |data, last_response|
204
+ paginate("user/installations/#{installation}/repositories", options) do |data, last_response|
204
205
  data.repositories.concat last_response.data.repositories
205
206
  end
206
207
  end
@@ -214,8 +215,7 @@ module Octokit
214
215
  #
215
216
  # @return [Boolean] Success
216
217
  def delete_installation(installation, options = {})
217
- opts = ensure_api_media_type(:uninstall_github_app, options)
218
- boolean_from_response :delete, "app/installations/#{installation}", opts
218
+ boolean_from_response :delete, "app/installations/#{installation}", options
219
219
  end
220
220
  end
221
221
  end