ghub 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +1 -3
- data/README.adoc +3 -1
- data/ghub.gemspec +4 -4
- data/lib/ghub/container.rb +5 -5
- data/lib/ghub/endpoints/branches/protection/actions/show.rb +3 -2
- data/lib/ghub/endpoints/branches/protection/actions/update.rb +3 -2
- data/lib/ghub/endpoints/branches/protection/container.rb +5 -7
- data/lib/ghub/endpoints/branches/protection/import.rb +1 -1
- data/lib/ghub/endpoints/branches/protection/models/show.rb +0 -2
- 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 +1 -1
- data/lib/ghub/endpoints/branches/signature/root.rb +5 -4
- data/lib/ghub/endpoints/container.rb +2 -2
- data/lib/ghub/endpoints/import.rb +1 -1
- data/lib/ghub/endpoints/organizations/members/actions/index.rb +3 -2
- data/lib/ghub/endpoints/organizations/members/container.rb +4 -6
- data/lib/ghub/endpoints/organizations/members/import.rb +1 -1
- data/lib/ghub/endpoints/pulls/actions/index.rb +3 -2
- data/lib/ghub/endpoints/pulls/actions/show.rb +3 -2
- data/lib/ghub/endpoints/pulls/container.rb +5 -7
- data/lib/ghub/endpoints/pulls/import.rb +1 -1
- data/lib/ghub/endpoints/pulls/models/show.rb +0 -2
- data/lib/ghub/endpoints/repositories/actions/create.rb +3 -2
- data/lib/ghub/endpoints/repositories/actions/index.rb +3 -8
- data/lib/ghub/endpoints/repositories/actions/patch.rb +3 -2
- data/lib/ghub/endpoints/repositories/actions/show.rb +3 -8
- data/lib/ghub/endpoints/repositories/container.rb +7 -9
- data/lib/ghub/endpoints/repositories/import.rb +1 -1
- data/lib/ghub/endpoints/repositories/root.rb +3 -2
- data/lib/ghub/endpoints/search/users/actions/index.rb +3 -2
- data/lib/ghub/endpoints/search/users/container.rb +4 -6
- data/lib/ghub/endpoints/search/users/import.rb +1 -1
- data/lib/ghub/endpoints/search/users/models/index.rb +0 -2
- data/lib/ghub/endpoints/users/actions/index.rb +3 -2
- data/lib/ghub/endpoints/users/actions/show.rb +3 -2
- data/lib/ghub/endpoints/users/container.rb +6 -8
- data/lib/ghub/endpoints/users/import.rb +1 -1
- data/lib/ghub/endpoints/users/models/index.rb +0 -2
- data/lib/ghub/endpoints/users/models/show.rb +0 -2
- data/lib/ghub/import.rb +1 -1
- data/lib/ghub/models/repository.rb +0 -2
- data.tar.gz.sig +0 -0
- metadata +10 -11
- metadata.gz.sig +0 -0
- data/lib/ghub/resultable.rb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9af667b223b6cf1226e7c2dfe84da54bb2af2d70829467685913c981b1431a16
|
4
|
+
data.tar.gz: 9a5361db7503ff90c1278a4b966e0eca7d679fd6b226cf4dd0c409176a63d6fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 721960e1144b387e89e139989d3394a71b2022ed891c3d1e1295e2f8b878e0668a96db3f8e556de46cb6612fa5b148a58b70f41b7c2f02bf35b530942fa274bf
|
7
|
+
data.tar.gz: 755456f6387e724c510583f30925a95739a35cce2d8bb23e6e4a7d76e4e5feef8310a3d7bf27ad620904527f9c23332cab5d3daeeebc173f7a21fdcbc9e80254
|
checksums.yaml.gz.sig
CHANGED
@@ -1,3 +1 @@
|
|
1
|
-
|
2
|
-
5�u��\�i
|
3
|
-
�j�L�Q�P�_"M���(x:����bO2|�uS��\hc$>��4�zI�U�˩Yt�h���͏`���f��y�B��P
|
1
|
+
6I�:���4��~�Lk��{N�M0���#��h�(�DEC�����6��R��mV��?��4T�5����- 4�M�I�~�*n��$ �������̉ޱ�a�x�~1�����>M<�����x���<�ށ2چ�q��lG�K���x�N��9��<0{q���[��R��b�ǖ+���Έ|��"i�Kb�6���H��o���B����EzgFT� �$�v�p#��n�~^��0|q�/����/�x��!i��^�֥Pf>湪��6���NnJ�{X5��s��,}��iV��u J1��~�Џ�c�x)F'f?���D��B�c�x��m�z�M�q��Q���dk[?wl��j��k�[���],e���ʯ��G�H* �
|
data/README.adoc
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
:toclevels: 5
|
3
3
|
:figure-caption!:
|
4
4
|
|
5
|
+
:pipeable_link: link:https://alchemists.io/projects/pipeable[Pipeable]
|
6
|
+
|
5
7
|
= Ghub
|
6
8
|
|
7
9
|
Ghub is portmanteau (i.e. [g]it + hub = ghub) that provides a GitHub link:https://docs.github.com/en/rest[API] client using a design which leverages link:https://alchemists.io/articles/ruby_function_composition[function composition] and link:https://dry-rb.org/gems/dry-monads[monads]. This gem is built upon the link:https://github.com/httprb/http[HTTP] gem which provides a nicer Object API instead of link:https://lostisland.github.io/faraday[Faraday] which is what the link:https://github.com/octokit/octokit.rb[Octokit] gem uses.
|
@@ -12,7 +14,7 @@ toc::[]
|
|
12
14
|
|
13
15
|
* Provides an API client which is a partial implementation of GitHub's link:https://docs.github.com/en/rest[API].
|
14
16
|
* Provides HTTP request and response verification using link:https://dry-rb.org/gems/dry-schema[Dry Schema].
|
15
|
-
* Uses link:https://alchemists.io/articles/ruby_function_composition[Function Composition] -- coupled with
|
17
|
+
* Uses link:https://alchemists.io/articles/ruby_function_composition[Function Composition] -- coupled with {pipeable_link} -- to process each HTTP request and response.
|
16
18
|
|
17
19
|
== Requirements
|
18
20
|
|
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.12.0"
|
6
6
|
spec.authors = ["Brooke Kuhlmann"]
|
7
7
|
spec.email = ["brooke@alchemists.io"]
|
8
8
|
spec.homepage = "https://alchemists.io/projects/ghub"
|
@@ -23,12 +23,12 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.cert_chain = [Gem.default_cert_path]
|
24
24
|
|
25
25
|
spec.required_ruby_version = "~> 3.3"
|
26
|
-
spec.add_dependency "
|
26
|
+
spec.add_dependency "containable", "~> 0.0"
|
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", "~> 3.
|
31
|
-
spec.add_dependency "pipeable", "~> 0.
|
30
|
+
spec.add_dependency "infusible", "~> 3.5"
|
31
|
+
spec.add_dependency "pipeable", "~> 0.2"
|
32
32
|
spec.add_dependency "refinements", "~> 12.1"
|
33
33
|
spec.add_dependency "zeitwerk", "~> 2.6"
|
34
34
|
|
data/lib/ghub/container.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "
|
3
|
+
require "containable"
|
4
4
|
require "http"
|
5
5
|
|
6
6
|
module Ghub
|
7
7
|
# Defines application dependencies.
|
8
8
|
module Container
|
9
|
-
extend
|
9
|
+
extend Containable
|
10
10
|
|
11
|
-
register(:configuration
|
12
|
-
register
|
13
|
-
register(:
|
11
|
+
register(:configuration) { Configuration::Loader.new.call }
|
12
|
+
register :http, HTTP
|
13
|
+
register(:api) { API::Client.new }
|
14
14
|
end
|
15
15
|
end
|
@@ -9,12 +9,13 @@ module Ghub
|
|
9
9
|
module Actions
|
10
10
|
# Handles a branch projection show action.
|
11
11
|
class Show
|
12
|
-
include
|
12
|
+
include Ghub::Import[:api]
|
13
|
+
include Protection::Import[response: "responses.show", model: "models.show"]
|
13
14
|
include Pipeable
|
14
15
|
|
15
16
|
def call owner, repository, branch, **parameters
|
16
17
|
pipe(
|
17
|
-
|
18
|
+
api.get(
|
18
19
|
"repos/#{owner}/#{repository}/branches/#{branch}/protection",
|
19
20
|
**parameters
|
20
21
|
),
|
@@ -9,8 +9,9 @@ module Ghub
|
|
9
9
|
module Actions
|
10
10
|
# Handles a branch projection update action.
|
11
11
|
class Update
|
12
|
+
include Ghub::Import[:api]
|
13
|
+
|
12
14
|
include Protection::Import[
|
13
|
-
:client,
|
14
15
|
request: "requests.update",
|
15
16
|
response: "responses.show",
|
16
17
|
model: "models.show"
|
@@ -24,7 +25,7 @@ module Ghub
|
|
24
25
|
validate(request),
|
25
26
|
insert("repos/#{owner}/#{repository}/branches/#{branch}/protection", at: 0),
|
26
27
|
insert(parameters),
|
27
|
-
to(
|
28
|
+
to(api, :put),
|
28
29
|
try(:parse, catch: JSON::ParserError),
|
29
30
|
validate(response),
|
30
31
|
to(model, :for)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "
|
3
|
+
require "containable"
|
4
4
|
|
5
5
|
module Ghub
|
6
6
|
module Endpoints
|
@@ -8,20 +8,18 @@ module Ghub
|
|
8
8
|
module Protection
|
9
9
|
# Defines branch protection dependencies.
|
10
10
|
module Container
|
11
|
-
extend
|
12
|
-
|
13
|
-
merge Ghub::Container
|
11
|
+
extend Containable
|
14
12
|
|
15
13
|
namespace :requests do
|
16
|
-
register
|
14
|
+
register :update, Requests::Update
|
17
15
|
end
|
18
16
|
|
19
17
|
namespace :responses do
|
20
|
-
register
|
18
|
+
register :show, Responses::Show
|
21
19
|
end
|
22
20
|
|
23
21
|
namespace :models do
|
24
|
-
register
|
22
|
+
register :show, Models::Show
|
25
23
|
end
|
26
24
|
|
27
25
|
namespace :actions do
|
@@ -6,18 +6,15 @@ module Ghub
|
|
6
6
|
module Protection
|
7
7
|
# Provides access to the branch protection API endpoint.
|
8
8
|
class Root
|
9
|
-
include
|
10
|
-
|
11
|
-
show_action: "actions.show",
|
12
|
-
update_action: "actions.update"
|
13
|
-
]
|
9
|
+
include Ghub::Import[:api]
|
10
|
+
include Protection::Import[show_action: "actions.show", update_action: "actions.update"]
|
14
11
|
|
15
12
|
def show(...) = show_action.call(...)
|
16
13
|
|
17
14
|
def update(...) = update_action.call(...)
|
18
15
|
|
19
16
|
def destroy owner, repository, branch
|
20
|
-
|
17
|
+
api.delete "repos/#{owner}/#{repository}/branches/#{branch}/protection"
|
21
18
|
end
|
22
19
|
end
|
23
20
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "
|
3
|
+
require "containable"
|
4
4
|
|
5
5
|
module Ghub
|
6
6
|
module Endpoints
|
@@ -8,16 +8,14 @@ module Ghub
|
|
8
8
|
module Signature
|
9
9
|
# Defines branch signature dependencies.
|
10
10
|
module Container
|
11
|
-
extend
|
12
|
-
|
13
|
-
merge Ghub::Container
|
11
|
+
extend Containable
|
14
12
|
|
15
13
|
namespace :responses do
|
16
|
-
register
|
14
|
+
register :show, Ghub::Responses::BooleanLink
|
17
15
|
end
|
18
16
|
|
19
17
|
namespace :models do
|
20
|
-
register
|
18
|
+
register :show, Ghub::Models::BooleanLink
|
21
19
|
end
|
22
20
|
end
|
23
21
|
end
|
@@ -8,7 +8,8 @@ module Ghub
|
|
8
8
|
module Signature
|
9
9
|
# Provides access to the branch signature API endpoint.
|
10
10
|
class Root
|
11
|
-
include
|
11
|
+
include Ghub::Import[:api]
|
12
|
+
include Signature::Import[response: "responses.show", model: "models.show"]
|
12
13
|
include Pipeable
|
13
14
|
|
14
15
|
PATH = "repos/%<owner>s/%<repository>s/branches/%<branch>s/protection/required_signatures"
|
@@ -20,7 +21,7 @@ module Ghub
|
|
20
21
|
|
21
22
|
def show owner, repository, branch
|
22
23
|
pipe format(path, owner:, repository:, branch:),
|
23
|
-
to(
|
24
|
+
to(api, :get),
|
24
25
|
try(:parse, catch: JSON::ParserError),
|
25
26
|
validate(response),
|
26
27
|
to(model, :for)
|
@@ -28,14 +29,14 @@ module Ghub
|
|
28
29
|
|
29
30
|
def create owner, repository, branch
|
30
31
|
pipe format(path, owner:, repository:, branch:),
|
31
|
-
to(
|
32
|
+
to(api, :post),
|
32
33
|
try(:parse, catch: JSON::ParserError),
|
33
34
|
validate(response),
|
34
35
|
to(model, :for)
|
35
36
|
end
|
36
37
|
|
37
38
|
def destroy owner, repository, branch
|
38
|
-
|
39
|
+
api.delete format(path, owner:, repository:, branch:)
|
39
40
|
end
|
40
41
|
|
41
42
|
private
|
@@ -1,12 +1,12 @@
|
|
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
|
# Defines endpoint dependencies.
|
8
8
|
module Container
|
9
|
-
extend
|
9
|
+
extend Containable
|
10
10
|
|
11
11
|
register(:branch_protection) { Endpoints::Branches::Protection::Root.new }
|
12
12
|
register(:branch_signature) { Endpoints::Branches::Signature::Root.new }
|
@@ -9,14 +9,15 @@ module Ghub
|
|
9
9
|
module Actions
|
10
10
|
# Handles an organization member index action.
|
11
11
|
class Index
|
12
|
-
include
|
12
|
+
include Ghub::Import[:api]
|
13
|
+
include Members::Import[response: "responses.index", model: "models.show"]
|
13
14
|
include Pipeable
|
14
15
|
|
15
16
|
def call owner, **parameters
|
16
17
|
pipe(
|
17
18
|
"orgs/#{owner}/members",
|
18
19
|
insert(parameters),
|
19
|
-
to(
|
20
|
+
to(api, :get),
|
20
21
|
try(:parse, catch: JSON::ParserError),
|
21
22
|
fmap { |body| {body:} },
|
22
23
|
validate(response),
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "
|
3
|
+
require "containable"
|
4
4
|
|
5
5
|
module Ghub
|
6
6
|
module Endpoints
|
@@ -8,16 +8,14 @@ module Ghub
|
|
8
8
|
module Members
|
9
9
|
# Defines member dependencies.
|
10
10
|
module Container
|
11
|
-
extend
|
12
|
-
|
13
|
-
merge Ghub::Container
|
11
|
+
extend Containable
|
14
12
|
|
15
13
|
namespace :responses do
|
16
|
-
register
|
14
|
+
register :index, Responses::Index
|
17
15
|
end
|
18
16
|
|
19
17
|
namespace :models do
|
20
|
-
register
|
18
|
+
register :show, Ghub::Models::User
|
21
19
|
end
|
22
20
|
|
23
21
|
namespace :actions do
|
@@ -8,12 +8,13 @@ module Ghub
|
|
8
8
|
module Actions
|
9
9
|
# Handles a repository index action.
|
10
10
|
class Index
|
11
|
-
include
|
11
|
+
include Ghub::Import[:api]
|
12
|
+
include Pulls::Import[response: "responses.index", model: "models.show"]
|
12
13
|
include Pipeable
|
13
14
|
|
14
15
|
def call owner, repository, **parameters
|
15
16
|
pipe(
|
16
|
-
|
17
|
+
api.get("repos/#{owner}/#{repository}/pulls", **parameters),
|
17
18
|
try(:parse, catch: JSON::ParserError),
|
18
19
|
fmap { |body| {body:} },
|
19
20
|
validate(response),
|
@@ -8,12 +8,13 @@ module Ghub
|
|
8
8
|
module Actions
|
9
9
|
# Handles a repository index action.
|
10
10
|
class Show
|
11
|
-
include
|
11
|
+
include Ghub::Import[:api]
|
12
|
+
include Pulls::Import[response: "responses.show", model: "models.show"]
|
12
13
|
include Pipeable
|
13
14
|
|
14
15
|
def call owner, repository, id, **parameters
|
15
16
|
pipe(
|
16
|
-
|
17
|
+
api.get("repos/#{owner}/#{repository}/pulls/#{id}", **parameters),
|
17
18
|
try(:parse, catch: JSON::ParserError),
|
18
19
|
validate(response),
|
19
20
|
to(model, :for)
|
@@ -1,23 +1,21 @@
|
|
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 Pulls
|
8
8
|
# Defines pull request 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
|
18
|
+
register :show, Models::Show
|
21
19
|
end
|
22
20
|
|
23
21
|
namespace :actions do
|
@@ -8,8 +8,9 @@ module Ghub
|
|
8
8
|
module Actions
|
9
9
|
# Handles a repository create action.
|
10
10
|
class Create
|
11
|
+
include Ghub::Import[:api]
|
12
|
+
|
11
13
|
include Import[
|
12
|
-
:client,
|
13
14
|
:path,
|
14
15
|
request: "requests.create",
|
15
16
|
response: "responses.show",
|
@@ -24,7 +25,7 @@ module Ghub
|
|
24
25
|
validate(request),
|
25
26
|
insert(url_path, at: 0),
|
26
27
|
insert(parameters),
|
27
|
-
to(
|
28
|
+
to(api, :post),
|
28
29
|
try(:parse, catch: JSON::ParserError),
|
29
30
|
validate(response),
|
30
31
|
to(model, :for)
|
@@ -8,20 +8,15 @@ module Ghub
|
|
8
8
|
module Actions
|
9
9
|
# Handles a repository index action.
|
10
10
|
class Index
|
11
|
-
include
|
12
|
-
|
13
|
-
:path,
|
14
|
-
response: "responses.index",
|
15
|
-
model: "models.show"
|
16
|
-
]
|
17
|
-
|
11
|
+
include Ghub::Import[:api]
|
12
|
+
include Repositories::Import[:path, response: "responses.index", model: "models.show"]
|
18
13
|
include Pipeable
|
19
14
|
|
20
15
|
def call kind, owner, **parameters
|
21
16
|
pipe(
|
22
17
|
path.index(kind, owner),
|
23
18
|
insert(parameters),
|
24
|
-
to(
|
19
|
+
to(api, :get),
|
25
20
|
try(:parse, catch: JSON::ParserError),
|
26
21
|
fmap { |body| {body:} },
|
27
22
|
validate(response),
|
@@ -8,8 +8,9 @@ module Ghub
|
|
8
8
|
module Actions
|
9
9
|
# Handles a repository patch action.
|
10
10
|
class Patch
|
11
|
+
include Ghub::Import[:api]
|
12
|
+
|
11
13
|
include Import[
|
12
|
-
:client,
|
13
14
|
:path,
|
14
15
|
request: "requests.patch",
|
15
16
|
response: "responses.show",
|
@@ -24,7 +25,7 @@ module Ghub
|
|
24
25
|
validate(request),
|
25
26
|
insert(url_path, at: 0),
|
26
27
|
insert(parameters),
|
27
|
-
to(
|
28
|
+
to(api, :patch),
|
28
29
|
try(:parse, catch: JSON::ParserError),
|
29
30
|
validate(response),
|
30
31
|
to(model, :for)
|
@@ -8,19 +8,14 @@ module Ghub
|
|
8
8
|
module Actions
|
9
9
|
# Handles a repository show action.
|
10
10
|
class Show
|
11
|
-
include
|
12
|
-
|
13
|
-
:path,
|
14
|
-
response: "responses.show",
|
15
|
-
model: "models.show"
|
16
|
-
]
|
17
|
-
|
11
|
+
include Ghub::Import[:api]
|
12
|
+
include Repositories::Import[:path, response: "responses.show", model: "models.show"]
|
18
13
|
include Pipeable
|
19
14
|
|
20
15
|
def call owner, id, **parameters
|
21
16
|
pipe path.show(owner, id),
|
22
17
|
insert(parameters),
|
23
|
-
to(
|
18
|
+
to(api, :get),
|
24
19
|
try(:parse, catch: JSON::ParserError),
|
25
20
|
validate(response),
|
26
21
|
to(model, :for)
|
@@ -1,28 +1,26 @@
|
|
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 Repositories
|
8
8
|
# Defines repository dependencies.
|
9
9
|
module Container
|
10
|
-
extend
|
11
|
-
|
12
|
-
merge Ghub::Container
|
10
|
+
extend Containable
|
13
11
|
|
14
12
|
namespace :requests do
|
15
|
-
register
|
16
|
-
register
|
13
|
+
register :create, Requests::Create
|
14
|
+
register :patch, Requests::Patch
|
17
15
|
end
|
18
16
|
|
19
17
|
namespace :responses do
|
20
|
-
register
|
21
|
-
register
|
18
|
+
register :index, Responses::Index
|
19
|
+
register :show, Ghub::Responses::Repository
|
22
20
|
end
|
23
21
|
|
24
22
|
namespace :models do
|
25
|
-
register
|
23
|
+
register :show, Ghub::Models::Repository
|
26
24
|
end
|
27
25
|
|
28
26
|
register(:path) { Path.new }
|
@@ -5,8 +5,9 @@ module Ghub
|
|
5
5
|
module Repositories
|
6
6
|
# Provides access to the users API endpoint.
|
7
7
|
class Root
|
8
|
+
include Ghub::Import[:api]
|
9
|
+
|
8
10
|
include Repositories::Import[
|
9
|
-
:client,
|
10
11
|
create_action: "actions.create",
|
11
12
|
index_action: "actions.index",
|
12
13
|
patch_action: "actions.patch",
|
@@ -21,7 +22,7 @@ module Ghub
|
|
21
22
|
|
22
23
|
def patch(...) = patch_action.call(...)
|
23
24
|
|
24
|
-
def destroy(owner, id) =
|
25
|
+
def destroy(owner, id) = api.delete "repos/#{owner}/#{id}"
|
25
26
|
end
|
26
27
|
end
|
27
28
|
end
|
@@ -9,12 +9,13 @@ module Ghub
|
|
9
9
|
module Actions
|
10
10
|
# Handles a user index action.
|
11
11
|
class Index
|
12
|
-
include Import[:
|
12
|
+
include Ghub::Import[:api]
|
13
|
+
include Import[response: "responses.index", model: "models.index"]
|
13
14
|
include Pipeable
|
14
15
|
|
15
16
|
def call **parameters
|
16
17
|
pipe(
|
17
|
-
|
18
|
+
api.get("search/users", **parameters),
|
18
19
|
try(:parse, catch: JSON::ParserError),
|
19
20
|
validate(response),
|
20
21
|
as(:fetch, :items),
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "
|
3
|
+
require "containable"
|
4
4
|
|
5
5
|
module Ghub
|
6
6
|
module Endpoints
|
@@ -8,16 +8,14 @@ module Ghub
|
|
8
8
|
module Users
|
9
9
|
# Defines user dependencies.
|
10
10
|
module Container
|
11
|
-
extend
|
12
|
-
|
13
|
-
merge Ghub::Container
|
11
|
+
extend Containable
|
14
12
|
|
15
13
|
namespace :responses do
|
16
|
-
register
|
14
|
+
register :index, Responses::Index
|
17
15
|
end
|
18
16
|
|
19
17
|
namespace :models do
|
20
|
-
register
|
18
|
+
register :index, Models::Index
|
21
19
|
end
|
22
20
|
|
23
21
|
namespace :actions do
|
@@ -8,12 +8,13 @@ module Ghub
|
|
8
8
|
module Actions
|
9
9
|
# Handles a user index action.
|
10
10
|
class Index
|
11
|
-
include
|
11
|
+
include Ghub::Import[:api]
|
12
|
+
include Users::Import[response: "responses.index", model: "models.index"]
|
12
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
20
|
validate(response),
|
@@ -8,11 +8,12 @@ module Ghub
|
|
8
8
|
module Actions
|
9
9
|
# Handles a user show action.
|
10
10
|
class Show
|
11
|
-
include
|
11
|
+
include Ghub::Import[:api]
|
12
|
+
include Users::Import[response: "responses.show", model: "models.show"]
|
12
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
18
|
validate(response),
|
18
19
|
to(model, :for)
|
@@ -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
|
data/lib/ghub/import.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.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -35,22 +35,22 @@ cert_chain:
|
|
35
35
|
3n5C8/6Zh9DYTkpcwPSuIfAga6wf4nXc9m6JAw8AuMLaiWN/r/2s4zJsUHYERJEu
|
36
36
|
gZGm4JqtuSg8pYjPeIJxS960owq+SfuC+jxqmRA54BisFCv/0VOJi7tiJVY=
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2024-03
|
38
|
+
date: 2024-04-03 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
|
-
name:
|
41
|
+
name: containable
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '0.
|
46
|
+
version: '0.0'
|
47
47
|
type: :runtime
|
48
48
|
prerelease: false
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '0.
|
53
|
+
version: '0.0'
|
54
54
|
- !ruby/object:Gem::Dependency
|
55
55
|
name: dry-monads
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
@@ -99,28 +99,28 @@ dependencies:
|
|
99
99
|
requirements:
|
100
100
|
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: '3.
|
102
|
+
version: '3.5'
|
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: '3.
|
109
|
+
version: '3.5'
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
111
|
name: pipeable
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
114
|
- - "~>"
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version: '0.
|
116
|
+
version: '0.2'
|
117
117
|
type: :runtime
|
118
118
|
prerelease: false
|
119
119
|
version_requirements: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
121
|
- - "~>"
|
122
122
|
- !ruby/object:Gem::Version
|
123
|
-
version: '0.
|
123
|
+
version: '0.2'
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
125
|
name: refinements
|
126
126
|
requirement: !ruby/object:Gem::Requirement
|
@@ -255,7 +255,6 @@ files:
|
|
255
255
|
- lib/ghub/responses/status_check.rb
|
256
256
|
- lib/ghub/responses/team.rb
|
257
257
|
- lib/ghub/responses/user.rb
|
258
|
-
- lib/ghub/resultable.rb
|
259
258
|
homepage: https://alchemists.io/projects/ghub
|
260
259
|
licenses:
|
261
260
|
- Hippocratic-2.1
|
@@ -282,7 +281,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
282
281
|
- !ruby/object:Gem::Version
|
283
282
|
version: '0'
|
284
283
|
requirements: []
|
285
|
-
rubygems_version: 3.5.
|
284
|
+
rubygems_version: 3.5.7
|
286
285
|
signing_key:
|
287
286
|
specification_version: 4
|
288
287
|
summary: A monadic GitHub API client.
|
metadata.gz.sig
CHANGED
Binary file
|
data/lib/ghub/resultable.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Ghub
|
4
|
-
# Allows a model to be callable, frozen, and cast itself as a monad to be processed as a result.
|
5
|
-
module Resultable
|
6
|
-
include Dry::Monads[:result]
|
7
|
-
|
8
|
-
def self.included descendant
|
9
|
-
super
|
10
|
-
descendant.extend ClassMethods
|
11
|
-
end
|
12
|
-
|
13
|
-
# Allows an object to be callable via a class method.
|
14
|
-
module ClassMethods
|
15
|
-
def call(...) = new(...)
|
16
|
-
end
|
17
|
-
|
18
|
-
def to_monad = Success self
|
19
|
-
end
|
20
|
-
end
|