ghub 0.5.1 → 0.6.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 +0 -0
- data/README.adoc +10 -1
- data/ghub.gemspec +1 -1
- data/lib/ghub/client.rb +3 -0
- data/lib/ghub/endpoints/container.rb +1 -0
- data/lib/ghub/endpoints/search/users/actions/index.rb +29 -0
- data/lib/ghub/endpoints/search/users/container.rb +30 -0
- data/lib/ghub/endpoints/search/users/import.rb +13 -0
- data/lib/ghub/endpoints/search/users/models/index.rb +42 -0
- data/lib/ghub/endpoints/search/users/responses/index.rb +38 -0
- data/lib/ghub/endpoints/search/users/root.rb +16 -0
- data.tar.gz.sig +0 -0
- metadata +9 -3
- 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: f9aed02a981477b8bc20274a4da869ab683935bc485091730172199761dc37e1
|
4
|
+
data.tar.gz: 7b4820c235ad4d5a1b4dce5fed56a85913c074f8cd8dc0bfabd66b3feb83c0ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 419083a5181b13bf70256fca5592ef591ed8a790f24d656b3855675b125a3eae0f3f0fcc48f719ddb97ee63b0c50741dbb19f1709dbd28ffbdf104fee476377d
|
7
|
+
data.tar.gz: f6c42ebe746ee9e4b877afdba4bf57e3c0908fff9e588752bea5716b45dbd21946ade15379fa91f631a7ff5c54ac1933eaa3d46917dba29451188a6e4442b609
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/README.adoc
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
= Ghub
|
6
6
|
|
7
|
-
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 instead of link:https://lostisland.github.io/faraday[Faraday] which is what the link:https://github.com/octokit/octokit.rb[Octokit] gem uses.
|
7
|
+
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.
|
8
8
|
|
9
9
|
toc::[]
|
10
10
|
|
@@ -151,6 +151,15 @@ client.repositories.destroy "acme", "ghub-test"
|
|
151
151
|
|
152
152
|
GitHub's API design for repositories is awkward and you can see this infect the Object API, especially when creating a repository. Use `:users` or `:orgs` (can be strings) to distinguish between the two types of repository creation. The only stipulation for organization creation is that you must supply the organization name. This was done so you could use the same Object API for both.
|
153
153
|
|
154
|
+
==== Search
|
155
|
+
|
156
|
+
The following is how to search link:https://docs.github.com/en/rest/search/search#search-users[users]:
|
157
|
+
|
158
|
+
[source,ruby]
|
159
|
+
----
|
160
|
+
client.search_users.index q: "test@example.com"
|
161
|
+
----
|
162
|
+
|
154
163
|
==== Users
|
155
164
|
|
156
165
|
The following is how to link:https://docs.github.com/en/rest/users/users#list-users[index] and link:https://docs.github.com/en/rest/users/users#get-a-user[show] users:
|
data/ghub.gemspec
CHANGED
data/lib/ghub/client.rb
CHANGED
@@ -11,6 +11,7 @@ module Ghub
|
|
11
11
|
organization_members_endpoint: :organization_members,
|
12
12
|
pulls_endpoint: :pulls,
|
13
13
|
repositories_endpoint: :repositories,
|
14
|
+
search_users_endpoint: :search_users,
|
14
15
|
users_endpoint: :users
|
15
16
|
]
|
16
17
|
|
@@ -29,6 +30,8 @@ module Ghub
|
|
29
30
|
|
30
31
|
def repositories = repositories_endpoint
|
31
32
|
|
33
|
+
def search_users = search_users_endpoint
|
34
|
+
|
32
35
|
def users = users_endpoint
|
33
36
|
end
|
34
37
|
end
|
@@ -13,6 +13,7 @@ module Ghub
|
|
13
13
|
register(:organization_members) { Endpoints::Organizations::Members::Root.new }
|
14
14
|
register(:pulls) { Endpoints::Pulls::Root.new }
|
15
15
|
register(:repositories) { Endpoints::Repositories::Root.new }
|
16
|
+
register(:search_users) { Endpoints::Search::Users::Root.new }
|
16
17
|
register(:users) { Endpoints::Users::Root.new }
|
17
18
|
end
|
18
19
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "transactable"
|
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 Import[:client, response: "responses.index", model: "models.index"]
|
13
|
+
include Transactable
|
14
|
+
|
15
|
+
def call **parameters
|
16
|
+
pipe(
|
17
|
+
client.get("search/users", **parameters),
|
18
|
+
try(:parse, catch: JSON::ParserError),
|
19
|
+
validate(response),
|
20
|
+
as(:fetch, :items),
|
21
|
+
map { |item| model.new item.to_h }
|
22
|
+
)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "dry/container"
|
4
|
+
|
5
|
+
module Ghub
|
6
|
+
module Endpoints
|
7
|
+
module Search
|
8
|
+
module Users
|
9
|
+
# Defines user dependencies.
|
10
|
+
module Container
|
11
|
+
extend Dry::Container::Mixin
|
12
|
+
|
13
|
+
merge Ghub::Container
|
14
|
+
|
15
|
+
namespace :responses do
|
16
|
+
register(:index) { Responses::Index }
|
17
|
+
end
|
18
|
+
|
19
|
+
namespace :models do
|
20
|
+
register(:index) { Models::Index }
|
21
|
+
end
|
22
|
+
|
23
|
+
namespace :actions do
|
24
|
+
register(:index) { Actions::Index.new }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,42 @@
|
|
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
|
+
keyword_init: true
|
30
|
+
) do
|
31
|
+
include Resultable
|
32
|
+
|
33
|
+
def initialize *arguments
|
34
|
+
super
|
35
|
+
freeze
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
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 Users::Import[index_action: "actions.index"]
|
10
|
+
|
11
|
+
def index(...) = index_action.call(...)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
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.6.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-
|
38
|
+
date: 2023-07-14 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: dry-container
|
@@ -206,6 +206,12 @@ files:
|
|
206
206
|
- lib/ghub/endpoints/repositories/responses/index.rb
|
207
207
|
- lib/ghub/endpoints/repositories/responses/show.rb
|
208
208
|
- lib/ghub/endpoints/repositories/root.rb
|
209
|
+
- lib/ghub/endpoints/search/users/actions/index.rb
|
210
|
+
- lib/ghub/endpoints/search/users/container.rb
|
211
|
+
- lib/ghub/endpoints/search/users/import.rb
|
212
|
+
- lib/ghub/endpoints/search/users/models/index.rb
|
213
|
+
- lib/ghub/endpoints/search/users/responses/index.rb
|
214
|
+
- lib/ghub/endpoints/search/users/root.rb
|
209
215
|
- lib/ghub/endpoints/users/actions/index.rb
|
210
216
|
- lib/ghub/endpoints/users/actions/show.rb
|
211
217
|
- lib/ghub/endpoints/users/container.rb
|
@@ -276,7 +282,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
276
282
|
- !ruby/object:Gem::Version
|
277
283
|
version: '0'
|
278
284
|
requirements: []
|
279
|
-
rubygems_version: 3.4.
|
285
|
+
rubygems_version: 3.4.17
|
280
286
|
signing_key:
|
281
287
|
specification_version: 4
|
282
288
|
summary: A monadic GitHub API client.
|
metadata.gz.sig
CHANGED
Binary file
|