ghub 0.0.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
- checksums.yaml.gz.sig +0 -0
- data/LICENSE.adoc +134 -0
- data/README.adoc +198 -0
- data/ghub.gemspec +37 -0
- data/lib/ghub/api/client.rb +49 -0
- data/lib/ghub/api/page.rb +59 -0
- data/lib/ghub/client.rb +34 -0
- data/lib/ghub/configuration/content.rb +8 -0
- data/lib/ghub/configuration/loader.rb +30 -0
- data/lib/ghub/container.rb +15 -0
- data/lib/ghub/endpoints/branches/protection/actions/show.rb +31 -0
- data/lib/ghub/endpoints/branches/protection/actions/update.rb +38 -0
- data/lib/ghub/endpoints/branches/protection/container.rb +35 -0
- data/lib/ghub/endpoints/branches/protection/import.rb +13 -0
- data/lib/ghub/endpoints/branches/protection/models/show.rb +48 -0
- data/lib/ghub/endpoints/branches/protection/requests/update.rb +52 -0
- data/lib/ghub/endpoints/branches/protection/responses/show.rb +27 -0
- data/lib/ghub/endpoints/branches/protection/root.rb +26 -0
- data/lib/ghub/endpoints/branches/signature/container.rb +26 -0
- data/lib/ghub/endpoints/branches/signature/import.rb +13 -0
- data/lib/ghub/endpoints/branches/signature/root.rb +48 -0
- data/lib/ghub/endpoints/container.rb +19 -0
- data/lib/ghub/endpoints/import.rb +9 -0
- data/lib/ghub/endpoints/organizations/members/actions/index.rb +32 -0
- data/lib/ghub/endpoints/organizations/members/container.rb +30 -0
- data/lib/ghub/endpoints/organizations/members/import.rb +13 -0
- data/lib/ghub/endpoints/organizations/members/responses/index.rb +14 -0
- data/lib/ghub/endpoints/organizations/members/root.rb +16 -0
- data/lib/ghub/endpoints/pulls/actions/index.rb +28 -0
- data/lib/ghub/endpoints/pulls/actions/show.rb +26 -0
- data/lib/ghub/endpoints/pulls/container.rb +30 -0
- data/lib/ghub/endpoints/pulls/import.rb +11 -0
- data/lib/ghub/endpoints/pulls/models/show.rb +81 -0
- data/lib/ghub/endpoints/pulls/responses/index.rb +12 -0
- data/lib/ghub/endpoints/pulls/responses/show.rb +62 -0
- data/lib/ghub/endpoints/pulls/root.rb +16 -0
- data/lib/ghub/endpoints/repositories/actions/create.rb +37 -0
- data/lib/ghub/endpoints/repositories/actions/index.rb +36 -0
- data/lib/ghub/endpoints/repositories/actions/patch.rb +37 -0
- data/lib/ghub/endpoints/repositories/actions/show.rb +32 -0
- data/lib/ghub/endpoints/repositories/container.rb +39 -0
- data/lib/ghub/endpoints/repositories/import.rb +11 -0
- data/lib/ghub/endpoints/repositories/path.rb +54 -0
- data/lib/ghub/endpoints/repositories/requests/create.rb +32 -0
- data/lib/ghub/endpoints/repositories/requests/patch.rb +38 -0
- data/lib/ghub/endpoints/repositories/responses/index.rb +12 -0
- data/lib/ghub/endpoints/repositories/responses/show.rb +97 -0
- data/lib/ghub/endpoints/repositories/root.rb +28 -0
- data/lib/ghub/endpoints/users/actions/index.rb +28 -0
- data/lib/ghub/endpoints/users/actions/show.rb +24 -0
- data/lib/ghub/endpoints/users/container.rb +31 -0
- data/lib/ghub/endpoints/users/import.rb +11 -0
- data/lib/ghub/endpoints/users/models/index.rb +39 -0
- data/lib/ghub/endpoints/users/models/show.rb +53 -0
- data/lib/ghub/endpoints/users/responses/index.rb +33 -0
- data/lib/ghub/endpoints/users/responses/show.rb +45 -0
- data/lib/ghub/endpoints/users/root.rb +16 -0
- data/lib/ghub/import.rb +7 -0
- data/lib/ghub/models/application.rb +34 -0
- data/lib/ghub/models/boolean_link.rb +13 -0
- data/lib/ghub/models/branch.rb +20 -0
- data/lib/ghub/models/check.rb +17 -0
- data/lib/ghub/models/dismissal_restriction.rb +31 -0
- data/lib/ghub/models/label.rb +22 -0
- data/lib/ghub/models/license.rb +20 -0
- data/lib/ghub/models/link.rb +13 -0
- data/lib/ghub/models/links.rb +28 -0
- data/lib/ghub/models/owner.rb +27 -0
- data/lib/ghub/models/permissions/branch.rb +21 -0
- data/lib/ghub/models/permissions/repository.rb +22 -0
- data/lib/ghub/models/repository.rb +111 -0
- data/lib/ghub/models/restriction.rb +32 -0
- data/lib/ghub/models/review.rb +28 -0
- data/lib/ghub/models/status_check.rb +25 -0
- data/lib/ghub/models/team.rb +27 -0
- data/lib/ghub/models/user.rb +33 -0
- data/lib/ghub/responses/application.rb +42 -0
- data/lib/ghub/responses/boolean_link.rb +11 -0
- data/lib/ghub/responses/branch.rb +14 -0
- data/lib/ghub/responses/dismissal_restriction.rb +15 -0
- data/lib/ghub/responses/label.rb +16 -0
- data/lib/ghub/responses/license.rb +14 -0
- data/lib/ghub/responses/link.rb +8 -0
- data/lib/ghub/responses/links.rb +17 -0
- data/lib/ghub/responses/permission.rb +14 -0
- data/lib/ghub/responses/repository.rb +90 -0
- data/lib/ghub/responses/restriction.rb +16 -0
- data/lib/ghub/responses/review.rb +15 -0
- data/lib/ghub/responses/status_check.rb +20 -0
- data/lib/ghub/responses/team.rb +20 -0
- data/lib/ghub/responses/user.rb +27 -0
- data/lib/ghub/resultable.rb +20 -0
- data/lib/ghub.rb +16 -0
- data.tar.gz.sig +0 -0
- metadata +276 -0
- metadata.gz.sig +0 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ghub
|
|
4
|
+
module Endpoints
|
|
5
|
+
module Users
|
|
6
|
+
module Models
|
|
7
|
+
# Defines a single user.
|
|
8
|
+
Show = Struct.new(
|
|
9
|
+
:avatar_url,
|
|
10
|
+
:bio,
|
|
11
|
+
:blog,
|
|
12
|
+
:company,
|
|
13
|
+
:created_at,
|
|
14
|
+
:email,
|
|
15
|
+
:events_url,
|
|
16
|
+
:followers,
|
|
17
|
+
:followers_url,
|
|
18
|
+
:following,
|
|
19
|
+
:following_url,
|
|
20
|
+
:gists_url,
|
|
21
|
+
:gravatar_id,
|
|
22
|
+
:hireable,
|
|
23
|
+
:html_url,
|
|
24
|
+
:id,
|
|
25
|
+
:location,
|
|
26
|
+
:login,
|
|
27
|
+
:name,
|
|
28
|
+
:node_id,
|
|
29
|
+
:organizations_url,
|
|
30
|
+
:public_gists,
|
|
31
|
+
:public_repos,
|
|
32
|
+
:received_events_url,
|
|
33
|
+
:repos_url,
|
|
34
|
+
:site_admin,
|
|
35
|
+
:starred_url,
|
|
36
|
+
:subscriptions_url,
|
|
37
|
+
:twitter_username,
|
|
38
|
+
:type,
|
|
39
|
+
:updated_at,
|
|
40
|
+
:url,
|
|
41
|
+
keyword_init: true
|
|
42
|
+
) do
|
|
43
|
+
include Resultable
|
|
44
|
+
|
|
45
|
+
def initialize *arguments
|
|
46
|
+
super
|
|
47
|
+
freeze
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ghub
|
|
4
|
+
module Endpoints
|
|
5
|
+
module Users
|
|
6
|
+
module Responses
|
|
7
|
+
# Defines a user within a collection.
|
|
8
|
+
Index = Dry::Schema.JSON do
|
|
9
|
+
required(:body).array(:hash) do
|
|
10
|
+
required(:avatar_url).filled :string
|
|
11
|
+
required(:events_url).filled :string
|
|
12
|
+
required(:followers_url).filled :string
|
|
13
|
+
required(:following_url).filled :string
|
|
14
|
+
required(:gists_url).filled :string
|
|
15
|
+
required(:gravatar_id).maybe :string
|
|
16
|
+
required(:html_url).filled :string
|
|
17
|
+
required(:id).filled :integer
|
|
18
|
+
required(:login).filled :string
|
|
19
|
+
required(:node_id).filled :string
|
|
20
|
+
required(:organizations_url).filled :string
|
|
21
|
+
required(:received_events_url).filled :string
|
|
22
|
+
required(:repos_url).filled :string
|
|
23
|
+
required(:site_admin).filled :bool
|
|
24
|
+
required(:starred_url).filled :string
|
|
25
|
+
required(:subscriptions_url).filled :string
|
|
26
|
+
required(:type).filled :string
|
|
27
|
+
required(:url).filled :string
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ghub
|
|
4
|
+
module Endpoints
|
|
5
|
+
module Users
|
|
6
|
+
module Responses
|
|
7
|
+
# Defines a single user.
|
|
8
|
+
Show = Dry::Schema.JSON do
|
|
9
|
+
required(:avatar_url).filled :string
|
|
10
|
+
required(:bio).maybe :string
|
|
11
|
+
required(:blog).maybe :string
|
|
12
|
+
required(:company).maybe :string
|
|
13
|
+
required(:created_at).filled :date_time
|
|
14
|
+
required(:email).maybe :string
|
|
15
|
+
required(:events_url).filled :string
|
|
16
|
+
required(:followers).filled :integer
|
|
17
|
+
required(:followers_url).filled :string
|
|
18
|
+
required(:following).filled :integer
|
|
19
|
+
required(:following_url).filled :string
|
|
20
|
+
required(:gists_url).filled :string
|
|
21
|
+
required(:gravatar_id).maybe :string
|
|
22
|
+
required(:hireable).maybe :string
|
|
23
|
+
required(:html_url).filled :string
|
|
24
|
+
required(:id).filled :integer
|
|
25
|
+
required(:location).maybe :string
|
|
26
|
+
required(:login).filled :string
|
|
27
|
+
required(:name).maybe :string
|
|
28
|
+
required(:node_id).filled :string
|
|
29
|
+
required(:organizations_url).filled :string
|
|
30
|
+
required(:public_gists).filled :integer
|
|
31
|
+
required(:public_repos).filled :integer
|
|
32
|
+
required(:received_events_url).filled :string
|
|
33
|
+
required(:repos_url).filled :string
|
|
34
|
+
required(:site_admin).filled :bool
|
|
35
|
+
required(:starred_url).filled :string
|
|
36
|
+
required(:subscriptions_url).filled :string
|
|
37
|
+
required(:twitter_username).maybe :string
|
|
38
|
+
required(:type).filled :string
|
|
39
|
+
required(:updated_at).filled :date_time
|
|
40
|
+
required(:url).filled :string
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ghub
|
|
4
|
+
module Endpoints
|
|
5
|
+
module Users
|
|
6
|
+
# Provides access to the users API endpoint.
|
|
7
|
+
class Root
|
|
8
|
+
include Users::Import[index_action: "actions.index", show_action: "actions.show"]
|
|
9
|
+
|
|
10
|
+
def index(...) = index_action.call(...)
|
|
11
|
+
|
|
12
|
+
def show(...) = show_action.call(...)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
data/lib/ghub/import.rb
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ghub
|
|
4
|
+
module Models
|
|
5
|
+
# Defines an application.
|
|
6
|
+
Application = Struct.new(
|
|
7
|
+
:created_at,
|
|
8
|
+
:description,
|
|
9
|
+
:events,
|
|
10
|
+
:external_url,
|
|
11
|
+
:html_url,
|
|
12
|
+
:id,
|
|
13
|
+
:name,
|
|
14
|
+
:node_id,
|
|
15
|
+
:owner,
|
|
16
|
+
:permissions,
|
|
17
|
+
:slug,
|
|
18
|
+
:updated_at,
|
|
19
|
+
keyword_init: true
|
|
20
|
+
) do
|
|
21
|
+
def self.for attributes
|
|
22
|
+
new attributes.merge(
|
|
23
|
+
owner: Owner[attributes[:owner]],
|
|
24
|
+
permissions: Permissions::Branch[attributes[:permissions]]
|
|
25
|
+
)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def initialize *arguments
|
|
29
|
+
super
|
|
30
|
+
freeze
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ghub
|
|
4
|
+
module Models
|
|
5
|
+
# Defines a branch.
|
|
6
|
+
Branch = Struct.new :label, :ref, :repo, :sha, :user, keyword_init: true do
|
|
7
|
+
def self.for attributes
|
|
8
|
+
new attributes.merge(
|
|
9
|
+
user: User[attributes[:user]],
|
|
10
|
+
repo: Repository.for(attributes[:repo])
|
|
11
|
+
)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def initialize *arguments
|
|
15
|
+
super
|
|
16
|
+
freeze
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ghub
|
|
4
|
+
module Models
|
|
5
|
+
# Defines a dismissal restriction.
|
|
6
|
+
DismissalRestriction = Struct.new(
|
|
7
|
+
:apps,
|
|
8
|
+
:teams,
|
|
9
|
+
:teams_url,
|
|
10
|
+
:url,
|
|
11
|
+
:users,
|
|
12
|
+
:users_url,
|
|
13
|
+
keyword_init: true
|
|
14
|
+
) do
|
|
15
|
+
def self.for attributes
|
|
16
|
+
return new unless attributes
|
|
17
|
+
|
|
18
|
+
new attributes.merge(
|
|
19
|
+
apps: attributes[:apps].map { |arguments| Application[arguments] },
|
|
20
|
+
teams: attributes[:teams].map { |arguments| Team[arguments] },
|
|
21
|
+
users: attributes[:users].map { |arguments| User[arguments] }
|
|
22
|
+
)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def initialize *arguments
|
|
26
|
+
super
|
|
27
|
+
freeze
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ghub
|
|
4
|
+
module Models
|
|
5
|
+
# Defines a label.
|
|
6
|
+
Label = Struct.new(
|
|
7
|
+
:color,
|
|
8
|
+
:default,
|
|
9
|
+
:description,
|
|
10
|
+
:id,
|
|
11
|
+
:name,
|
|
12
|
+
:node_id,
|
|
13
|
+
:url,
|
|
14
|
+
keyword_init: true
|
|
15
|
+
) do
|
|
16
|
+
def initialize *arguments
|
|
17
|
+
super
|
|
18
|
+
freeze
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ghub
|
|
4
|
+
module Models
|
|
5
|
+
# Defines a license.
|
|
6
|
+
License = Struct.new(
|
|
7
|
+
:key,
|
|
8
|
+
:name,
|
|
9
|
+
:node_id,
|
|
10
|
+
:spdx_id,
|
|
11
|
+
:url,
|
|
12
|
+
keyword_init: true
|
|
13
|
+
) do
|
|
14
|
+
def initialize *arguments
|
|
15
|
+
super
|
|
16
|
+
freeze
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ghub
|
|
4
|
+
module Models
|
|
5
|
+
# Defines a set of links.
|
|
6
|
+
Links = Struct.new(
|
|
7
|
+
:self,
|
|
8
|
+
:html,
|
|
9
|
+
:issue,
|
|
10
|
+
:comments,
|
|
11
|
+
:review_comments,
|
|
12
|
+
:review_comment,
|
|
13
|
+
:commits,
|
|
14
|
+
:statuses,
|
|
15
|
+
keyword_init: true
|
|
16
|
+
) do
|
|
17
|
+
def self.for attributes
|
|
18
|
+
attributes.reduce({}) { |collection, (key, value)| collection.merge key => Link[value] }
|
|
19
|
+
.then { |updated_attributes| new updated_attributes }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def initialize *arguments
|
|
23
|
+
super
|
|
24
|
+
freeze
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ghub
|
|
4
|
+
module Models
|
|
5
|
+
# Defines an owner.
|
|
6
|
+
Owner = Struct.new(
|
|
7
|
+
:login,
|
|
8
|
+
:id,
|
|
9
|
+
:node_id,
|
|
10
|
+
:url,
|
|
11
|
+
:repos_url,
|
|
12
|
+
:events_url,
|
|
13
|
+
:hooks_url,
|
|
14
|
+
:issues_url,
|
|
15
|
+
:members_url,
|
|
16
|
+
:public_members_url,
|
|
17
|
+
:avatar_url,
|
|
18
|
+
:description,
|
|
19
|
+
keyword_init: true
|
|
20
|
+
) do
|
|
21
|
+
def initialize *arguments
|
|
22
|
+
super
|
|
23
|
+
freeze
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ghub
|
|
4
|
+
module Models
|
|
5
|
+
module Permissions
|
|
6
|
+
# Defines branch permissions.
|
|
7
|
+
Branch = Struct.new(
|
|
8
|
+
:contents,
|
|
9
|
+
:issues,
|
|
10
|
+
:metadata,
|
|
11
|
+
:single_file,
|
|
12
|
+
keyword_init: true
|
|
13
|
+
) do
|
|
14
|
+
def initialize *arguments
|
|
15
|
+
super
|
|
16
|
+
freeze
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ghub
|
|
4
|
+
module Models
|
|
5
|
+
module Permissions
|
|
6
|
+
# Defines repository permissions.
|
|
7
|
+
Repository = Struct.new(
|
|
8
|
+
:admin,
|
|
9
|
+
:maintain,
|
|
10
|
+
:pull,
|
|
11
|
+
:push,
|
|
12
|
+
:triage,
|
|
13
|
+
keyword_init: true
|
|
14
|
+
) do
|
|
15
|
+
def initialize *arguments
|
|
16
|
+
super
|
|
17
|
+
freeze
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ghub
|
|
4
|
+
module Models
|
|
5
|
+
# Defines a repository.
|
|
6
|
+
Repository = Struct.new(
|
|
7
|
+
:allow_forking,
|
|
8
|
+
:archive_url,
|
|
9
|
+
:archived,
|
|
10
|
+
:assignees_url,
|
|
11
|
+
:blobs_url,
|
|
12
|
+
:branches_url,
|
|
13
|
+
:clone_url,
|
|
14
|
+
:collaborators_url,
|
|
15
|
+
:comments_url,
|
|
16
|
+
:commits_url,
|
|
17
|
+
:compare_url,
|
|
18
|
+
:contents_url,
|
|
19
|
+
:contributors_url,
|
|
20
|
+
:created_at,
|
|
21
|
+
:default_branch,
|
|
22
|
+
:deployments_url,
|
|
23
|
+
:description,
|
|
24
|
+
:disabled,
|
|
25
|
+
:downloads_url,
|
|
26
|
+
:events_url,
|
|
27
|
+
:fork,
|
|
28
|
+
:forks,
|
|
29
|
+
:forks_count,
|
|
30
|
+
:forks_url,
|
|
31
|
+
:full_name,
|
|
32
|
+
:git_commits_url,
|
|
33
|
+
:git_refs_url,
|
|
34
|
+
:git_tags_url,
|
|
35
|
+
:git_url,
|
|
36
|
+
:has_downloads,
|
|
37
|
+
:has_issues,
|
|
38
|
+
:has_pages,
|
|
39
|
+
:has_projects,
|
|
40
|
+
:has_wiki,
|
|
41
|
+
:homepage,
|
|
42
|
+
:hooks_url,
|
|
43
|
+
:html_url,
|
|
44
|
+
:id,
|
|
45
|
+
:is_template,
|
|
46
|
+
:issue_comment_url,
|
|
47
|
+
:issue_events_url,
|
|
48
|
+
:issues_url,
|
|
49
|
+
:keys_url,
|
|
50
|
+
:labels_url,
|
|
51
|
+
:language,
|
|
52
|
+
:languages_url,
|
|
53
|
+
:license,
|
|
54
|
+
:merges_url,
|
|
55
|
+
:milestones_url,
|
|
56
|
+
:mirror_url,
|
|
57
|
+
:name,
|
|
58
|
+
:network_count,
|
|
59
|
+
:node_id,
|
|
60
|
+
:notifications_url,
|
|
61
|
+
:open_issues,
|
|
62
|
+
:open_issues_count,
|
|
63
|
+
:organization,
|
|
64
|
+
:owner,
|
|
65
|
+
:permissions,
|
|
66
|
+
:private,
|
|
67
|
+
:pulls_url,
|
|
68
|
+
:pushed_at,
|
|
69
|
+
:releases_url,
|
|
70
|
+
:ssh_url,
|
|
71
|
+
:stargazers_count,
|
|
72
|
+
:stargazers_url,
|
|
73
|
+
:statuses_url,
|
|
74
|
+
:subscribers_count,
|
|
75
|
+
:subscribers_url,
|
|
76
|
+
:subscription_url,
|
|
77
|
+
:svn_url,
|
|
78
|
+
:tags_url,
|
|
79
|
+
:teams_url,
|
|
80
|
+
:temp_clone_token,
|
|
81
|
+
:topics,
|
|
82
|
+
:trees_url,
|
|
83
|
+
:updated_at,
|
|
84
|
+
:url,
|
|
85
|
+
:visibility,
|
|
86
|
+
:watchers,
|
|
87
|
+
:watchers_count,
|
|
88
|
+
:web_commit_signoff_required,
|
|
89
|
+
:weight,
|
|
90
|
+
keyword_init: true
|
|
91
|
+
) do
|
|
92
|
+
include Resultable
|
|
93
|
+
|
|
94
|
+
def self.for attributes
|
|
95
|
+
new attributes.transform_keys(size: :weight).merge(
|
|
96
|
+
license: (License[Hash(attributes[:license])] if attributes.key? :license),
|
|
97
|
+
owner: User[attributes[:owner]],
|
|
98
|
+
organization: (User[attributes[:organization]] if attributes.key? :organization),
|
|
99
|
+
permissions: (
|
|
100
|
+
Permissions::Repository[attributes[:permissions]] if attributes.key? :permissions
|
|
101
|
+
)
|
|
102
|
+
)
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def initialize *arguments
|
|
106
|
+
super
|
|
107
|
+
freeze
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ghub
|
|
4
|
+
module Models
|
|
5
|
+
# Defines a restriction.
|
|
6
|
+
Restriction = Struct.new(
|
|
7
|
+
:apps,
|
|
8
|
+
:apps_url,
|
|
9
|
+
:teams,
|
|
10
|
+
:teams_url,
|
|
11
|
+
:url,
|
|
12
|
+
:users,
|
|
13
|
+
:users_url,
|
|
14
|
+
keyword_init: true
|
|
15
|
+
) do
|
|
16
|
+
def self.for attributes
|
|
17
|
+
return new unless attributes
|
|
18
|
+
|
|
19
|
+
new attributes.merge(
|
|
20
|
+
apps: attributes[:apps].map { |arguments| Application[arguments] },
|
|
21
|
+
teams: attributes[:teams].map { |arguments| Team[arguments] },
|
|
22
|
+
users: attributes[:users].map { |arguments| User[arguments] }
|
|
23
|
+
)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def initialize *arguments
|
|
27
|
+
super
|
|
28
|
+
freeze
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ghub
|
|
4
|
+
module Models
|
|
5
|
+
# Defines a review.
|
|
6
|
+
Review = Struct.new(
|
|
7
|
+
:dismiss_stale_reviews,
|
|
8
|
+
:require_code_owner_reviews,
|
|
9
|
+
:required_approving_review_count,
|
|
10
|
+
:url,
|
|
11
|
+
:dismissal_restrictions,
|
|
12
|
+
keyword_init: true
|
|
13
|
+
) do
|
|
14
|
+
def self.for attributes
|
|
15
|
+
return new unless attributes
|
|
16
|
+
|
|
17
|
+
new attributes.merge(
|
|
18
|
+
dismissal_restrictions: DismissalRestriction.for(attributes[:dismissal_restrictions])
|
|
19
|
+
)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def initialize *arguments
|
|
23
|
+
super
|
|
24
|
+
freeze
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ghub
|
|
4
|
+
module Models
|
|
5
|
+
# Defines a status check.
|
|
6
|
+
StatusCheck = Struct.new(
|
|
7
|
+
:url,
|
|
8
|
+
:strict,
|
|
9
|
+
:contexts,
|
|
10
|
+
:contexts_url,
|
|
11
|
+
:checks,
|
|
12
|
+
:enforcement_level,
|
|
13
|
+
keyword_init: true
|
|
14
|
+
) do
|
|
15
|
+
def self.for attributes
|
|
16
|
+
new attributes.merge(checks: attributes[:checks].map { |arguments| Check[arguments] })
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def initialize *arguments
|
|
20
|
+
super
|
|
21
|
+
freeze
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ghub
|
|
4
|
+
module Models
|
|
5
|
+
# Defines a team.
|
|
6
|
+
Team = Struct.new(
|
|
7
|
+
:description,
|
|
8
|
+
:html_url,
|
|
9
|
+
:id,
|
|
10
|
+
:members_url,
|
|
11
|
+
:name,
|
|
12
|
+
:node_id,
|
|
13
|
+
:parent,
|
|
14
|
+
:permission,
|
|
15
|
+
:privacy,
|
|
16
|
+
:repositories_url,
|
|
17
|
+
:slug,
|
|
18
|
+
:url,
|
|
19
|
+
keyword_init: true
|
|
20
|
+
) do
|
|
21
|
+
def initialize *arguments
|
|
22
|
+
super
|
|
23
|
+
freeze
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ghub
|
|
4
|
+
module Models
|
|
5
|
+
# Defines a user.
|
|
6
|
+
User = Struct.new(
|
|
7
|
+
:avatar_url,
|
|
8
|
+
:events_url,
|
|
9
|
+
:followers_url,
|
|
10
|
+
:following_url,
|
|
11
|
+
:gists_url,
|
|
12
|
+
:gravatar_id,
|
|
13
|
+
:html_url,
|
|
14
|
+
:id,
|
|
15
|
+
:login,
|
|
16
|
+
:node_id,
|
|
17
|
+
:organizations_url,
|
|
18
|
+
:received_events_url,
|
|
19
|
+
:repos_url,
|
|
20
|
+
:site_admin,
|
|
21
|
+
:starred_url,
|
|
22
|
+
:subscriptions_url,
|
|
23
|
+
:type,
|
|
24
|
+
:url,
|
|
25
|
+
keyword_init: true
|
|
26
|
+
) do
|
|
27
|
+
def initialize *arguments
|
|
28
|
+
super
|
|
29
|
+
freeze
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|