gitabu 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/.rubocop.yml +33 -0
  4. data/CHANGELOG.md +3 -0
  5. data/Gemfile +10 -0
  6. data/Gemfile.lock +65 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +42 -0
  9. data/Rakefile +12 -0
  10. data/gitabu.gemspec +41 -0
  11. data/lib/gitabu/api/v3/actions.rb +3724 -0
  12. data/lib/gitabu/api/v3/activity.rb +835 -0
  13. data/lib/gitabu/api/v3/apps.rb +961 -0
  14. data/lib/gitabu/api/v3/billing.rb +217 -0
  15. data/lib/gitabu/api/v3/branches.rb +1098 -0
  16. data/lib/gitabu/api/v3/checks.rb +384 -0
  17. data/lib/gitabu/api/v3/code_scanning.rb +315 -0
  18. data/lib/gitabu/api/v3/codes_of_conduct.rb +92 -0
  19. data/lib/gitabu/api/v3/codespaces.rb +650 -0
  20. data/lib/gitabu/api/v3/collaborators.rb +341 -0
  21. data/lib/gitabu/api/v3/commits.rb +428 -0
  22. data/lib/gitabu/api/v3/dependabot.rb +419 -0
  23. data/lib/gitabu/api/v3/deploy_keys.rb +152 -0
  24. data/lib/gitabu/api/v3/deployments.rb +356 -0
  25. data/lib/gitabu/api/v3/emojis.rb +67 -0
  26. data/lib/gitabu/api/v3/enterprise_admin.rb +495 -0
  27. data/lib/gitabu/api/v3/gists.rb +552 -0
  28. data/lib/gitabu/api/v3/git.rb +409 -0
  29. data/lib/gitabu/api/v3/gitignore.rb +92 -0
  30. data/lib/gitabu/api/v3/interactions.rb +275 -0
  31. data/lib/gitabu/api/v3/issues.rb +1119 -0
  32. data/lib/gitabu/api/v3/licenses.rb +118 -0
  33. data/lib/gitabu/api/v3/markdown.rb +94 -0
  34. data/lib/gitabu/api/v3/meta.rb +142 -0
  35. data/lib/gitabu/api/v3/metrics.rb +302 -0
  36. data/lib/gitabu/api/v3/migrations.rb +631 -0
  37. data/lib/gitabu/api/v3/orgs.rb +1291 -0
  38. data/lib/gitabu/api/v3/packages.rb +686 -0
  39. data/lib/gitabu/api/v3/pages.rb +282 -0
  40. data/lib/gitabu/api/v3/projects.rb +693 -0
  41. data/lib/gitabu/api/v3/pulls.rb +816 -0
  42. data/lib/gitabu/api/v3/rate_limit.rb +67 -0
  43. data/lib/gitabu/api/v3/reactions.rb +734 -0
  44. data/lib/gitabu/api/v3/releases.rb +411 -0
  45. data/lib/gitabu/api/v3/repos.rb +1136 -0
  46. data/lib/gitabu/api/v3/scim.rb +214 -0
  47. data/lib/gitabu/api/v3/search.rb +217 -0
  48. data/lib/gitabu/api/v3/secret_scanning.rb +201 -0
  49. data/lib/gitabu/api/v3/teams.rb +1963 -0
  50. data/lib/gitabu/api/v3/users.rb +851 -0
  51. data/lib/gitabu/api/v3/webhooks.rb +379 -0
  52. data/lib/gitabu/builder.rb +37 -0
  53. data/lib/gitabu/client.rb +8 -0
  54. data/lib/gitabu/generator.rb +75 -0
  55. data/lib/gitabu/http_client.rb +96 -0
  56. data/lib/gitabu/items.rb +110 -0
  57. data/lib/gitabu/public/api/v3/actions.json +5779 -0
  58. data/lib/gitabu/public/api/v3/activity.json +1248 -0
  59. data/lib/gitabu/public/api/v3/apps.json +1174 -0
  60. data/lib/gitabu/public/api/v3/billing.json +183 -0
  61. data/lib/gitabu/public/api/v3/branches.json +1886 -0
  62. data/lib/gitabu/public/api/v3/checks.json +856 -0
  63. data/lib/gitabu/public/api/v3/code_scanning.json +666 -0
  64. data/lib/gitabu/public/api/v3/codes_of_conduct.json +41 -0
  65. data/lib/gitabu/public/api/v3/codespaces.json +884 -0
  66. data/lib/gitabu/public/api/v3/collaborators.json +464 -0
  67. data/lib/gitabu/public/api/v3/commits.json +830 -0
  68. data/lib/gitabu/public/api/v3/dependabot.json +596 -0
  69. data/lib/gitabu/public/api/v3/deploy_keys.json +195 -0
  70. data/lib/gitabu/public/api/v3/deployments.json +698 -0
  71. data/lib/gitabu/public/api/v3/emojis.json +18 -0
  72. data/lib/gitabu/public/api/v3/enterprise_admin.json +881 -0
  73. data/lib/gitabu/public/api/v3/gists.json +689 -0
  74. data/lib/gitabu/public/api/v3/git.json +735 -0
  75. data/lib/gitabu/public/api/v3/gitignore.json +41 -0
  76. data/lib/gitabu/public/api/v3/interactions.json +265 -0
  77. data/lib/gitabu/public/api/v3/issues.json +2359 -0
  78. data/lib/gitabu/public/api/v3/licenses.json +100 -0
  79. data/lib/gitabu/public/api/v3/markdown.json +59 -0
  80. data/lib/gitabu/public/api/v3/meta.json +69 -0
  81. data/lib/gitabu/public/api/v3/metrics.json +342 -0
  82. data/lib/gitabu/public/api/v3/migrations.json +960 -0
  83. data/lib/gitabu/public/api/v3/orgs.json +1989 -0
  84. data/lib/gitabu/public/api/v3/packages.json +1078 -0
  85. data/lib/gitabu/public/api/v3/pages.json +373 -0
  86. data/lib/gitabu/public/api/v3/projects.json +966 -0
  87. data/lib/gitabu/public/api/v3/pulls.json +1768 -0
  88. data/lib/gitabu/public/api/v3/rate_limit.json +18 -0
  89. data/lib/gitabu/public/api/v3/reactions.json +1425 -0
  90. data/lib/gitabu/public/api/v3/releases.json +753 -0
  91. data/lib/gitabu/public/api/v3/repos.json +2314 -0
  92. data/lib/gitabu/public/api/v3/scim.json +412 -0
  93. data/lib/gitabu/public/api/v3/search.json +408 -0
  94. data/lib/gitabu/public/api/v3/secret_scanning.json +385 -0
  95. data/lib/gitabu/public/api/v3/teams.json +3126 -0
  96. data/lib/gitabu/public/api/v3/users.json +956 -0
  97. data/lib/gitabu/public/api/v3/webhooks.json +667 -0
  98. data/lib/gitabu/run.rb +237 -0
  99. data/lib/gitabu/scraper.rb +86 -0
  100. data/lib/gitabu/templates/template.rb.erb +70 -0
  101. data/lib/gitabu/version.rb +6 -0
  102. data/lib/gitabu.rb +57 -0
  103. data/sig/gitabu.rbs +4 -0
  104. metadata +177 -0
@@ -0,0 +1,118 @@
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 Licenses result
17
+ class LicensesResult
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 LicensesErrorResult
28
+ attr_accessor :result, :message
29
+
30
+ def initialize(result:, message:)
31
+ @result = result
32
+ @message = message
33
+ end
34
+ end
35
+
36
+ # Licenses endpoints.
37
+ class Licenses
38
+ def self.get_all_commonly_used_licenses(options: nil)
39
+ new.get_all_commonly_used_licenses(options)
40
+ end
41
+
42
+ def self.get_a_license(license: nil, options: nil)
43
+ new.get_a_license(license, options)
44
+ end
45
+
46
+ def self.get_the_license_for_a_repository(owner: nil, repo: nil, options: nil)
47
+ new.get_the_license_for_a_repository(owner, repo, options)
48
+ end
49
+
50
+ private
51
+
52
+ # get all commonly used licenses
53
+ #
54
+ # @params options [Hash]
55
+ #
56
+ # @return LicensesResult, LicensesErrorResult
57
+ def get_all_commonly_used_licenses(options)
58
+ auth = nil
59
+ body = nil
60
+ headers = { accept: 'application/vnd.github.v3+json' }
61
+ params = { featured: options[:featured], per_page: options[:per_page], page: options[:page] }
62
+ uri = "#{Gitabu::BASE_URL}/licenses"
63
+
64
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
65
+
66
+ if http_call.successful?
67
+ LicensesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
68
+ else
69
+ LicensesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
70
+ end
71
+ end
72
+
73
+ # get a license
74
+ #
75
+ # @param license [String]
76
+ #
77
+ # @return LicensesResult, LicensesErrorResult
78
+ def get_a_license(license, _options)
79
+ auth = nil
80
+ body = nil
81
+ headers = { accept: 'application/vnd.github.v3+json' }
82
+ params = nil
83
+ uri = "#{Gitabu::BASE_URL}/licenses/#{license}"
84
+
85
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
86
+
87
+ if http_call.successful?
88
+ LicensesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
89
+ else
90
+ LicensesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
91
+ end
92
+ end
93
+
94
+ # get the license for a repository
95
+ #
96
+ # @param owner [String]
97
+ # @param repo [String]
98
+ #
99
+ # @return LicensesResult, LicensesErrorResult
100
+ def get_the_license_for_a_repository(owner, repo, _options)
101
+ auth = nil
102
+ body = nil
103
+ headers = { accept: 'application/vnd.github.v3+json' }
104
+ params = nil
105
+ uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/license"
106
+
107
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
108
+
109
+ if http_call.successful?
110
+ LicensesResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
111
+ else
112
+ LicensesErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
113
+ end
114
+ end
115
+ end
116
+ end
117
+ end
118
+ end
@@ -0,0 +1,94 @@
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 Markdown result
17
+ class MarkdownResult
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 MarkdownErrorResult
28
+ attr_accessor :result, :message
29
+
30
+ def initialize(result:, message:)
31
+ @result = result
32
+ @message = message
33
+ end
34
+ end
35
+
36
+ # Markdown endpoints.
37
+ class Markdown
38
+ def self.render_a_markdown_document(text: nil, mode: nil, context: nil, options: nil)
39
+ new.render_a_markdown_document(text, mode, context, options)
40
+ end
41
+
42
+ def self.render_a_markdown_document_in_raw_mode(options: nil)
43
+ new.render_a_markdown_document_in_raw_mode(options)
44
+ end
45
+
46
+ private
47
+
48
+ # render a markdown document
49
+ #
50
+ # @param text [String] Required. The Markdown text to render in HTML.
51
+ # @param mode [String] The rendering mode. Can be either markdown or gfm.Default: markdown
52
+ # @param context [String] The repository context to use when creating references in gfm mode. For example, setting context to octo-org/octo-repo will change the text #42 into an HTML link to issue 42 in the octo-org/octo-repo repository.
53
+ #
54
+ # @return MarkdownResult, MarkdownErrorResult
55
+ def render_a_markdown_document(text, mode, context, _options)
56
+ auth = nil
57
+ body = { text: text, mode: mode, context: context }
58
+ headers = { accept: 'application/vnd.github.v3+json' }
59
+ params = nil
60
+ uri = "#{Gitabu::BASE_URL}/markdown"
61
+
62
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
63
+
64
+ if http_call.successful?
65
+ MarkdownResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
66
+ else
67
+ MarkdownErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
68
+ end
69
+ end
70
+
71
+ # render a markdown document in raw mode
72
+ #
73
+ # @params options [Hash]
74
+ #
75
+ # @return MarkdownResult, MarkdownErrorResult
76
+ def render_a_markdown_document_in_raw_mode(_options)
77
+ auth = nil
78
+ body = nil
79
+ headers = { accept: 'application/vnd.github.v3+json' }
80
+ params = nil
81
+ uri = "#{Gitabu::BASE_URL}/markdown/raw"
82
+
83
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :post, params: params, uri: uri)
84
+
85
+ if http_call.successful?
86
+ MarkdownResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
87
+ else
88
+ MarkdownErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,142 @@
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 Meta result
17
+ class MetaResult
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 MetaErrorResult
28
+ attr_accessor :result, :message
29
+
30
+ def initialize(result:, message:)
31
+ @result = result
32
+ @message = message
33
+ end
34
+ end
35
+
36
+ # Meta endpoints.
37
+ class Meta
38
+ def self.github_api_root(options: nil)
39
+ new.github_api_root(options)
40
+ end
41
+
42
+ def self.get_github_meta_information(options: nil)
43
+ new.get_github_meta_information(options)
44
+ end
45
+
46
+ def self.get_octocat(options: nil)
47
+ new.get_octocat(options)
48
+ end
49
+
50
+ def self.get_the_zen_of_github(options: nil)
51
+ new.get_the_zen_of_github(options)
52
+ end
53
+
54
+ private
55
+
56
+ # github api root
57
+ #
58
+ # @params options [Hash]
59
+ #
60
+ # @return MetaResult, MetaErrorResult
61
+ def github_api_root(_options)
62
+ auth = nil
63
+ body = nil
64
+ headers = { accept: 'application/vnd.github.v3+json' }
65
+ params = nil
66
+ uri = "#{Gitabu::BASE_URL}/"
67
+
68
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
69
+
70
+ if http_call.successful?
71
+ MetaResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
72
+ else
73
+ MetaErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
74
+ end
75
+ end
76
+
77
+ # get github meta information
78
+ #
79
+ # @params options [Hash]
80
+ #
81
+ # @return MetaResult, MetaErrorResult
82
+ def get_github_meta_information(_options)
83
+ auth = nil
84
+ body = nil
85
+ headers = { accept: 'application/vnd.github.v3+json' }
86
+ params = nil
87
+ uri = "#{Gitabu::BASE_URL}/meta"
88
+
89
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
90
+
91
+ if http_call.successful?
92
+ MetaResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
93
+ else
94
+ MetaErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
95
+ end
96
+ end
97
+
98
+ # get octocat
99
+ #
100
+ # @params options [Hash]
101
+ #
102
+ # @return MetaResult, MetaErrorResult
103
+ def get_octocat(options)
104
+ auth = nil
105
+ body = nil
106
+ headers = { accept: 'application/vnd.github.v3+json' }
107
+ params = { s: options[:s] }
108
+ uri = "#{Gitabu::BASE_URL}/octocat"
109
+
110
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
111
+
112
+ if http_call.successful?
113
+ MetaResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
114
+ else
115
+ MetaErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
116
+ end
117
+ end
118
+
119
+ # get the zen of github
120
+ #
121
+ # @params options [Hash]
122
+ #
123
+ # @return MetaResult, MetaErrorResult
124
+ def get_the_zen_of_github(_options)
125
+ auth = nil
126
+ body = nil
127
+ headers = { accept: 'application/vnd.github.v3+json' }
128
+ params = nil
129
+ uri = "#{Gitabu::BASE_URL}/zen"
130
+
131
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
132
+
133
+ if http_call.successful?
134
+ MetaResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
135
+ else
136
+ MetaErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
137
+ end
138
+ end
139
+ end
140
+ end
141
+ end
142
+ end
@@ -0,0 +1,302 @@
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 Metrics result
17
+ class MetricsResult
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 MetricsErrorResult
28
+ attr_accessor :result, :message
29
+
30
+ def initialize(result:, message:)
31
+ @result = result
32
+ @message = message
33
+ end
34
+ end
35
+
36
+ # Metrics endpoints.
37
+ class Metrics
38
+ def self.get_community_profile_metrics(owner: nil, repo: nil, options: nil)
39
+ new.get_community_profile_metrics(owner, repo, options)
40
+ end
41
+
42
+ def self.get_the_weekly_commit_activity(owner: nil, repo: nil, options: nil)
43
+ new.get_the_weekly_commit_activity(owner, repo, options)
44
+ end
45
+
46
+ def self.get_the_last_year_of_commit_activity(owner: nil, repo: nil, options: nil)
47
+ new.get_the_last_year_of_commit_activity(owner, repo, options)
48
+ end
49
+
50
+ def self.get_all_contributor_commit_activity(owner: nil, repo: nil, options: nil)
51
+ new.get_all_contributor_commit_activity(owner, repo, options)
52
+ end
53
+
54
+ def self.get_the_weekly_commit_count(owner: nil, repo: nil, options: nil)
55
+ new.get_the_weekly_commit_count(owner, repo, options)
56
+ end
57
+
58
+ def self.get_the_hourly_commit_count_for_each_day(owner: nil, repo: nil, options: nil)
59
+ new.get_the_hourly_commit_count_for_each_day(owner, repo, options)
60
+ end
61
+
62
+ def self.get_repository_clones(owner: nil, repo: nil, options: nil)
63
+ new.get_repository_clones(owner, repo, options)
64
+ end
65
+
66
+ def self.get_top_referral_paths(owner: nil, repo: nil, options: nil)
67
+ new.get_top_referral_paths(owner, repo, options)
68
+ end
69
+
70
+ def self.get_top_referral_sources(owner: nil, repo: nil, options: nil)
71
+ new.get_top_referral_sources(owner, repo, options)
72
+ end
73
+
74
+ def self.get_page_views(owner: nil, repo: nil, options: nil)
75
+ new.get_page_views(owner, repo, options)
76
+ end
77
+
78
+ private
79
+
80
+ # get community profile metrics
81
+ #
82
+ # @param owner [String]
83
+ # @param repo [String]
84
+ #
85
+ # @return MetricsResult, MetricsErrorResult
86
+ def get_community_profile_metrics(owner, repo, _options)
87
+ auth = nil
88
+ body = nil
89
+ headers = { accept: 'application/vnd.github.v3+json' }
90
+ params = nil
91
+ uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/community/profile"
92
+
93
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
94
+
95
+ if http_call.successful?
96
+ MetricsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
97
+ else
98
+ MetricsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
99
+ end
100
+ end
101
+
102
+ # get the weekly commit activity
103
+ #
104
+ # @param owner [String]
105
+ # @param repo [String]
106
+ #
107
+ # @return MetricsResult, MetricsErrorResult
108
+ def get_the_weekly_commit_activity(owner, repo, _options)
109
+ auth = nil
110
+ body = nil
111
+ headers = { accept: 'application/vnd.github.v3+json' }
112
+ params = nil
113
+ uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/stats/code_frequency"
114
+
115
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
116
+
117
+ if http_call.successful?
118
+ MetricsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
119
+ else
120
+ MetricsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
121
+ end
122
+ end
123
+
124
+ # get the last year of commit activity
125
+ #
126
+ # @param owner [String]
127
+ # @param repo [String]
128
+ #
129
+ # @return MetricsResult, MetricsErrorResult
130
+ def get_the_last_year_of_commit_activity(owner, repo, _options)
131
+ auth = nil
132
+ body = nil
133
+ headers = { accept: 'application/vnd.github.v3+json' }
134
+ params = nil
135
+ uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/stats/commit_activity"
136
+
137
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
138
+
139
+ if http_call.successful?
140
+ MetricsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
141
+ else
142
+ MetricsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
143
+ end
144
+ end
145
+
146
+ # get all contributor commit activity
147
+ #
148
+ # @param owner [String]
149
+ # @param repo [String]
150
+ #
151
+ # @return MetricsResult, MetricsErrorResult
152
+ def get_all_contributor_commit_activity(owner, repo, _options)
153
+ auth = nil
154
+ body = nil
155
+ headers = { accept: 'application/vnd.github.v3+json' }
156
+ params = nil
157
+ uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/stats/contributors"
158
+
159
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
160
+
161
+ if http_call.successful?
162
+ MetricsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
163
+ else
164
+ MetricsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
165
+ end
166
+ end
167
+
168
+ # get the weekly commit count
169
+ #
170
+ # @param owner [String]
171
+ # @param repo [String]
172
+ #
173
+ # @return MetricsResult, MetricsErrorResult
174
+ def get_the_weekly_commit_count(owner, repo, _options)
175
+ auth = nil
176
+ body = nil
177
+ headers = { accept: 'application/vnd.github.v3+json' }
178
+ params = nil
179
+ uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/stats/participation"
180
+
181
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
182
+
183
+ if http_call.successful?
184
+ MetricsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
185
+ else
186
+ MetricsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
187
+ end
188
+ end
189
+
190
+ # get the hourly commit count for each day
191
+ #
192
+ # @param owner [String]
193
+ # @param repo [String]
194
+ #
195
+ # @return MetricsResult, MetricsErrorResult
196
+ def get_the_hourly_commit_count_for_each_day(owner, repo, _options)
197
+ auth = nil
198
+ body = nil
199
+ headers = { accept: 'application/vnd.github.v3+json' }
200
+ params = nil
201
+ uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/stats/punch_card"
202
+
203
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
204
+
205
+ if http_call.successful?
206
+ MetricsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
207
+ else
208
+ MetricsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
209
+ end
210
+ end
211
+
212
+ # get repository clones
213
+ #
214
+ # @param owner [String]
215
+ # @param repo [String]
216
+ #
217
+ # @return MetricsResult, MetricsErrorResult
218
+ def get_repository_clones(owner, repo, options)
219
+ auth = nil
220
+ body = nil
221
+ headers = { accept: 'application/vnd.github.v3+json' }
222
+ params = { per: options[:per] }
223
+ uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/traffic/clones"
224
+
225
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
226
+
227
+ if http_call.successful?
228
+ MetricsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
229
+ else
230
+ MetricsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
231
+ end
232
+ end
233
+
234
+ # get top referral paths
235
+ #
236
+ # @param owner [String]
237
+ # @param repo [String]
238
+ #
239
+ # @return MetricsResult, MetricsErrorResult
240
+ def get_top_referral_paths(owner, repo, _options)
241
+ auth = nil
242
+ body = nil
243
+ headers = { accept: 'application/vnd.github.v3+json' }
244
+ params = nil
245
+ uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/traffic/popular/paths"
246
+
247
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
248
+
249
+ if http_call.successful?
250
+ MetricsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
251
+ else
252
+ MetricsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
253
+ end
254
+ end
255
+
256
+ # get top referral sources
257
+ #
258
+ # @param owner [String]
259
+ # @param repo [String]
260
+ #
261
+ # @return MetricsResult, MetricsErrorResult
262
+ def get_top_referral_sources(owner, repo, _options)
263
+ auth = nil
264
+ body = nil
265
+ headers = { accept: 'application/vnd.github.v3+json' }
266
+ params = nil
267
+ uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/traffic/popular/referrers"
268
+
269
+ http_call = Gitabu::HttpClient.call(auth: auth, body: body, headers: headers, method: :get, params: params, uri: uri)
270
+
271
+ if http_call.successful?
272
+ MetricsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
273
+ else
274
+ MetricsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
275
+ end
276
+ end
277
+
278
+ # get page views
279
+ #
280
+ # @param owner [String]
281
+ # @param repo [String]
282
+ #
283
+ # @return MetricsResult, MetricsErrorResult
284
+ def get_page_views(owner, repo, options)
285
+ auth = nil
286
+ body = nil
287
+ headers = { accept: 'application/vnd.github.v3+json' }
288
+ params = { per: options[:per] }
289
+ uri = "#{Gitabu::BASE_URL}/repos/#{owner}/#{repo}/traffic/views"
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
+ MetricsResult.new(result: http_call, message: "Successful call to endpoint. #{http_call.result.message}")
295
+ else
296
+ MetricsErrorResult.new(result: http_call, message: "Failure while calling endpoint. #{http_call.result.message}")
297
+ end
298
+ end
299
+ end
300
+ end
301
+ end
302
+ end