ghub 0.0.0 → 2.3.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/README.adoc +42 -21
- data/ghub.gemspec +16 -13
- data/lib/ghub/api/client.rb +6 -6
- data/lib/ghub/api/page.rb +12 -8
- data/lib/ghub/client.rb +24 -23
- data/lib/ghub/configuration/content.rb +3 -1
- data/lib/ghub/configuration/loader.rb +3 -3
- data/lib/ghub/container.rb +7 -5
- data/lib/ghub/{import.rb → dependencies.rb} +1 -1
- data/lib/ghub/endpoints/branches/protection/actions/show.rb +6 -5
- data/lib/ghub/endpoints/branches/protection/actions/update.rb +7 -6
- data/lib/ghub/endpoints/branches/protection/container.rb +5 -7
- data/lib/ghub/endpoints/branches/protection/{import.rb → dependencies.rb} +1 -1
- data/lib/ghub/endpoints/branches/protection/models/show.rb +17 -16
- data/lib/ghub/endpoints/branches/protection/root.rb +3 -6
- data/lib/ghub/endpoints/branches/signature/container.rb +4 -6
- data/lib/ghub/endpoints/branches/signature/{import.rb → dependencies.rb} +1 -1
- data/lib/ghub/endpoints/branches/signature/root.rb +14 -13
- data/lib/ghub/endpoints/container.rb +3 -2
- data/lib/ghub/endpoints/{import.rb → dependencies.rb} +1 -1
- data/lib/ghub/endpoints/organizations/members/actions/index.rb +7 -6
- data/lib/ghub/endpoints/organizations/members/container.rb +4 -6
- data/lib/ghub/endpoints/organizations/members/{import.rb → dependencies.rb} +1 -1
- data/lib/ghub/endpoints/organizations/members/root.rb +1 -1
- data/lib/ghub/endpoints/pulls/actions/index.rb +7 -6
- data/lib/ghub/endpoints/pulls/actions/show.rb +6 -5
- data/lib/ghub/endpoints/pulls/container.rb +5 -7
- data/lib/ghub/endpoints/pulls/{import.rb → dependencies.rb} +1 -1
- data/lib/ghub/endpoints/pulls/models/show.rb +15 -14
- data/lib/ghub/endpoints/pulls/responses/show.rb +7 -7
- data/lib/ghub/endpoints/pulls/root.rb +1 -1
- data/lib/ghub/endpoints/repositories/actions/create.rb +15 -14
- data/lib/ghub/endpoints/repositories/actions/index.rb +7 -12
- data/lib/ghub/endpoints/repositories/actions/patch.rb +15 -14
- data/lib/ghub/endpoints/repositories/actions/show.rb +6 -11
- data/lib/ghub/endpoints/repositories/container.rb +7 -9
- data/lib/ghub/endpoints/repositories/{import.rb → dependencies.rb} +1 -1
- data/lib/ghub/endpoints/repositories/path.rb +3 -7
- data/lib/ghub/endpoints/repositories/root.rb +4 -3
- data/lib/ghub/endpoints/search/users/actions/index.rb +30 -0
- data/lib/ghub/endpoints/search/users/container.rb +28 -0
- data/lib/ghub/endpoints/search/users/dependencies.rb +13 -0
- data/lib/ghub/endpoints/search/users/models/index.rb +41 -0
- data/lib/ghub/endpoints/search/users/responses/index.rb +38 -0
- data/lib/ghub/endpoints/search/users/root.rb +16 -0
- data/lib/ghub/endpoints/users/actions/index.rb +7 -6
- data/lib/ghub/endpoints/users/actions/show.rb +7 -6
- data/lib/ghub/endpoints/users/container.rb +6 -8
- data/lib/ghub/endpoints/users/{import.rb → dependencies.rb} +1 -1
- data/lib/ghub/endpoints/users/models/index.rb +3 -4
- data/lib/ghub/endpoints/users/models/show.rb +3 -4
- data/lib/ghub/endpoints/users/root.rb +1 -1
- 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 +17 -11
- 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/lib/ghub.rb +6 -1
- data.tar.gz.sig +0 -0
- metadata +90 -55
- metadata.gz.sig +0 -0
- data/lib/ghub/resultable.rb +0 -20
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "pipeable"
|
|
4
|
+
|
|
5
|
+
module Ghub
|
|
6
|
+
module Endpoints
|
|
7
|
+
module Search
|
|
8
|
+
module Users
|
|
9
|
+
module Actions
|
|
10
|
+
# Handles a user index action.
|
|
11
|
+
class Index
|
|
12
|
+
include Ghub::Dependencies[:api]
|
|
13
|
+
include Dependencies[response: "responses.index", model: "models.index"]
|
|
14
|
+
include Pipeable
|
|
15
|
+
|
|
16
|
+
def call **parameters
|
|
17
|
+
pipe(
|
|
18
|
+
api.get("search/users", **parameters),
|
|
19
|
+
try(:parse, catch: JSON::ParserError),
|
|
20
|
+
validate(response, as: :to_h),
|
|
21
|
+
as(:fetch, :items),
|
|
22
|
+
map { |item| model.for(**item) }
|
|
23
|
+
)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "containable"
|
|
4
|
+
|
|
5
|
+
module Ghub
|
|
6
|
+
module Endpoints
|
|
7
|
+
module Search
|
|
8
|
+
module Users
|
|
9
|
+
# Defines user dependencies.
|
|
10
|
+
module Container
|
|
11
|
+
extend Containable
|
|
12
|
+
|
|
13
|
+
namespace :responses do
|
|
14
|
+
register :index, Responses::Index
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
namespace :models do
|
|
18
|
+
register :index, Models::Index
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
namespace :actions do
|
|
22
|
+
register(:index) { Actions::Index.new }
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ghub
|
|
4
|
+
module Endpoints
|
|
5
|
+
module Search
|
|
6
|
+
module Users
|
|
7
|
+
module Models
|
|
8
|
+
# Defines a user within a collection.
|
|
9
|
+
Index = Struct.new(
|
|
10
|
+
:avatar_url,
|
|
11
|
+
:events_url,
|
|
12
|
+
:followers_url,
|
|
13
|
+
:following_url,
|
|
14
|
+
:gists_url,
|
|
15
|
+
:gravatar_id,
|
|
16
|
+
:html_url,
|
|
17
|
+
:id,
|
|
18
|
+
:login,
|
|
19
|
+
:node_id,
|
|
20
|
+
:organizations_url,
|
|
21
|
+
:received_events_url,
|
|
22
|
+
:repos_url,
|
|
23
|
+
:score,
|
|
24
|
+
:site_admin,
|
|
25
|
+
:starred_url,
|
|
26
|
+
:subscriptions_url,
|
|
27
|
+
:type,
|
|
28
|
+
:url
|
|
29
|
+
) do
|
|
30
|
+
def self.for(**) = new(**)
|
|
31
|
+
|
|
32
|
+
def initialize(**)
|
|
33
|
+
super
|
|
34
|
+
freeze
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ghub
|
|
4
|
+
module Endpoints
|
|
5
|
+
module Search
|
|
6
|
+
module Users
|
|
7
|
+
module Responses
|
|
8
|
+
# Defines a user within a collection.
|
|
9
|
+
Index = Dry::Schema.Params do
|
|
10
|
+
required(:total_count).filled :integer
|
|
11
|
+
required(:incomplete_results).filled :bool
|
|
12
|
+
required(:items).array(:hash) do
|
|
13
|
+
required(:avatar_url).filled :string
|
|
14
|
+
required(:events_url).filled :string
|
|
15
|
+
required(:followers_url).filled :string
|
|
16
|
+
required(:following_url).filled :string
|
|
17
|
+
required(:gists_url).filled :string
|
|
18
|
+
required(:gravatar_id).maybe :string
|
|
19
|
+
required(:html_url).filled :string
|
|
20
|
+
required(:id).filled :integer
|
|
21
|
+
required(:login).filled :string
|
|
22
|
+
required(:node_id).filled :string
|
|
23
|
+
required(:organizations_url).filled :string
|
|
24
|
+
required(:received_events_url).filled :string
|
|
25
|
+
required(:repos_url).filled :string
|
|
26
|
+
required(:score).filled :float
|
|
27
|
+
required(:site_admin).filled :bool
|
|
28
|
+
required(:starred_url).filled :string
|
|
29
|
+
required(:subscriptions_url).filled :string
|
|
30
|
+
required(:type).filled :string
|
|
31
|
+
required(:url).filled :string
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ghub
|
|
4
|
+
module Endpoints
|
|
5
|
+
module Search
|
|
6
|
+
module Users
|
|
7
|
+
# Provides access to the search API endpoint for users.
|
|
8
|
+
class Root
|
|
9
|
+
include Dependencies[index_action: "actions.index"]
|
|
10
|
+
|
|
11
|
+
def index(...) = index_action.call(...)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "
|
|
3
|
+
require "pipeable"
|
|
4
4
|
|
|
5
5
|
module Ghub
|
|
6
6
|
module Endpoints
|
|
@@ -8,17 +8,18 @@ module Ghub
|
|
|
8
8
|
module Actions
|
|
9
9
|
# Handles a user index action.
|
|
10
10
|
class Index
|
|
11
|
-
include
|
|
12
|
-
include
|
|
11
|
+
include Ghub::Dependencies[:api]
|
|
12
|
+
include Dependencies[response: "responses.index", model: "models.index"]
|
|
13
|
+
include Pipeable
|
|
13
14
|
|
|
14
15
|
def call **parameters
|
|
15
16
|
pipe(
|
|
16
|
-
|
|
17
|
+
api.get("users", **parameters),
|
|
17
18
|
try(:parse, catch: JSON::ParserError),
|
|
18
19
|
fmap { |body| {body:} },
|
|
19
|
-
validate(response),
|
|
20
|
+
validate(response, as: :to_h),
|
|
20
21
|
as(:fetch, :body),
|
|
21
|
-
map { |item| model.
|
|
22
|
+
map { |item| model.for(**item) }
|
|
22
23
|
)
|
|
23
24
|
end
|
|
24
25
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "
|
|
3
|
+
require "pipeable"
|
|
4
4
|
|
|
5
5
|
module Ghub
|
|
6
6
|
module Endpoints
|
|
@@ -8,14 +8,15 @@ module Ghub
|
|
|
8
8
|
module Actions
|
|
9
9
|
# Handles a user show action.
|
|
10
10
|
class Show
|
|
11
|
-
include
|
|
12
|
-
include
|
|
11
|
+
include Ghub::Dependencies[:api]
|
|
12
|
+
include Dependencies[response: "responses.show", model: "models.show"]
|
|
13
|
+
include Pipeable
|
|
13
14
|
|
|
14
15
|
def call id, **parameters
|
|
15
|
-
pipe
|
|
16
|
+
pipe api.get("users/#{id}", **parameters),
|
|
16
17
|
try(:parse, catch: JSON::ParserError),
|
|
17
|
-
validate(response),
|
|
18
|
-
to(model, :
|
|
18
|
+
validate(response, as: :to_h),
|
|
19
|
+
to(model, :for)
|
|
19
20
|
end
|
|
20
21
|
end
|
|
21
22
|
end
|
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "
|
|
3
|
+
require "containable"
|
|
4
4
|
|
|
5
5
|
module Ghub
|
|
6
6
|
module Endpoints
|
|
7
7
|
module Users
|
|
8
8
|
# Defines user dependencies.
|
|
9
9
|
module Container
|
|
10
|
-
extend
|
|
11
|
-
|
|
12
|
-
merge Ghub::Container
|
|
10
|
+
extend Containable
|
|
13
11
|
|
|
14
12
|
namespace :responses do
|
|
15
|
-
register
|
|
16
|
-
register
|
|
13
|
+
register :index, Responses::Index
|
|
14
|
+
register :show, Responses::Show
|
|
17
15
|
end
|
|
18
16
|
|
|
19
17
|
namespace :models do
|
|
20
|
-
register
|
|
21
|
-
register
|
|
18
|
+
register :index, Models::Index
|
|
19
|
+
register :show, Models::Show
|
|
22
20
|
end
|
|
23
21
|
|
|
24
22
|
namespace :actions do
|
|
@@ -5,7 +5,7 @@ module Ghub
|
|
|
5
5
|
module Users
|
|
6
6
|
# Provides access to the users API endpoint.
|
|
7
7
|
class Root
|
|
8
|
-
include
|
|
8
|
+
include Dependencies[index_action: "actions.index", show_action: "actions.show"]
|
|
9
9
|
|
|
10
10
|
def index(...) = index_action.call(...)
|
|
11
11
|
|
|
@@ -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 attributes
|
|
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 attributes
|
|
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 attributes
|
|
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 attributes
|
|
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,26 +86,32 @@ 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
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
organization: (User[attributes[:organization]] if attributes.key? :organization),
|
|
91
|
+
def self.for **attributes
|
|
92
|
+
new(
|
|
93
|
+
**attributes.transform_keys!(size: :weight),
|
|
94
|
+
license: (License[**Hash(attributes[:license])] if attributes.key? :license),
|
|
95
|
+
owner: User[**attributes[:owner]],
|
|
96
|
+
organization: (User[**attributes[:organization]] if attributes.key? :organization),
|
|
99
97
|
permissions: (
|
|
100
|
-
Permissions::Repository[attributes[:permissions]] if attributes.key? :permissions
|
|
98
|
+
Permissions::Repository[**attributes[:permissions]] if attributes.key? :permissions
|
|
101
99
|
)
|
|
102
100
|
)
|
|
103
101
|
end
|
|
104
102
|
|
|
105
|
-
def initialize
|
|
103
|
+
def initialize(**)
|
|
106
104
|
super
|
|
107
105
|
freeze
|
|
108
106
|
end
|
|
107
|
+
|
|
108
|
+
def archived? = archived == true
|
|
109
|
+
|
|
110
|
+
def forked? = fork == true
|
|
111
|
+
|
|
112
|
+
def private? = private == true
|
|
113
|
+
|
|
114
|
+
def sharable? = !(archived? || forked? || private?)
|
|
109
115
|
end
|
|
110
116
|
end
|
|
111
117
|
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 attributes
|
|
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 attributes
|
|
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 attributes
|
|
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
|