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
data/lib/gitabu/run.rb
ADDED
@@ -0,0 +1,237 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "generator"
|
4
|
+
|
5
|
+
# Ruby gem that helps you work with Github API.
|
6
|
+
module Gitabu
|
7
|
+
# Run class to introduce generated classes.
|
8
|
+
class Run
|
9
|
+
def self.save
|
10
|
+
new.save
|
11
|
+
end
|
12
|
+
|
13
|
+
def initialize; end
|
14
|
+
|
15
|
+
def save
|
16
|
+
hash.each do |api_module|
|
17
|
+
link = api_module[:link]
|
18
|
+
name = api_module[:name]
|
19
|
+
version = api_module[:version]
|
20
|
+
|
21
|
+
Gitabu::Generator.generate(link: link, name: name, version: version)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def hash
|
28
|
+
[
|
29
|
+
{
|
30
|
+
link: 'https://docs.github.com/en/rest/reference/actions',
|
31
|
+
name: 'actions',
|
32
|
+
version: 3
|
33
|
+
},
|
34
|
+
{
|
35
|
+
link: 'https://docs.github.com/en/rest/reference/activity',
|
36
|
+
name: 'activity',
|
37
|
+
version: 3
|
38
|
+
},
|
39
|
+
{
|
40
|
+
link: 'https://docs.github.com/en/rest/reference/apps',
|
41
|
+
name: 'apps',
|
42
|
+
version: 3
|
43
|
+
},
|
44
|
+
{
|
45
|
+
link: 'https://docs.github.com/en/rest/reference/billing',
|
46
|
+
name: 'billing',
|
47
|
+
version: 3
|
48
|
+
},
|
49
|
+
{
|
50
|
+
link: 'https://docs.github.com/en/rest/reference/branches',
|
51
|
+
name: 'branches',
|
52
|
+
version: 3
|
53
|
+
},
|
54
|
+
{
|
55
|
+
link: 'https://docs.github.com/en/rest/reference/checks',
|
56
|
+
name: 'checks',
|
57
|
+
version: 3
|
58
|
+
},
|
59
|
+
{
|
60
|
+
link: 'https://docs.github.com/en/rest/reference/codes-of-conduct',
|
61
|
+
name: 'codes_of_conduct',
|
62
|
+
version: 3
|
63
|
+
},
|
64
|
+
{
|
65
|
+
link: 'https://docs.github.com/en/rest/reference/code-scanning',
|
66
|
+
name: 'code_scanning',
|
67
|
+
version: 3
|
68
|
+
},
|
69
|
+
{
|
70
|
+
link: 'https://docs.github.com/en/rest/reference/codespaces',
|
71
|
+
name: 'codespaces',
|
72
|
+
version: 3
|
73
|
+
},
|
74
|
+
{
|
75
|
+
link: 'https://docs.github.com/en/rest/reference/collaborators',
|
76
|
+
name: 'collaborators',
|
77
|
+
version: 3
|
78
|
+
},
|
79
|
+
{
|
80
|
+
link: 'https://docs.github.com/en/rest/reference/commits',
|
81
|
+
name: 'commits',
|
82
|
+
version: 3
|
83
|
+
},
|
84
|
+
{
|
85
|
+
link: 'https://docs.github.com/en/rest/reference/dependabot',
|
86
|
+
name: 'dependabot',
|
87
|
+
version: 3
|
88
|
+
},
|
89
|
+
{
|
90
|
+
link: 'https://docs.github.com/en/rest/reference/deploy_keys',
|
91
|
+
name: 'deploy_keys',
|
92
|
+
version: 3
|
93
|
+
},
|
94
|
+
{
|
95
|
+
link: 'https://docs.github.com/en/rest/reference/deployments',
|
96
|
+
name: 'deployments',
|
97
|
+
version: 3
|
98
|
+
},
|
99
|
+
{
|
100
|
+
link: 'https://docs.github.com/en/rest/reference/emojis',
|
101
|
+
name: 'emojis',
|
102
|
+
version: 3
|
103
|
+
},
|
104
|
+
{
|
105
|
+
link: 'https://docs.github.com/en/rest/reference/enterprise-admin',
|
106
|
+
name: 'enterprise_admin',
|
107
|
+
version: 3
|
108
|
+
},
|
109
|
+
{
|
110
|
+
link: 'https://docs.github.com/en/rest/reference/gists',
|
111
|
+
name: 'gists',
|
112
|
+
version: 3
|
113
|
+
},
|
114
|
+
{
|
115
|
+
link: 'https://docs.github.com/en/rest/reference/git',
|
116
|
+
name: 'git',
|
117
|
+
version: 3
|
118
|
+
},
|
119
|
+
{
|
120
|
+
link: 'https://docs.github.com/en/rest/reference/gitignore',
|
121
|
+
name: 'gitignore',
|
122
|
+
version: 3
|
123
|
+
},
|
124
|
+
{
|
125
|
+
link: 'https://docs.github.com/en/rest/reference/interactions',
|
126
|
+
name: 'interactions',
|
127
|
+
version: 3
|
128
|
+
},
|
129
|
+
{
|
130
|
+
link: 'https://docs.github.com/en/rest/reference/issues',
|
131
|
+
name: 'issues',
|
132
|
+
version: 3
|
133
|
+
},
|
134
|
+
{
|
135
|
+
link: 'https://docs.github.com/en/rest/reference/licenses',
|
136
|
+
name: 'licenses',
|
137
|
+
version: 3
|
138
|
+
},
|
139
|
+
{
|
140
|
+
link: 'https://docs.github.com/en/rest/reference/markdown',
|
141
|
+
name: 'markdown',
|
142
|
+
version: 3
|
143
|
+
},
|
144
|
+
{
|
145
|
+
link: 'https://docs.github.com/en/rest/reference/meta',
|
146
|
+
name: 'meta',
|
147
|
+
version: 3
|
148
|
+
},
|
149
|
+
{
|
150
|
+
link: 'https://docs.github.com/en/rest/reference/metrics',
|
151
|
+
name: 'metrics',
|
152
|
+
version: 3
|
153
|
+
},
|
154
|
+
{
|
155
|
+
link: 'https://docs.github.com/en/rest/reference/migrations',
|
156
|
+
name: 'migrations',
|
157
|
+
version: 3
|
158
|
+
},
|
159
|
+
{
|
160
|
+
link: 'https://docs.github.com/en/rest/reference/orgs',
|
161
|
+
name: 'orgs',
|
162
|
+
version: 3
|
163
|
+
},
|
164
|
+
{
|
165
|
+
link: 'https://docs.github.com/en/rest/reference/packages',
|
166
|
+
name: 'packages',
|
167
|
+
version: 3
|
168
|
+
},
|
169
|
+
{
|
170
|
+
link: 'https://docs.github.com/en/rest/reference/pages',
|
171
|
+
name: 'pages',
|
172
|
+
version: 3
|
173
|
+
},
|
174
|
+
{
|
175
|
+
link: 'https://docs.github.com/en/rest/reference/projects',
|
176
|
+
name: 'projects',
|
177
|
+
version: 3
|
178
|
+
},
|
179
|
+
{
|
180
|
+
link: 'https://docs.github.com/en/rest/reference/pulls',
|
181
|
+
name: 'pulls',
|
182
|
+
version: 3
|
183
|
+
},
|
184
|
+
{
|
185
|
+
link: 'https://docs.github.com/en/rest/reference/rate-limit',
|
186
|
+
name: 'rate_limit',
|
187
|
+
version: 3
|
188
|
+
},
|
189
|
+
{
|
190
|
+
link: 'https://docs.github.com/en/rest/reference/reactions',
|
191
|
+
name: 'reactions',
|
192
|
+
version: 3
|
193
|
+
},
|
194
|
+
{
|
195
|
+
link: 'https://docs.github.com/en/rest/reference/releases',
|
196
|
+
name: 'releases',
|
197
|
+
version: 3
|
198
|
+
},
|
199
|
+
{
|
200
|
+
link: 'https://docs.github.com/en/rest/reference/repos',
|
201
|
+
name: 'repos',
|
202
|
+
version: 3
|
203
|
+
},
|
204
|
+
{
|
205
|
+
link: 'https://docs.github.com/en/rest/reference/scim',
|
206
|
+
name: 'scim',
|
207
|
+
version: 3
|
208
|
+
},
|
209
|
+
{
|
210
|
+
link: 'https://docs.github.com/en/rest/reference/search',
|
211
|
+
name: 'search',
|
212
|
+
version: 3
|
213
|
+
},
|
214
|
+
{
|
215
|
+
link: 'https://docs.github.com/en/rest/reference/secret-scanning',
|
216
|
+
name: 'secret_scanning',
|
217
|
+
version: 3
|
218
|
+
},
|
219
|
+
{
|
220
|
+
link: 'https://docs.github.com/en/rest/reference/teams',
|
221
|
+
name: 'teams',
|
222
|
+
version: 3
|
223
|
+
},
|
224
|
+
{
|
225
|
+
link: 'https://docs.github.com/en/rest/reference/users',
|
226
|
+
name: 'users',
|
227
|
+
version: 3
|
228
|
+
},
|
229
|
+
{
|
230
|
+
link: 'https://docs.github.com/en/rest/reference/webhooks',
|
231
|
+
name: 'webhooks',
|
232
|
+
version: 3
|
233
|
+
}
|
234
|
+
]
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "fileutils"
|
4
|
+
require "json"
|
5
|
+
require "nokogiri"
|
6
|
+
require "ostruct"
|
7
|
+
|
8
|
+
require_relative "http_client"
|
9
|
+
|
10
|
+
# Ruby gem that helps you work with Github API.
|
11
|
+
module Gitabu
|
12
|
+
# Scraper that gets link to Github API and returns endpoints as variables.
|
13
|
+
class Scraper
|
14
|
+
attr_accessor :link, :name, :version
|
15
|
+
|
16
|
+
def self.scrape(link:, name:, version:)
|
17
|
+
new(link, name, version).scrape
|
18
|
+
end
|
19
|
+
|
20
|
+
def initialize(link, name, version)
|
21
|
+
@link = link
|
22
|
+
@name = name
|
23
|
+
@version = version
|
24
|
+
end
|
25
|
+
|
26
|
+
def scrape
|
27
|
+
hash = { result: list }
|
28
|
+
|
29
|
+
FileUtils.mkdir_p("lib/gitabu/public/api/v#{version}")
|
30
|
+
FileUtils.touch("lib/gitabu/public/api/v#{version}/#{name}.json")
|
31
|
+
File.open("lib/gitabu/public/api/v#{version}/#{name}.json", "w") do |f|
|
32
|
+
f.write(JSON.pretty_generate(hash))
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def list
|
39
|
+
page = download_link_page
|
40
|
+
document = parse(page)
|
41
|
+
|
42
|
+
table_list(document)
|
43
|
+
end
|
44
|
+
|
45
|
+
def download_link_page
|
46
|
+
Gitabu::HttpClient.call(method: :get, uri: link, expect: :html).result
|
47
|
+
end
|
48
|
+
|
49
|
+
def parse(page)
|
50
|
+
Nokogiri::HTML(page)
|
51
|
+
end
|
52
|
+
|
53
|
+
def table_list(document)
|
54
|
+
list = []
|
55
|
+
namespace = "/html/body/div/div/div[2]/main/div/div[4]/div"
|
56
|
+
namespace_count = document.xpath(namespace).size
|
57
|
+
namespace_count.times do |namespace_index|
|
58
|
+
block_count = document.xpath("#{namespace}[#{namespace_index + 1}]/div").size
|
59
|
+
block_count.times do |block_index|
|
60
|
+
next if block_index.zero?
|
61
|
+
|
62
|
+
table = {}
|
63
|
+
table["namespace_description"] = document.xpath("#{namespace}[#{namespace_index + 1}]/div[#{block_index + 1}]/h3/text()")
|
64
|
+
table["method"] = document.xpath("#{namespace}[#{namespace_index + 1}]/div[#{block_index + 1}]/div/pre/code/span/text()")
|
65
|
+
endpoint = document.xpath("#{namespace}[#{namespace_index + 1}]/div[#{block_index + 1}]/div/pre/code")[0]&.text
|
66
|
+
table["endpoint"] = endpoint.gsub("#{table["method"]} ", "")
|
67
|
+
row_count = document.xpath("#{namespace}[#{namespace_index + 1}]/div[#{block_index + 1}]/table[1]/tbody/tr").size
|
68
|
+
row_count.times do |row_index|
|
69
|
+
col = document.xpath("#{namespace}[#{namespace_index + 1}]/div[#{block_index + 1}]/table[1]/tbody/tr[#{row_index + 1}]/td")
|
70
|
+
row_name = "field_#{row_index}"
|
71
|
+
table[row_name] = fill_column(col)
|
72
|
+
end
|
73
|
+
list << table
|
74
|
+
end
|
75
|
+
end
|
76
|
+
list
|
77
|
+
end
|
78
|
+
|
79
|
+
def fill_column(col)
|
80
|
+
{
|
81
|
+
field_type: col[2]&.content,
|
82
|
+
fields: { name: col[0]&.content, type: col[1]&.content, in: col[2]&.content, description: col[3]&.content }
|
83
|
+
}
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,70 @@
|
|
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 <%= @version %>
|
15
|
+
module V<%= @version %>
|
16
|
+
# Class to display <%= @class_name %> result
|
17
|
+
class <%= @class_name %>Result
|
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 <%= @class_name %>ErrorResult
|
28
|
+
attr_accessor :result, :message
|
29
|
+
|
30
|
+
def initialize(result:, message:)
|
31
|
+
@result = result
|
32
|
+
@message = message
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# <%= @class_name %> endpoints.
|
37
|
+
class <%= @class_name %>
|
38
|
+
<% for item in @items %>
|
39
|
+
def self.<%= item['method_name'] %><%= item['params_key_value'] %>
|
40
|
+
new.<%= item['method_name'] %><%= item['path_params_flat'] %>
|
41
|
+
end
|
42
|
+
<% end %>
|
43
|
+
|
44
|
+
private
|
45
|
+
<% for item in @items %>
|
46
|
+
# <%= item['description'] %>
|
47
|
+
#
|
48
|
+
<%= item['documentation'] %>
|
49
|
+
#
|
50
|
+
# @return <%= @class_name %>Result, <%= @class_name %>ErrorResult
|
51
|
+
def <%= item['method_name'] %><%= item['path_params_flat'] %>
|
52
|
+
auth = <%= item['auth'] %>
|
53
|
+
body = <%= item['body'] %>
|
54
|
+
headers = <%= item['headers'] %>
|
55
|
+
params = <%= item['params'] %>
|
56
|
+
uri = "#{Gitabu::BASE_URL}<%= item['endpoint'] %>"
|
57
|
+
|
58
|
+
http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :<%= item['http_method'] %>, params: params, uri: uri)
|
59
|
+
|
60
|
+
if http_call.successful?
|
61
|
+
<%= @class_name %>Result.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
|
62
|
+
else
|
63
|
+
<%= @class_name %>ErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
|
64
|
+
end
|
65
|
+
end
|
66
|
+
<% end %>
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
data/lib/gitabu.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ostruct"
|
4
|
+
|
5
|
+
require_relative "gitabu/builder"
|
6
|
+
require_relative "gitabu/client"
|
7
|
+
require_relative "gitabu/generator"
|
8
|
+
require_relative "gitabu/http_client"
|
9
|
+
require_relative "gitabu/items"
|
10
|
+
require_relative "gitabu/run"
|
11
|
+
require_relative "gitabu/scraper"
|
12
|
+
require_relative "gitabu/version"
|
13
|
+
|
14
|
+
# Ruby gem that helps you work with Github API.
|
15
|
+
module Gitabu
|
16
|
+
class Error < StandardError; end
|
17
|
+
|
18
|
+
BASE_URL = "https://api.github.com/"
|
19
|
+
|
20
|
+
def self.configuration
|
21
|
+
@configuration ||= OpenStruct.new(
|
22
|
+
version: nil
|
23
|
+
)
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.configure
|
27
|
+
yield(configuration)
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.to_ostruct(input)
|
31
|
+
result = {}
|
32
|
+
|
33
|
+
if input.is_a?(Hash)
|
34
|
+
result["result_type"] = input.class
|
35
|
+
result["result_keys"] = input.keys
|
36
|
+
|
37
|
+
input.each do |key, value|
|
38
|
+
result[key] = hash_or_array(value) ? to_ostruct(value) : OpenStruct.new(value: value, result_type: value.class)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
if input.is_a?(Array)
|
43
|
+
result["result_type"] = input.class
|
44
|
+
result["result_array_size"] = input.size
|
45
|
+
|
46
|
+
input.each.with_index do |value, index|
|
47
|
+
result["value_at_#{index}"] = hash_or_array(value) ? to_ostruct(value) : OpenStruct.new(value: value, result_type: value.class)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
OpenStruct.new(result)
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.hash_or_array(val)
|
55
|
+
val.is_a?(Hash) || val.is_a?(Array)
|
56
|
+
end
|
57
|
+
end
|
data/sig/gitabu.rbs
ADDED
metadata
ADDED
@@ -0,0 +1,177 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gitabu
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- sylvance_theone
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-04-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: nokogiri
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: pry
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Ruby gem that helps you work with Github API.
|
42
|
+
email:
|
43
|
+
- 9350722+Sylvance@users.noreply.github.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".rspec"
|
49
|
+
- ".rubocop.yml"
|
50
|
+
- CHANGELOG.md
|
51
|
+
- Gemfile
|
52
|
+
- Gemfile.lock
|
53
|
+
- LICENSE.txt
|
54
|
+
- README.md
|
55
|
+
- Rakefile
|
56
|
+
- gitabu.gemspec
|
57
|
+
- lib/gitabu.rb
|
58
|
+
- lib/gitabu/api/v3/actions.rb
|
59
|
+
- lib/gitabu/api/v3/activity.rb
|
60
|
+
- lib/gitabu/api/v3/apps.rb
|
61
|
+
- lib/gitabu/api/v3/billing.rb
|
62
|
+
- lib/gitabu/api/v3/branches.rb
|
63
|
+
- lib/gitabu/api/v3/checks.rb
|
64
|
+
- lib/gitabu/api/v3/code_scanning.rb
|
65
|
+
- lib/gitabu/api/v3/codes_of_conduct.rb
|
66
|
+
- lib/gitabu/api/v3/codespaces.rb
|
67
|
+
- lib/gitabu/api/v3/collaborators.rb
|
68
|
+
- lib/gitabu/api/v3/commits.rb
|
69
|
+
- lib/gitabu/api/v3/dependabot.rb
|
70
|
+
- lib/gitabu/api/v3/deploy_keys.rb
|
71
|
+
- lib/gitabu/api/v3/deployments.rb
|
72
|
+
- lib/gitabu/api/v3/emojis.rb
|
73
|
+
- lib/gitabu/api/v3/enterprise_admin.rb
|
74
|
+
- lib/gitabu/api/v3/gists.rb
|
75
|
+
- lib/gitabu/api/v3/git.rb
|
76
|
+
- lib/gitabu/api/v3/gitignore.rb
|
77
|
+
- lib/gitabu/api/v3/interactions.rb
|
78
|
+
- lib/gitabu/api/v3/issues.rb
|
79
|
+
- lib/gitabu/api/v3/licenses.rb
|
80
|
+
- lib/gitabu/api/v3/markdown.rb
|
81
|
+
- lib/gitabu/api/v3/meta.rb
|
82
|
+
- lib/gitabu/api/v3/metrics.rb
|
83
|
+
- lib/gitabu/api/v3/migrations.rb
|
84
|
+
- lib/gitabu/api/v3/orgs.rb
|
85
|
+
- lib/gitabu/api/v3/packages.rb
|
86
|
+
- lib/gitabu/api/v3/pages.rb
|
87
|
+
- lib/gitabu/api/v3/projects.rb
|
88
|
+
- lib/gitabu/api/v3/pulls.rb
|
89
|
+
- lib/gitabu/api/v3/rate_limit.rb
|
90
|
+
- lib/gitabu/api/v3/reactions.rb
|
91
|
+
- lib/gitabu/api/v3/releases.rb
|
92
|
+
- lib/gitabu/api/v3/repos.rb
|
93
|
+
- lib/gitabu/api/v3/scim.rb
|
94
|
+
- lib/gitabu/api/v3/search.rb
|
95
|
+
- lib/gitabu/api/v3/secret_scanning.rb
|
96
|
+
- lib/gitabu/api/v3/teams.rb
|
97
|
+
- lib/gitabu/api/v3/users.rb
|
98
|
+
- lib/gitabu/api/v3/webhooks.rb
|
99
|
+
- lib/gitabu/builder.rb
|
100
|
+
- lib/gitabu/client.rb
|
101
|
+
- lib/gitabu/generator.rb
|
102
|
+
- lib/gitabu/http_client.rb
|
103
|
+
- lib/gitabu/items.rb
|
104
|
+
- lib/gitabu/public/api/v3/actions.json
|
105
|
+
- lib/gitabu/public/api/v3/activity.json
|
106
|
+
- lib/gitabu/public/api/v3/apps.json
|
107
|
+
- lib/gitabu/public/api/v3/billing.json
|
108
|
+
- lib/gitabu/public/api/v3/branches.json
|
109
|
+
- lib/gitabu/public/api/v3/checks.json
|
110
|
+
- lib/gitabu/public/api/v3/code_scanning.json
|
111
|
+
- lib/gitabu/public/api/v3/codes_of_conduct.json
|
112
|
+
- lib/gitabu/public/api/v3/codespaces.json
|
113
|
+
- lib/gitabu/public/api/v3/collaborators.json
|
114
|
+
- lib/gitabu/public/api/v3/commits.json
|
115
|
+
- lib/gitabu/public/api/v3/dependabot.json
|
116
|
+
- lib/gitabu/public/api/v3/deploy_keys.json
|
117
|
+
- lib/gitabu/public/api/v3/deployments.json
|
118
|
+
- lib/gitabu/public/api/v3/emojis.json
|
119
|
+
- lib/gitabu/public/api/v3/enterprise_admin.json
|
120
|
+
- lib/gitabu/public/api/v3/gists.json
|
121
|
+
- lib/gitabu/public/api/v3/git.json
|
122
|
+
- lib/gitabu/public/api/v3/gitignore.json
|
123
|
+
- lib/gitabu/public/api/v3/interactions.json
|
124
|
+
- lib/gitabu/public/api/v3/issues.json
|
125
|
+
- lib/gitabu/public/api/v3/licenses.json
|
126
|
+
- lib/gitabu/public/api/v3/markdown.json
|
127
|
+
- lib/gitabu/public/api/v3/meta.json
|
128
|
+
- lib/gitabu/public/api/v3/metrics.json
|
129
|
+
- lib/gitabu/public/api/v3/migrations.json
|
130
|
+
- lib/gitabu/public/api/v3/orgs.json
|
131
|
+
- lib/gitabu/public/api/v3/packages.json
|
132
|
+
- lib/gitabu/public/api/v3/pages.json
|
133
|
+
- lib/gitabu/public/api/v3/projects.json
|
134
|
+
- lib/gitabu/public/api/v3/pulls.json
|
135
|
+
- lib/gitabu/public/api/v3/rate_limit.json
|
136
|
+
- lib/gitabu/public/api/v3/reactions.json
|
137
|
+
- lib/gitabu/public/api/v3/releases.json
|
138
|
+
- lib/gitabu/public/api/v3/repos.json
|
139
|
+
- lib/gitabu/public/api/v3/scim.json
|
140
|
+
- lib/gitabu/public/api/v3/search.json
|
141
|
+
- lib/gitabu/public/api/v3/secret_scanning.json
|
142
|
+
- lib/gitabu/public/api/v3/teams.json
|
143
|
+
- lib/gitabu/public/api/v3/users.json
|
144
|
+
- lib/gitabu/public/api/v3/webhooks.json
|
145
|
+
- lib/gitabu/run.rb
|
146
|
+
- lib/gitabu/scraper.rb
|
147
|
+
- lib/gitabu/templates/template.rb.erb
|
148
|
+
- lib/gitabu/version.rb
|
149
|
+
- sig/gitabu.rbs
|
150
|
+
homepage: https://github.com/Sylvance/gitabu
|
151
|
+
licenses:
|
152
|
+
- MIT
|
153
|
+
metadata:
|
154
|
+
allowed_push_host: https://rubygems.org
|
155
|
+
homepage_uri: https://github.com/Sylvance/gitabu
|
156
|
+
source_code_uri: https://github.com/Sylvance/gitabu
|
157
|
+
changelog_uri: https://github.com/Sylvance/gitabu/blob/main/CHANGELOG.md
|
158
|
+
post_install_message:
|
159
|
+
rdoc_options: []
|
160
|
+
require_paths:
|
161
|
+
- lib
|
162
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 2.6.0
|
167
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
168
|
+
requirements:
|
169
|
+
- - ">="
|
170
|
+
- !ruby/object:Gem::Version
|
171
|
+
version: '0'
|
172
|
+
requirements: []
|
173
|
+
rubygems_version: 3.2.22
|
174
|
+
signing_key:
|
175
|
+
specification_version: 4
|
176
|
+
summary: Ruby gem that helps you work with Github API.
|
177
|
+
test_files: []
|