ghub 0.7.0 → 0.8.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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/ghub.gemspec +2 -2
- data/lib/ghub/client.rb +10 -24
- data/lib/ghub/configuration/content.rb +1 -1
- data/lib/ghub/endpoints/branches/protection/models/show.rb +17 -14
- data/lib/ghub/endpoints/branches/signature/root.rb +2 -2
- data/lib/ghub/endpoints/organizations/members/actions/index.rb +1 -1
- data/lib/ghub/endpoints/pulls/actions/index.rb +1 -1
- data/lib/ghub/endpoints/pulls/models/show.rb +13 -12
- data/lib/ghub/endpoints/repositories/actions/index.rb +1 -1
- data/lib/ghub/endpoints/search/users/actions/index.rb +1 -1
- data/lib/ghub/endpoints/search/users/models/index.rb +4 -3
- data/lib/ghub/endpoints/users/actions/index.rb +1 -1
- data/lib/ghub/endpoints/users/actions/show.rb +1 -1
- data/lib/ghub/endpoints/users/models/index.rb +4 -3
- data/lib/ghub/endpoints/users/models/show.rb +4 -3
- data/lib/ghub/models/application.rb +8 -7
- data/lib/ghub/models/boolean_link.rb +4 -2
- data/lib/ghub/models/branch.rb +8 -6
- data/lib/ghub/models/check.rb +2 -6
- data/lib/ghub/models/dismissal_restriction.rb +10 -9
- data/lib/ghub/models/label.rb +2 -3
- data/lib/ghub/models/license.rb +2 -3
- data/lib/ghub/models/link.rb +2 -2
- data/lib/ghub/models/links.rb +5 -6
- data/lib/ghub/models/owner.rb +2 -3
- data/lib/ghub/models/permissions/branch.rb +2 -3
- data/lib/ghub/models/permissions/repository.rb +2 -3
- data/lib/ghub/models/repository.rb +11 -10
- data/lib/ghub/models/restriction.rb +10 -9
- data/lib/ghub/models/review.rb +8 -7
- data/lib/ghub/models/status_check.rb +6 -5
- data/lib/ghub/models/team.rb +2 -3
- data/lib/ghub/models/user.rb +4 -3
- data.tar.gz.sig +0 -0
- metadata +5 -5
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc547d4e3cec29f9038684eaef8d38f1ca66b4a35434c2ebdd1e7d60b9023475
|
4
|
+
data.tar.gz: ff29d2dc0ab4335f947fb9f926d1cd48cd19b4e83f7564714858093e4f2aea78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b22508622544ffb27da238324d73527f636b7c4284f99ac2d1805c3dd22fe42a84dd116920251d95cac3a98c4ddb0077040338e3e6357018671afbe300c095d4
|
7
|
+
data.tar.gz: 7ec2df17d95ac1dda245e5faf927f9c07e60a1dd2048411fa68831a855860d348fc3118f5f33849e7257264974ae9098307a5f1c04cf63fa6ab5aa6aba27cbf9
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/ghub.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "ghub"
|
5
|
-
spec.version = "0.
|
5
|
+
spec.version = "0.8.0"
|
6
6
|
spec.authors = ["Brooke Kuhlmann"]
|
7
7
|
spec.email = ["brooke@alchemists.io"]
|
8
8
|
spec.homepage = "https://alchemists.io/projects/ghub"
|
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_dependency "dry-monads", "~> 1.6"
|
28
28
|
spec.add_dependency "dry-schema", "~> 1.13"
|
29
29
|
spec.add_dependency "http", "~> 5.1"
|
30
|
-
spec.add_dependency "infusible", "~> 2.
|
30
|
+
spec.add_dependency "infusible", "~> 2.2"
|
31
31
|
spec.add_dependency "refinements", "~> 11.0"
|
32
32
|
spec.add_dependency "transactable", "~> 0.5"
|
33
33
|
spec.add_dependency "zeitwerk", "~> 2.6"
|
data/lib/ghub/client.rb
CHANGED
@@ -3,35 +3,21 @@
|
|
3
3
|
module Ghub
|
4
4
|
# The primary interface for making API requests.
|
5
5
|
class Client
|
6
|
-
include Import
|
6
|
+
include Endpoints::Import.public(
|
7
|
+
:branch_protection,
|
8
|
+
:branch_signature,
|
9
|
+
:organization_members,
|
10
|
+
:pulls,
|
11
|
+
:repositories,
|
12
|
+
:search_users,
|
13
|
+
:users
|
14
|
+
)
|
7
15
|
|
8
|
-
include
|
9
|
-
branch_protection_endpoint: :branch_protection,
|
10
|
-
branch_signature_endpoint: :branch_signature,
|
11
|
-
organization_members_endpoint: :organization_members,
|
12
|
-
pulls_endpoint: :pulls,
|
13
|
-
repositories_endpoint: :repositories,
|
14
|
-
search_users_endpoint: :search_users,
|
15
|
-
users_endpoint: :users
|
16
|
-
]
|
16
|
+
include Import[:configuration]
|
17
17
|
|
18
18
|
def initialize(**)
|
19
19
|
super(**)
|
20
20
|
yield configuration if block_given?
|
21
21
|
end
|
22
|
-
|
23
|
-
def branch_protection = branch_protection_endpoint
|
24
|
-
|
25
|
-
def branch_signature = branch_signature_endpoint
|
26
|
-
|
27
|
-
def organization_members = organization_members_endpoint
|
28
|
-
|
29
|
-
def pulls = pulls_endpoint
|
30
|
-
|
31
|
-
def repositories = repositories_endpoint
|
32
|
-
|
33
|
-
def search_users = search_users_endpoint
|
34
|
-
|
35
|
-
def users = users_endpoint
|
36
22
|
end
|
37
23
|
end
|
@@ -17,26 +17,29 @@ module Ghub
|
|
17
17
|
:required_signatures,
|
18
18
|
:required_status_checks,
|
19
19
|
:restrictions,
|
20
|
-
:url
|
21
|
-
keyword_init: true
|
20
|
+
:url
|
22
21
|
) do
|
23
22
|
include Resultable
|
24
23
|
|
25
|
-
def self.for
|
26
|
-
new
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
24
|
+
def self.for(**attributes)
|
25
|
+
new(
|
26
|
+
**attributes.merge!(
|
27
|
+
enforce_admins: Ghub::Models::BooleanLink[**attributes[:enforce_admins]],
|
28
|
+
required_signatures: Ghub::Models::BooleanLink[
|
29
|
+
**Hash(attributes[:required_signatures])
|
30
|
+
],
|
31
|
+
required_status_checks: Ghub::Models::StatusCheck.for(
|
32
|
+
**Hash(attributes[:required_status_checks])
|
33
|
+
),
|
34
|
+
required_pull_request_reviews: Ghub::Models::Review.for(
|
35
|
+
**Hash(attributes[:required_pull_request_reviews])
|
36
|
+
),
|
37
|
+
restrictions: Ghub::Models::Restriction.for(**Hash(attributes[:restrictions]))
|
38
|
+
)
|
36
39
|
)
|
37
40
|
end
|
38
41
|
|
39
|
-
def initialize
|
42
|
+
def initialize(**)
|
40
43
|
super
|
41
44
|
freeze
|
42
45
|
end
|
@@ -23,7 +23,7 @@ module Ghub
|
|
23
23
|
to(client, :get),
|
24
24
|
try(:parse, catch: JSON::ParserError),
|
25
25
|
validate(response),
|
26
|
-
to(model, :
|
26
|
+
to(model, :for)
|
27
27
|
end
|
28
28
|
|
29
29
|
def create owner, repository, branch
|
@@ -31,7 +31,7 @@ module Ghub
|
|
31
31
|
to(client, :post),
|
32
32
|
try(:parse, catch: JSON::ParserError),
|
33
33
|
validate(response),
|
34
|
-
to(model, :
|
34
|
+
to(model, :for)
|
35
35
|
end
|
36
36
|
|
37
37
|
def destroy owner, repository, branch
|
@@ -53,26 +53,27 @@ module Ghub
|
|
53
53
|
:title,
|
54
54
|
:updated_at,
|
55
55
|
:url,
|
56
|
-
:user
|
57
|
-
keyword_init: true
|
56
|
+
:user
|
58
57
|
) do
|
59
58
|
include Resultable
|
60
59
|
|
61
|
-
def self.for
|
60
|
+
def self.for(**attributes)
|
62
61
|
assignee = attributes[:assignee]
|
63
62
|
|
64
|
-
new
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
63
|
+
new(
|
64
|
+
**attributes.merge!(
|
65
|
+
_links: Ghub::Models::Links.for(**attributes[:_links]),
|
66
|
+
assignee: (Ghub::Models::User[**assignee] if assignee),
|
67
|
+
assignees: attributes[:assignees].map { |data| Ghub::Models::User[**data] },
|
68
|
+
base: Ghub::Models::Branch[**attributes[:base]],
|
69
|
+
head: Ghub::Models::Branch[**attributes[:head]],
|
70
|
+
labels: attributes[:labels].map { |data| Ghub::Models::Label[**data] },
|
71
|
+
user: Ghub::Models::User[**attributes[:user]]
|
72
|
+
)
|
72
73
|
)
|
73
74
|
end
|
74
75
|
|
75
|
-
def initialize
|
76
|
+
def initialize(**)
|
76
77
|
super
|
77
78
|
freeze
|
78
79
|
end
|
@@ -25,12 +25,13 @@ module Ghub
|
|
25
25
|
:starred_url,
|
26
26
|
:subscriptions_url,
|
27
27
|
:type,
|
28
|
-
:url
|
29
|
-
keyword_init: true
|
28
|
+
:url
|
30
29
|
) do
|
31
30
|
include Resultable
|
32
31
|
|
33
|
-
def
|
32
|
+
def self.for(**) = new(**)
|
33
|
+
|
34
|
+
def initialize(**)
|
34
35
|
super
|
35
36
|
freeze
|
36
37
|
end
|
@@ -23,12 +23,13 @@ module Ghub
|
|
23
23
|
:starred_url,
|
24
24
|
:subscriptions_url,
|
25
25
|
:type,
|
26
|
-
:url
|
27
|
-
keyword_init: true
|
26
|
+
:url
|
28
27
|
) do
|
29
28
|
include Resultable
|
30
29
|
|
31
|
-
def
|
30
|
+
def self.for(**) = new(**)
|
31
|
+
|
32
|
+
def initialize(**)
|
32
33
|
super
|
33
34
|
freeze
|
34
35
|
end
|
@@ -37,12 +37,13 @@ module Ghub
|
|
37
37
|
:twitter_username,
|
38
38
|
:type,
|
39
39
|
:updated_at,
|
40
|
-
:url
|
41
|
-
keyword_init: true
|
40
|
+
:url
|
42
41
|
) do
|
43
42
|
include Resultable
|
44
43
|
|
45
|
-
def
|
44
|
+
def self.for(**) = new(**)
|
45
|
+
|
46
|
+
def initialize(**)
|
46
47
|
super
|
47
48
|
freeze
|
48
49
|
end
|
@@ -15,17 +15,18 @@ module Ghub
|
|
15
15
|
:owner,
|
16
16
|
:permissions,
|
17
17
|
:slug,
|
18
|
-
:updated_at
|
19
|
-
keyword_init: true
|
18
|
+
:updated_at
|
20
19
|
) do
|
21
|
-
def self.for
|
22
|
-
new
|
23
|
-
|
24
|
-
|
20
|
+
def self.for(**attributes)
|
21
|
+
new(
|
22
|
+
**attributes.merge!(
|
23
|
+
owner: Owner[**attributes[:owner]],
|
24
|
+
permissions: Permissions::Branch[**attributes[:permissions]]
|
25
|
+
)
|
25
26
|
)
|
26
27
|
end
|
27
28
|
|
28
|
-
def initialize
|
29
|
+
def initialize(**)
|
29
30
|
super
|
30
31
|
freeze
|
31
32
|
end
|
@@ -3,8 +3,10 @@
|
|
3
3
|
module Ghub
|
4
4
|
module Models
|
5
5
|
# Defines a boolean link.
|
6
|
-
BooleanLink = Struct.new :enabled, :url
|
7
|
-
def
|
6
|
+
BooleanLink = Struct.new :enabled, :url do
|
7
|
+
def self.for(**) = new(**)
|
8
|
+
|
9
|
+
def initialize(**)
|
8
10
|
super
|
9
11
|
freeze
|
10
12
|
end
|
data/lib/ghub/models/branch.rb
CHANGED
@@ -3,15 +3,17 @@
|
|
3
3
|
module Ghub
|
4
4
|
module Models
|
5
5
|
# Defines a branch.
|
6
|
-
Branch = Struct.new :label, :ref, :repo, :sha, :user
|
7
|
-
def self.for
|
8
|
-
new
|
9
|
-
|
10
|
-
|
6
|
+
Branch = Struct.new :label, :ref, :repo, :sha, :user do
|
7
|
+
def self.for(**attributes)
|
8
|
+
new(
|
9
|
+
**attributes.merge!(
|
10
|
+
user: User[**attributes[:user]],
|
11
|
+
repo: Repository.for(**attributes[:repo])
|
12
|
+
)
|
11
13
|
)
|
12
14
|
end
|
13
15
|
|
14
|
-
def initialize
|
16
|
+
def initialize(**)
|
15
17
|
super
|
16
18
|
freeze
|
17
19
|
end
|
data/lib/ghub/models/check.rb
CHANGED
@@ -9,20 +9,21 @@ module Ghub
|
|
9
9
|
:teams_url,
|
10
10
|
:url,
|
11
11
|
:users,
|
12
|
-
:users_url
|
13
|
-
keyword_init: true
|
12
|
+
:users_url
|
14
13
|
) do
|
15
|
-
def self.for
|
16
|
-
return new
|
14
|
+
def self.for(**attributes)
|
15
|
+
return new if attributes.empty?
|
17
16
|
|
18
|
-
new
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
new(
|
18
|
+
**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
|
+
)
|
22
23
|
)
|
23
24
|
end
|
24
25
|
|
25
|
-
def initialize
|
26
|
+
def initialize(**)
|
26
27
|
super
|
27
28
|
freeze
|
28
29
|
end
|
data/lib/ghub/models/label.rb
CHANGED
data/lib/ghub/models/license.rb
CHANGED
data/lib/ghub/models/link.rb
CHANGED
data/lib/ghub/models/links.rb
CHANGED
@@ -11,15 +11,14 @@ module Ghub
|
|
11
11
|
:review_comments,
|
12
12
|
:review_comment,
|
13
13
|
:commits,
|
14
|
-
:statuses
|
15
|
-
keyword_init: true
|
14
|
+
:statuses
|
16
15
|
) do
|
17
|
-
def self.for
|
18
|
-
attributes.reduce({}) { |collection, (key, value)| collection.merge key => Link[value] }
|
19
|
-
.then { |
|
16
|
+
def self.for(**attributes)
|
17
|
+
attributes.reduce({}) { |collection, (key, value)| collection.merge key => Link[**value] }
|
18
|
+
.then { |updates| new(**updates) }
|
20
19
|
end
|
21
20
|
|
22
|
-
def initialize
|
21
|
+
def initialize(**)
|
23
22
|
super
|
24
23
|
freeze
|
25
24
|
end
|
data/lib/ghub/models/owner.rb
CHANGED
@@ -86,23 +86,24 @@ module Ghub
|
|
86
86
|
:watchers,
|
87
87
|
:watchers_count,
|
88
88
|
:web_commit_signoff_required,
|
89
|
-
:weight
|
90
|
-
keyword_init: true
|
89
|
+
:weight
|
91
90
|
) do
|
92
91
|
include Resultable
|
93
92
|
|
94
|
-
def self.for
|
95
|
-
new
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
93
|
+
def self.for(**attributes)
|
94
|
+
new(
|
95
|
+
**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
|
+
)
|
101
102
|
)
|
102
103
|
)
|
103
104
|
end
|
104
105
|
|
105
|
-
def initialize
|
106
|
+
def initialize(**)
|
106
107
|
super
|
107
108
|
freeze
|
108
109
|
end
|
@@ -10,20 +10,21 @@ module Ghub
|
|
10
10
|
:teams_url,
|
11
11
|
:url,
|
12
12
|
:users,
|
13
|
-
:users_url
|
14
|
-
keyword_init: true
|
13
|
+
:users_url
|
15
14
|
) do
|
16
|
-
def self.for
|
17
|
-
return new
|
15
|
+
def self.for(**attributes)
|
16
|
+
return new if attributes.empty?
|
18
17
|
|
19
|
-
new
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
new(
|
19
|
+
**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
|
+
)
|
23
24
|
)
|
24
25
|
end
|
25
26
|
|
26
|
-
def initialize
|
27
|
+
def initialize(**)
|
27
28
|
super
|
28
29
|
freeze
|
29
30
|
end
|
data/lib/ghub/models/review.rb
CHANGED
@@ -8,18 +8,19 @@ module Ghub
|
|
8
8
|
:require_code_owner_reviews,
|
9
9
|
:required_approving_review_count,
|
10
10
|
:url,
|
11
|
-
:dismissal_restrictions
|
12
|
-
keyword_init: true
|
11
|
+
:dismissal_restrictions
|
13
12
|
) do
|
14
|
-
def self.for
|
15
|
-
return new
|
13
|
+
def self.for(**attributes)
|
14
|
+
return new if attributes.empty?
|
16
15
|
|
17
|
-
new
|
18
|
-
|
16
|
+
new(
|
17
|
+
**attributes.merge!(
|
18
|
+
dismissal_restrictions: DismissalRestriction.for(**attributes[:dismissal_restrictions])
|
19
|
+
)
|
19
20
|
)
|
20
21
|
end
|
21
22
|
|
22
|
-
def initialize
|
23
|
+
def initialize(**)
|
23
24
|
super
|
24
25
|
freeze
|
25
26
|
end
|
@@ -9,14 +9,15 @@ module Ghub
|
|
9
9
|
:contexts,
|
10
10
|
:contexts_url,
|
11
11
|
:checks,
|
12
|
-
:enforcement_level
|
13
|
-
keyword_init: true
|
12
|
+
:enforcement_level
|
14
13
|
) do
|
15
|
-
def self.for
|
16
|
-
new
|
14
|
+
def self.for(**attributes)
|
15
|
+
new(
|
16
|
+
**attributes.merge!(checks: attributes[:checks].map { |arguments| Check[**arguments] })
|
17
|
+
)
|
17
18
|
end
|
18
19
|
|
19
|
-
def initialize
|
20
|
+
def initialize(**)
|
20
21
|
super
|
21
22
|
freeze
|
22
23
|
end
|
data/lib/ghub/models/team.rb
CHANGED
data/lib/ghub/models/user.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ghub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
3n5C8/6Zh9DYTkpcwPSuIfAga6wf4nXc9m6JAw8AuMLaiWN/r/2s4zJsUHYERJEu
|
36
36
|
gZGm4JqtuSg8pYjPeIJxS960owq+SfuC+jxqmRA54BisFCv/0VOJi7tiJVY=
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2023-10-
|
38
|
+
date: 2023-10-22 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: dry-container
|
@@ -99,14 +99,14 @@ dependencies:
|
|
99
99
|
requirements:
|
100
100
|
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: '2.
|
102
|
+
version: '2.2'
|
103
103
|
type: :runtime
|
104
104
|
prerelease: false
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
107
|
- - "~>"
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: '2.
|
109
|
+
version: '2.2'
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
111
|
name: refinements
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
@@ -282,7 +282,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
282
282
|
- !ruby/object:Gem::Version
|
283
283
|
version: '0'
|
284
284
|
requirements: []
|
285
|
-
rubygems_version: 3.4.
|
285
|
+
rubygems_version: 3.4.21
|
286
286
|
signing_key:
|
287
287
|
specification_version: 4
|
288
288
|
summary: A monadic GitHub API client.
|
metadata.gz.sig
CHANGED
Binary file
|