gitabu 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +33 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +65 -0
- data/LICENSE.txt +21 -0
- data/README.md +42 -0
- data/Rakefile +12 -0
- data/gitabu.gemspec +41 -0
- data/lib/gitabu/api/v3/actions.rb +3724 -0
- data/lib/gitabu/api/v3/activity.rb +835 -0
- data/lib/gitabu/api/v3/apps.rb +961 -0
- data/lib/gitabu/api/v3/billing.rb +217 -0
- data/lib/gitabu/api/v3/branches.rb +1098 -0
- data/lib/gitabu/api/v3/checks.rb +384 -0
- data/lib/gitabu/api/v3/code_scanning.rb +315 -0
- data/lib/gitabu/api/v3/codes_of_conduct.rb +92 -0
- data/lib/gitabu/api/v3/codespaces.rb +650 -0
- data/lib/gitabu/api/v3/collaborators.rb +341 -0
- data/lib/gitabu/api/v3/commits.rb +428 -0
- data/lib/gitabu/api/v3/dependabot.rb +419 -0
- data/lib/gitabu/api/v3/deploy_keys.rb +152 -0
- data/lib/gitabu/api/v3/deployments.rb +356 -0
- data/lib/gitabu/api/v3/emojis.rb +67 -0
- data/lib/gitabu/api/v3/enterprise_admin.rb +495 -0
- data/lib/gitabu/api/v3/gists.rb +552 -0
- data/lib/gitabu/api/v3/git.rb +409 -0
- data/lib/gitabu/api/v3/gitignore.rb +92 -0
- data/lib/gitabu/api/v3/interactions.rb +275 -0
- data/lib/gitabu/api/v3/issues.rb +1119 -0
- data/lib/gitabu/api/v3/licenses.rb +118 -0
- data/lib/gitabu/api/v3/markdown.rb +94 -0
- data/lib/gitabu/api/v3/meta.rb +142 -0
- data/lib/gitabu/api/v3/metrics.rb +302 -0
- data/lib/gitabu/api/v3/migrations.rb +631 -0
- data/lib/gitabu/api/v3/orgs.rb +1291 -0
- data/lib/gitabu/api/v3/packages.rb +686 -0
- data/lib/gitabu/api/v3/pages.rb +282 -0
- data/lib/gitabu/api/v3/projects.rb +693 -0
- data/lib/gitabu/api/v3/pulls.rb +816 -0
- data/lib/gitabu/api/v3/rate_limit.rb +67 -0
- data/lib/gitabu/api/v3/reactions.rb +734 -0
- data/lib/gitabu/api/v3/releases.rb +411 -0
- data/lib/gitabu/api/v3/repos.rb +1136 -0
- data/lib/gitabu/api/v3/scim.rb +214 -0
- data/lib/gitabu/api/v3/search.rb +217 -0
- data/lib/gitabu/api/v3/secret_scanning.rb +201 -0
- data/lib/gitabu/api/v3/teams.rb +1963 -0
- data/lib/gitabu/api/v3/users.rb +851 -0
- data/lib/gitabu/api/v3/webhooks.rb +379 -0
- data/lib/gitabu/builder.rb +37 -0
- data/lib/gitabu/client.rb +8 -0
- data/lib/gitabu/generator.rb +75 -0
- data/lib/gitabu/http_client.rb +96 -0
- data/lib/gitabu/items.rb +110 -0
- data/lib/gitabu/public/api/v3/actions.json +5779 -0
- data/lib/gitabu/public/api/v3/activity.json +1248 -0
- data/lib/gitabu/public/api/v3/apps.json +1174 -0
- data/lib/gitabu/public/api/v3/billing.json +183 -0
- data/lib/gitabu/public/api/v3/branches.json +1886 -0
- data/lib/gitabu/public/api/v3/checks.json +856 -0
- data/lib/gitabu/public/api/v3/code_scanning.json +666 -0
- data/lib/gitabu/public/api/v3/codes_of_conduct.json +41 -0
- data/lib/gitabu/public/api/v3/codespaces.json +884 -0
- data/lib/gitabu/public/api/v3/collaborators.json +464 -0
- data/lib/gitabu/public/api/v3/commits.json +830 -0
- data/lib/gitabu/public/api/v3/dependabot.json +596 -0
- data/lib/gitabu/public/api/v3/deploy_keys.json +195 -0
- data/lib/gitabu/public/api/v3/deployments.json +698 -0
- data/lib/gitabu/public/api/v3/emojis.json +18 -0
- data/lib/gitabu/public/api/v3/enterprise_admin.json +881 -0
- data/lib/gitabu/public/api/v3/gists.json +689 -0
- data/lib/gitabu/public/api/v3/git.json +735 -0
- data/lib/gitabu/public/api/v3/gitignore.json +41 -0
- data/lib/gitabu/public/api/v3/interactions.json +265 -0
- data/lib/gitabu/public/api/v3/issues.json +2359 -0
- data/lib/gitabu/public/api/v3/licenses.json +100 -0
- data/lib/gitabu/public/api/v3/markdown.json +59 -0
- data/lib/gitabu/public/api/v3/meta.json +69 -0
- data/lib/gitabu/public/api/v3/metrics.json +342 -0
- data/lib/gitabu/public/api/v3/migrations.json +960 -0
- data/lib/gitabu/public/api/v3/orgs.json +1989 -0
- data/lib/gitabu/public/api/v3/packages.json +1078 -0
- data/lib/gitabu/public/api/v3/pages.json +373 -0
- data/lib/gitabu/public/api/v3/projects.json +966 -0
- data/lib/gitabu/public/api/v3/pulls.json +1768 -0
- data/lib/gitabu/public/api/v3/rate_limit.json +18 -0
- data/lib/gitabu/public/api/v3/reactions.json +1425 -0
- data/lib/gitabu/public/api/v3/releases.json +753 -0
- data/lib/gitabu/public/api/v3/repos.json +2314 -0
- data/lib/gitabu/public/api/v3/scim.json +412 -0
- data/lib/gitabu/public/api/v3/search.json +408 -0
- data/lib/gitabu/public/api/v3/secret_scanning.json +385 -0
- data/lib/gitabu/public/api/v3/teams.json +3126 -0
- data/lib/gitabu/public/api/v3/users.json +956 -0
- data/lib/gitabu/public/api/v3/webhooks.json +667 -0
- data/lib/gitabu/run.rb +237 -0
- data/lib/gitabu/scraper.rb +86 -0
- data/lib/gitabu/templates/template.rb.erb +70 -0
- data/lib/gitabu/version.rb +6 -0
- data/lib/gitabu.rb +57 -0
- data/sig/gitabu.rbs +4 -0
- metadata +177 -0
@@ -0,0 +1,356 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# INFO ON GENERATED CODE
|
4
|
+
#
|
5
|
+
# This file is generated.
|
6
|
+
# See the contribution guide on how to improve the code.
|
7
|
+
#
|
8
|
+
# INFO ON GENERATED CODE
|
9
|
+
|
10
|
+
# Ruby gem that helps you work with Github API.
|
11
|
+
module Gitabu
|
12
|
+
# API module
|
13
|
+
module Api
|
14
|
+
# Github Version 3
|
15
|
+
module V3
|
16
|
+
# Class to display Deployments result
|
17
|
+
class DeploymentsResult
|
18
|
+
attr_accessor :result, :message
|
19
|
+
|
20
|
+
def initialize(result:, message:)
|
21
|
+
@result = result
|
22
|
+
@message = message
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# Class to display error result
|
27
|
+
class DeploymentsErrorResult
|
28
|
+
attr_accessor :result, :message
|
29
|
+
|
30
|
+
def initialize(result:, message:)
|
31
|
+
@result = result
|
32
|
+
@message = message
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Deployments endpoints.
|
37
|
+
class Deployments
|
38
|
+
def self.list_deployments(owner: nil, repo: nil, options: nil)
|
39
|
+
new.list_deployments(owner, repo, options)
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.create_a_deployment(owner: nil, repo: nil, ref: nil, task: nil, auto_merge: nil, required_contexts: nil, payload: nil, environment: nil, description: nil, transient_environment: nil, production_environment: nil, options: nil)
|
43
|
+
new.create_a_deployment(owner, repo, ref, task, auto_merge, required_contexts, payload, environment, description, transient_environment, production_environment, options)
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.get_a_deployment(owner: nil, repo: nil, deployment_id: nil, options: nil)
|
47
|
+
new.get_a_deployment(owner, repo, deployment_id, options)
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.delete_a_deployment(owner: nil, repo: nil, deployment_id: nil, options: nil)
|
51
|
+
new.delete_a_deployment(owner, repo, deployment_id, options)
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.get_all_environments(owner: nil, repo: nil, options: nil)
|
55
|
+
new.get_all_environments(owner, repo, options)
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.get_an_environment(owner: nil, repo: nil, environment_name: nil, options: nil)
|
59
|
+
new.get_an_environment(owner, repo, environment_name, options)
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.create_or_update_an_environment(owner: nil, repo: nil, environment_name: nil, wait_timer: nil, reviewers: nil, deployment_branch_policy: nil, options: nil)
|
63
|
+
new.create_or_update_an_environment(owner, repo, environment_name, wait_timer, reviewers, deployment_branch_policy, options)
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.delete_an_environment(owner: nil, repo: nil, environment_name: nil, options: nil)
|
67
|
+
new.delete_an_environment(owner, repo, environment_name, options)
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.list_deployment_statuses(owner: nil, repo: nil, deployment_id: nil, options: nil)
|
71
|
+
new.list_deployment_statuses(owner, repo, deployment_id, options)
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.create_a_deployment_status(owner: nil, repo: nil, deployment_id: nil, state: nil, target_url: nil, log_url: nil, description: nil, environment: nil, environment_url: nil, auto_inactive: nil, options: nil)
|
75
|
+
new.create_a_deployment_status(owner, repo, deployment_id, state, target_url, log_url, description, environment, environment_url, auto_inactive, options)
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.get_a_deployment_status(owner: nil, repo: nil, deployment_id: nil, status_id: nil, options: nil)
|
79
|
+
new.get_a_deployment_status(owner, repo, deployment_id, status_id, options)
|
80
|
+
end
|
81
|
+
|
82
|
+
private
|
83
|
+
|
84
|
+
# list deployments
|
85
|
+
#
|
86
|
+
# @param owner [String]
|
87
|
+
# @param repo [String]
|
88
|
+
#
|
89
|
+
# @return DeploymentsResult, DeploymentsErrorResult
|
90
|
+
def list_deployments(owner, repo, options)
|
91
|
+
auth = nil
|
92
|
+
body = nil
|
93
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
94
|
+
params = { sha: options[:sha], ref: options[:ref], task: options[:task], environment: options[:environment], per_page: options[:per_page], page: options[:page] }
|
95
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/deployments"
|
96
|
+
|
97
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
98
|
+
|
99
|
+
if http_call.successful?
|
100
|
+
DeploymentsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
101
|
+
else
|
102
|
+
DeploymentsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
# create a deployment
|
107
|
+
#
|
108
|
+
# @param owner [String]
|
109
|
+
# @param repo [String]
|
110
|
+
# @param ref [String] Required. The ref to deploy. This can be a branch, tag, or SHA.
|
111
|
+
# @param task [String] Specifies a task to execute (e.g., deploy or deploy:migrations).Default: deploy
|
112
|
+
# @param auto_merge [Boolean] Attempts to automatically merge the default branch into the requested ref, if it's behind the default branch.Default:
|
113
|
+
# @param required_contexts [Array of strings] The status contexts to verify against commit status checks. If you omit this parameter, GitHub verifies all unique contexts before creating a deployment. To bypass checking entirely, pass an empty array. Defaults to all unique contexts.
|
114
|
+
# @param payload [Object or string or ] JSON payload with extra information about the deployment.
|
115
|
+
# @param environment [String] Name for the target deployment environment (e.g., production, staging, qa).Default: production
|
116
|
+
# @param description [String or null] Short description of the deployment.
|
117
|
+
# @param transient_environment [Boolean] Specifies if the given environment is specific to the deployment and will no longer exist at some point in the future. Default: false
|
118
|
+
# @param production_environment [Boolean] Specifies if the given environment is one that end-users directly interact with. Default: true when environment is production and false otherwise.
|
119
|
+
#
|
120
|
+
# @return DeploymentsResult, DeploymentsErrorResult
|
121
|
+
def create_a_deployment(owner, repo, ref, task, auto_merge, required_contexts, payload, environment, description, transient_environment, production_environment, _options)
|
122
|
+
auth = nil
|
123
|
+
body = { ref: ref, task: task, auto_merge: auto_merge, required_contexts: required_contexts, payload: payload, environment: environment, description: description, transient_environment: transient_environment, production_environment: production_environment }
|
124
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
125
|
+
params = nil
|
126
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/deployments"
|
127
|
+
|
128
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
129
|
+
|
130
|
+
if http_call.successful?
|
131
|
+
DeploymentsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
132
|
+
else
|
133
|
+
DeploymentsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
# get a deployment
|
138
|
+
#
|
139
|
+
# @param owner [String]
|
140
|
+
# @param repo [String]
|
141
|
+
# @param deployment_id [Integer] deployment_id parameter
|
142
|
+
#
|
143
|
+
# @return DeploymentsResult, DeploymentsErrorResult
|
144
|
+
def get_a_deployment(owner, repo, deployment_id, _options)
|
145
|
+
auth = nil
|
146
|
+
body = nil
|
147
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
148
|
+
params = nil
|
149
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/deployments/#{deployment_id}"
|
150
|
+
|
151
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
152
|
+
|
153
|
+
if http_call.successful?
|
154
|
+
DeploymentsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
155
|
+
else
|
156
|
+
DeploymentsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
# delete a deployment
|
161
|
+
#
|
162
|
+
# @param owner [String]
|
163
|
+
# @param repo [String]
|
164
|
+
# @param deployment_id [Integer] deployment_id parameter
|
165
|
+
#
|
166
|
+
# @return DeploymentsResult, DeploymentsErrorResult
|
167
|
+
def delete_a_deployment(owner, repo, deployment_id, _options)
|
168
|
+
auth = nil
|
169
|
+
body = nil
|
170
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
171
|
+
params = nil
|
172
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/deployments/#{deployment_id}"
|
173
|
+
|
174
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
175
|
+
|
176
|
+
if http_call.successful?
|
177
|
+
DeploymentsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
178
|
+
else
|
179
|
+
DeploymentsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
# get all environments
|
184
|
+
#
|
185
|
+
# @param owner [String]
|
186
|
+
# @param repo [String]
|
187
|
+
#
|
188
|
+
# @return DeploymentsResult, DeploymentsErrorResult
|
189
|
+
def get_all_environments(owner, repo, options)
|
190
|
+
auth = nil
|
191
|
+
body = nil
|
192
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
193
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
194
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/environments"
|
195
|
+
|
196
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
197
|
+
|
198
|
+
if http_call.successful?
|
199
|
+
DeploymentsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
200
|
+
else
|
201
|
+
DeploymentsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
# get an environment
|
206
|
+
#
|
207
|
+
# @param owner [String]
|
208
|
+
# @param repo [String]
|
209
|
+
# @param environment_name [String] The name of the environment
|
210
|
+
#
|
211
|
+
# @return DeploymentsResult, DeploymentsErrorResult
|
212
|
+
def get_an_environment(owner, repo, environment_name, _options)
|
213
|
+
auth = nil
|
214
|
+
body = nil
|
215
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
216
|
+
params = nil
|
217
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/environments/#{environment_name}"
|
218
|
+
|
219
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
220
|
+
|
221
|
+
if http_call.successful?
|
222
|
+
DeploymentsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
223
|
+
else
|
224
|
+
DeploymentsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
# create or update an environment
|
229
|
+
#
|
230
|
+
# @param owner [String]
|
231
|
+
# @param repo [String]
|
232
|
+
# @param environment_name [String] The name of the environment
|
233
|
+
# @param wait_timer [Integer] The amount of time to delay a job after the job is initially triggered. The time (in minutes) must be an integer between 0 and 43,200 (30 days).
|
234
|
+
# @param reviewers [Array of objects or null] The people or teams that may review jobs that reference the environment. You can list up to six users or teams as reviewers. The reviewers must have at least read access to the repository. Only one of the required reviewers needs to approve the job for it to proceed.
|
235
|
+
# @param deployment_branch_policy [Object or null] The type of deployment branch policy for this environment. To allow all branches to deploy, set to null.
|
236
|
+
#
|
237
|
+
# @return DeploymentsResult, DeploymentsErrorResult
|
238
|
+
def create_or_update_an_environment(owner, repo, environment_name, wait_timer, reviewers, deployment_branch_policy, _options)
|
239
|
+
auth = nil
|
240
|
+
body = { wait_timer: wait_timer, reviewers: reviewers, deployment_branch_policy: deployment_branch_policy }
|
241
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
242
|
+
params = nil
|
243
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/environments/#{environment_name}"
|
244
|
+
|
245
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :put, params: params, uri: uri)
|
246
|
+
|
247
|
+
if http_call.successful?
|
248
|
+
DeploymentsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
249
|
+
else
|
250
|
+
DeploymentsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
# delete an environment
|
255
|
+
#
|
256
|
+
# @param owner [String]
|
257
|
+
# @param repo [String]
|
258
|
+
# @param environment_name [String] The name of the environment
|
259
|
+
#
|
260
|
+
# @return DeploymentsResult, DeploymentsErrorResult
|
261
|
+
def delete_an_environment(owner, repo, environment_name, _options)
|
262
|
+
auth = nil
|
263
|
+
body = nil
|
264
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
265
|
+
params = nil
|
266
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/environments/#{environment_name}"
|
267
|
+
|
268
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :delete, params: params, uri: uri)
|
269
|
+
|
270
|
+
if http_call.successful?
|
271
|
+
DeploymentsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
272
|
+
else
|
273
|
+
DeploymentsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
277
|
+
# list deployment statuses
|
278
|
+
#
|
279
|
+
# @param owner [String]
|
280
|
+
# @param repo [String]
|
281
|
+
# @param deployment_id [Integer] deployment_id parameter
|
282
|
+
#
|
283
|
+
# @return DeploymentsResult, DeploymentsErrorResult
|
284
|
+
def list_deployment_statuses(owner, repo, deployment_id, options)
|
285
|
+
auth = nil
|
286
|
+
body = nil
|
287
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
288
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
289
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/deployments/#{deployment_id}/statuses"
|
290
|
+
|
291
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
292
|
+
|
293
|
+
if http_call.successful?
|
294
|
+
DeploymentsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
295
|
+
else
|
296
|
+
DeploymentsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
297
|
+
end
|
298
|
+
end
|
299
|
+
|
300
|
+
# create a deployment status
|
301
|
+
#
|
302
|
+
# @param owner [String]
|
303
|
+
# @param repo [String]
|
304
|
+
# @param deployment_id [Integer] deployment_id parameter
|
305
|
+
# @param state [String] Required. The state of the status. Can be one of error, failure, inactive, in_progress, queued, pending, or success. When you set a transient deployment to inactive, the deployment will be shown as destroyed in GitHub.
|
306
|
+
# @param target_url [String] The target URL to associate with this status. This URL should contain output to keep the user updated while the task is running or serve as historical information for what happened in the deployment. Note: It's recommended to use the log_url parameter, which replaces target_url.
|
307
|
+
# @param log_url [String] The full URL of the deployment's output. This parameter replaces target_url. We will continue to accept target_url to support legacy uses, but we recommend replacing target_url with log_url. Setting log_url will automatically set target_url to the same value. Default: ""
|
308
|
+
# @param description [String] A short description of the status. The maximum description length is 140 characters.
|
309
|
+
# @param environment [String] Name for the target deployment environment, which can be changed when setting a deploy status. For example, production, staging, or qa.
|
310
|
+
# @param environment_url [String] Sets the URL for accessing your environment. Default: ""
|
311
|
+
# @param auto_inactive [Boolean] Adds a new inactive status to all prior non-transient, non-production environment deployments with the same repository and environment name as the created status's deployment. An inactive status is only added to deployments that had a success state. Default: true
|
312
|
+
#
|
313
|
+
# @return DeploymentsResult, DeploymentsErrorResult
|
314
|
+
def create_a_deployment_status(owner, repo, deployment_id, state, target_url, log_url, description, environment, environment_url, auto_inactive, _options)
|
315
|
+
auth = nil
|
316
|
+
body = { state: state, target_url: target_url, log_url: log_url, description: description, environment: environment, environment_url: environment_url, auto_inactive: auto_inactive }
|
317
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
318
|
+
params = nil
|
319
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/deployments/#{deployment_id}/statuses"
|
320
|
+
|
321
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
|
322
|
+
|
323
|
+
if http_call.successful?
|
324
|
+
DeploymentsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
325
|
+
else
|
326
|
+
DeploymentsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
327
|
+
end
|
328
|
+
end
|
329
|
+
|
330
|
+
# get a deployment status
|
331
|
+
#
|
332
|
+
# @param owner [String]
|
333
|
+
# @param repo [String]
|
334
|
+
# @param deployment_id [Integer] deployment_id parameter
|
335
|
+
# @param status_id [Integer]
|
336
|
+
#
|
337
|
+
# @return DeploymentsResult, DeploymentsErrorResult
|
338
|
+
def get_a_deployment_status(owner, repo, deployment_id, status_id, _options)
|
339
|
+
auth = nil
|
340
|
+
body = nil
|
341
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
342
|
+
params = nil
|
343
|
+
uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/deployments/#{deployment_id}/statuses/#{status_id}"
|
344
|
+
|
345
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
346
|
+
|
347
|
+
if http_call.successful?
|
348
|
+
DeploymentsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
349
|
+
else
|
350
|
+
DeploymentsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
351
|
+
end
|
352
|
+
end
|
353
|
+
end
|
354
|
+
end
|
355
|
+
end
|
356
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# INFO ON GENERATED CODE
|
4
|
+
#
|
5
|
+
# This file is generated.
|
6
|
+
# See the contribution guide on how to improve the code.
|
7
|
+
#
|
8
|
+
# INFO ON GENERATED CODE
|
9
|
+
|
10
|
+
# Ruby gem that helps you work with Github API.
|
11
|
+
module Gitabu
|
12
|
+
# API module
|
13
|
+
module Api
|
14
|
+
# Github Version 3
|
15
|
+
module V3
|
16
|
+
# Class to display Emojis result
|
17
|
+
class EmojisResult
|
18
|
+
attr_accessor :result, :message
|
19
|
+
|
20
|
+
def initialize(result:, message:)
|
21
|
+
@result = result
|
22
|
+
@message = message
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# Class to display error result
|
27
|
+
class EmojisErrorResult
|
28
|
+
attr_accessor :result, :message
|
29
|
+
|
30
|
+
def initialize(result:, message:)
|
31
|
+
@result = result
|
32
|
+
@message = message
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Emojis endpoints.
|
37
|
+
class Emojis
|
38
|
+
def self.get_emojis(options: nil)
|
39
|
+
new.get_emojis(options)
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
# get emojis
|
45
|
+
#
|
46
|
+
# @params options [Hash]
|
47
|
+
#
|
48
|
+
# @return EmojisResult, EmojisErrorResult
|
49
|
+
def get_emojis(_options)
|
50
|
+
auth = nil
|
51
|
+
body = nil
|
52
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
53
|
+
params = nil
|
54
|
+
uri = "#{Gitabu::BASE_URL}/emojis"
|
55
|
+
|
56
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
57
|
+
|
58
|
+
if http_call.successful?
|
59
|
+
EmojisResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
60
|
+
else
|
61
|
+
EmojisErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|