gitabu 0.1.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 +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,217 @@
|
|
|
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 Billing result
|
|
17
|
+
class BillingResult
|
|
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 BillingErrorResult
|
|
28
|
+
attr_accessor :result, :message
|
|
29
|
+
|
|
30
|
+
def initialize(result:, message:)
|
|
31
|
+
@result = result
|
|
32
|
+
@message = message
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Billing endpoints.
|
|
37
|
+
class Billing
|
|
38
|
+
def self.get_github_actions_billing_for_an_organization(org: nil, options: nil)
|
|
39
|
+
new.get_github_actions_billing_for_an_organization(org, options)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def self.get_github_advanced_security_active_committers_for_an_organization(org: nil, options: nil)
|
|
43
|
+
new.get_github_advanced_security_active_committers_for_an_organization(org, options)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def self.get_github_packages_billing_for_an_organization(org: nil, options: nil)
|
|
47
|
+
new.get_github_packages_billing_for_an_organization(org, options)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def self.get_shared_storage_billing_for_an_organization(org: nil, options: nil)
|
|
51
|
+
new.get_shared_storage_billing_for_an_organization(org, options)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def self.get_github_actions_billing_for_a_user(username: nil, options: nil)
|
|
55
|
+
new.get_github_actions_billing_for_a_user(username, options)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def self.get_github_packages_billing_for_a_user(username: nil, options: nil)
|
|
59
|
+
new.get_github_packages_billing_for_a_user(username, options)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def self.get_shared_storage_billing_for_a_user(username: nil, options: nil)
|
|
63
|
+
new.get_shared_storage_billing_for_a_user(username, options)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
private
|
|
67
|
+
|
|
68
|
+
# get github actions billing for an organization
|
|
69
|
+
#
|
|
70
|
+
# @param org [String]
|
|
71
|
+
#
|
|
72
|
+
# @return BillingResult, BillingErrorResult
|
|
73
|
+
def get_github_actions_billing_for_an_organization(org, _options)
|
|
74
|
+
auth = nil
|
|
75
|
+
body = nil
|
|
76
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
77
|
+
params = nil
|
|
78
|
+
uri = "#{Gitabu::BASE_URL}/orgs/#{org}/settings/billing/actions"
|
|
79
|
+
|
|
80
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
81
|
+
|
|
82
|
+
if http_call.successful?
|
|
83
|
+
BillingResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
84
|
+
else
|
|
85
|
+
BillingErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# get github advanced security active committers for an organization
|
|
90
|
+
#
|
|
91
|
+
# @param org [String]
|
|
92
|
+
#
|
|
93
|
+
# @return BillingResult, BillingErrorResult
|
|
94
|
+
def get_github_advanced_security_active_committers_for_an_organization(org, options)
|
|
95
|
+
auth = nil
|
|
96
|
+
body = nil
|
|
97
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
98
|
+
params = { per_page: options[:per_page], page: options[:page] }
|
|
99
|
+
uri = "#{Gitabu::BASE_URL}/orgs/#{org}/settings/billing/advanced-security"
|
|
100
|
+
|
|
101
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
102
|
+
|
|
103
|
+
if http_call.successful?
|
|
104
|
+
BillingResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
105
|
+
else
|
|
106
|
+
BillingErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# get github packages billing for an organization
|
|
111
|
+
#
|
|
112
|
+
# @param org [String]
|
|
113
|
+
#
|
|
114
|
+
# @return BillingResult, BillingErrorResult
|
|
115
|
+
def get_github_packages_billing_for_an_organization(org, _options)
|
|
116
|
+
auth = nil
|
|
117
|
+
body = nil
|
|
118
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
119
|
+
params = nil
|
|
120
|
+
uri = "#{Gitabu::BASE_URL}/orgs/#{org}/settings/billing/packages"
|
|
121
|
+
|
|
122
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
123
|
+
|
|
124
|
+
if http_call.successful?
|
|
125
|
+
BillingResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
126
|
+
else
|
|
127
|
+
BillingErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# get shared storage billing for an organization
|
|
132
|
+
#
|
|
133
|
+
# @param org [String]
|
|
134
|
+
#
|
|
135
|
+
# @return BillingResult, BillingErrorResult
|
|
136
|
+
def get_shared_storage_billing_for_an_organization(org, _options)
|
|
137
|
+
auth = nil
|
|
138
|
+
body = nil
|
|
139
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
140
|
+
params = nil
|
|
141
|
+
uri = "#{Gitabu::BASE_URL}/orgs/#{org}/settings/billing/shared-storage"
|
|
142
|
+
|
|
143
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
144
|
+
|
|
145
|
+
if http_call.successful?
|
|
146
|
+
BillingResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
147
|
+
else
|
|
148
|
+
BillingErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
# get github actions billing for a user
|
|
153
|
+
#
|
|
154
|
+
# @param username [String]
|
|
155
|
+
#
|
|
156
|
+
# @return BillingResult, BillingErrorResult
|
|
157
|
+
def get_github_actions_billing_for_a_user(username, _options)
|
|
158
|
+
auth = nil
|
|
159
|
+
body = nil
|
|
160
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
161
|
+
params = nil
|
|
162
|
+
uri = "#{Gitabu::BASE_URL}/users/#{username}/settings/billing/actions"
|
|
163
|
+
|
|
164
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
165
|
+
|
|
166
|
+
if http_call.successful?
|
|
167
|
+
BillingResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
168
|
+
else
|
|
169
|
+
BillingErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
# get github packages billing for a user
|
|
174
|
+
#
|
|
175
|
+
# @param username [String]
|
|
176
|
+
#
|
|
177
|
+
# @return BillingResult, BillingErrorResult
|
|
178
|
+
def get_github_packages_billing_for_a_user(username, _options)
|
|
179
|
+
auth = nil
|
|
180
|
+
body = nil
|
|
181
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
182
|
+
params = nil
|
|
183
|
+
uri = "#{Gitabu::BASE_URL}/users/#{username}/settings/billing/packages"
|
|
184
|
+
|
|
185
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
186
|
+
|
|
187
|
+
if http_call.successful?
|
|
188
|
+
BillingResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
189
|
+
else
|
|
190
|
+
BillingErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
191
|
+
end
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
# get shared storage billing for a user
|
|
195
|
+
#
|
|
196
|
+
# @param username [String]
|
|
197
|
+
#
|
|
198
|
+
# @return BillingResult, BillingErrorResult
|
|
199
|
+
def get_shared_storage_billing_for_a_user(username, _options)
|
|
200
|
+
auth = nil
|
|
201
|
+
body = nil
|
|
202
|
+
headers = { accept: 'application/vnd.github.v3+json' }
|
|
203
|
+
params = nil
|
|
204
|
+
uri = "#{Gitabu::BASE_URL}/users/#{username}/settings/billing/shared-storage"
|
|
205
|
+
|
|
206
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
|
|
207
|
+
|
|
208
|
+
if http_call.successful?
|
|
209
|
+
BillingResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
|
210
|
+
else
|
|
211
|
+
BillingErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
|
212
|
+
end
|
|
213
|
+
end
|
|
214
|
+
end
|
|
215
|
+
end
|
|
216
|
+
end
|
|
217
|
+
end
|