Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.2%) to scientific vocabulary
Keywords
api
client
git
github
Last synced: 4 months ago
·
JSON representation
·
Repository
A monadic GitHub API client.
Basic Info
- Host: GitHub
- Owner: bkuhlmann
- License: other
- Language: Ruby
- Default Branch: main
- Homepage: https://alchemists.io/projects/ghub
- Size: 375 KB
Statistics
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
- Releases: 0
Topics
api
client
git
github
Created about 3 years ago
· Last pushed 4 months ago
Metadata Files
Readme
Funding
License
Citation
README.adoc
:toc: macro
:toclevels: 5
:figure-caption!:
:pipeable_link: link:https://alchemists.io/projects/pipeable[Pipeable]
= Ghub
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.
toc::[]
== Features
* Provides an API client which is a partial implementation of GitHub's link:https://docs.github.com/en/rest[API].
* Provides HTTP request and response verification using link:https://dry-rb.org/gems/dry-schema[Dry Schema].
* Uses link:https://alchemists.io/articles/ruby_function_composition[Function Composition] -- coupled with {pipeable_link} -- to process each HTTP request and response.
== Requirements
. link:https://www.ruby-lang.org[Ruby].
. link:https://github.com[GitHub].
== Setup
To set up the project, run:
[source,bash]
----
bin/setup
----
== Usage
All usage is via the `Ghub::Client` class.
=== Initialization
You can initialize an API client -- using the defaults as described in the _Environment_ section below -- as follows:
[source,ruby]
----
client = Ghub::Client.new
----
Further customization can be done via a block:
[source,ruby]
----
client = Ghub::Client.new do |config|
config.accept = "application/json" # Uses a custom HTTP Accept header.
config.paginate = true # Enabled automatic pagination.
config.token = "ghp_abc" # Provides a Personal Access Token (PAT).
config.url = "https://alt.github.com" # Uses a custom API root.
end
----
=== Environment
Environment variable support can be managed using link:https://direnv.net[direnv]. These are the defaults:
[source,bash]
----
GITHUB_API_ACCEPT=application/vnd.github+json
GITHUB_API_PAGINATE=false
GITHUB_API_TOKEN=
GITHUB_API_URL=https://api.github.com
----
_You must provide a value for `GITHUB_API_TOKEN` in order to make authenticated API requests._ This can be done by creating a link:https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token[Personal Access Token (PAT)] for the value.
=== Endpoints
Only partial support of the various API endpoints are supported. Each section below documents usage with additional documentation, usage, parameters, responses, etc. provided by the official GitHub API documentation links.
==== Branch Protection
The following is an example of how to link:https://docs.github.com/en/rest/branches/branch-protection#get-branch-protection[show], link:https://docs.github.com/en/rest/branches/branch-protection#update-branch-protection[update], and link:https://docs.github.com/en/rest/branches/branch-protection#delete-branch-protection[destroy] branch protection:
[source,ruby]
----
client.branch_protection.show "", "", ""
client.branch_protection.update "", "", "", {}
client.branch_protection.destroy "", "", ""
----
==== Branch Signature
The following is an example of how to link:https://docs.github.com/en/rest/branches/branch-protection#get-commit-signature-protection[show], link:https://docs.github.com/en/rest/branches/branch-protection#create-commit-signature-protection[create], and link:https://docs.github.com/en/rest/branches/branch-protection#delete-commit-signature-protection[destroy] branch signature protection:
[source,ruby]
----
client.branch_signature.show "", "", ""
client.branch_signature.create "", "", ""
client.branch_signature.destroy "", "", ""
----
==== Organization Members
The following is how to link:https://docs.github.com/en/rest/orgs/members#list-organization-members[index] organization members.
[source,ruby]
----
client.organization_members.index ""
----
==== Pulls
The following is how to link:https://docs.github.com/en/rest/pulls/pulls#list-pull-requests[index] and link:https://docs.github.com/en/rest/pulls/pulls#get-a-pull-request[show] pull requests:
[source,ruby]
----
client.pulls.index "", ""
client.pulls.show "", "",
----
==== Repositories
The following documents how to interact with repositories:
* link:https://docs.github.com/en/rest/repos/repos#list-repositories-for-a-user[Index] (users)
* link:https://docs.github.com/en/rest/repos/repos#list-organization-repositories[Index] (organizations)
* link:https://docs.github.com/en/rest/repos/repos#get-a-repository[Show]
* link:https://docs.github.com/en/rest/repos/repos#create-a-repository-for-the-authenticated-user[Create] (user)
* link:https://docs.github.com/en/rest/repos/repos#create-an-organization-repository[Create] (organization)
* link:https://docs.github.com/en/rest/repos/repos#update-a-repository[Update]
* link:https://docs.github.com/en/rest/repos/repos#delete-a-repository[Destroy]
[source,ruby]
----
# Index (user and organization)
# Format: client.repositories.index :, ""
client.repositories.index :users, "doe"
client.repositories.index :orgs, "acme"
# Show (user or organization)
# Format: client.repositories.show "", ""
client.repositories.show "acme", "ghub-test"
# Create (user and organization)
# Format: client.repositories.create :,
client.repositories.create :users, {name: "ghub-test", private: true}
client.repositories.create :orgs, {name: "ghub-test", private: true}, owner: "acme"
# Patch (user or organization)
# Format: client.repositories.patch "", "",
client.repositories.patch "acme", "ghub-test", {description: "For test only."}
# Destroy (user or organization)
# Format: client.repositories.destroy "", ""
client.repositories.destroy "acme", "ghub-test"
----
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.
==== Search
The following is how to search link:https://docs.github.com/en/rest/search/search#search-users[users]:
[source,ruby]
----
client.search_users.index q: "test@example.com"
----
==== Users
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:
[source,ruby]
----
client.users.index
client.users.show ""
----
== Development
To contribute, run:
[source,bash]
----
git clone https://github.com/bkuhlmann/ghub
cd ghub
bin/setup
----
You can also use the IRB console for direct access to all objects:
[source,bash]
----
bin/console
----
== Tests
To test, run:
[source,bash]
----
bin/rake
----
== link:https://alchemists.io/policies/license[License]
== link:https://alchemists.io/policies/security[Security]
== link:https://alchemists.io/policies/code_of_conduct[Code of Conduct]
== link:https://alchemists.io/policies/contributions[Contributions]
== link:https://alchemists.io/policies/developer_certificate_of_origin[Developer Certificate of Origin]
== link:https://alchemists.io/projects/ghub/versions[Versions]
== link:https://alchemists.io/community[Community]
== Credits
* Built with link:https://alchemists.io/projects/gemsmith[Gemsmith].
* Engineered by link:https://alchemists.io/team/brooke_kuhlmann[Brooke Kuhlmann].
Owner
- Name: Brooke Kuhlmann
- Login: bkuhlmann
- Kind: user
- Location: Boulder, CO USA
- Company: Alchemists
- Website: https://alchemists.io
- Repositories: 56
- Profile: https://github.com/bkuhlmann
Quality over quantity.
Citation (CITATION.cff)
cff-version: 1.2.0
message: Please use the following metadata when citing this project in your work.
title: Ghub
abstract: A monadic GitHub API client.
version: 0.27.0
license: Hippocratic-2.1
date-released: 2025-08-10
authors:
- family-names: Kuhlmann
given-names: Brooke
affiliation: Alchemists
orcid: https://orcid.org/0000-0002-5810-6268
keywords:
- ruby
- git
- github
repository-code: https://github.com/bkuhlmann/ghub
repository-artifact: https://rubygems.org/gems/ghub
url: https://alchemists.io/projects/ghub
GitHub Events
Total
- Watch event: 2
- Delete event: 58
- Push event: 41
- Create event: 13
Last Year
- Watch event: 2
- Delete event: 58
- Push event: 41
- Create event: 13
Committers
Last synced: almost 3 years ago
All Time
- Total Commits: 63
- Total Committers: 1
- Avg Commits per committer: 63.0
- Development Distribution Score (DDS): 0.0
Top Committers
| Name | Commits | |
|---|---|---|
| Brooke Kuhlmann | b****e@a****o | 63 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 4 months ago
All Time
- Total issues: 0
- Total pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 0
- Total pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- rubygems 14,800 total
- Total dependent packages: 1
- Total dependent repositories: 0
- Total versions: 34
- Total maintainers: 1
rubygems.org: ghub
A monadic GitHub API client.
- Homepage: https://alchemists.io/projects/ghub
- Documentation: http://www.rubydoc.info/gems/ghub/
- License: Hippocratic-2.1
-
Latest release: 0.27.0
published 5 months ago
Rankings
Dependent packages count: 7.7%
Stargazers count: 29.2%
Forks count: 31.4%
Average: 42.3%
Dependent repos count: 46.8%
Downloads: 96.5%
Maintainers (1)
Funding
- https://github.com/sponsors/bkuhlmann
Last synced:
4 months ago
Dependencies
Gemfile
rubygems
- amazing_print ~> 1.4 development
- caliber ~> 0.16 development
- debug ~> 1.6 development
- git-lint ~> 4.0 development
- guard-rspec ~> 4.7 development
- http-fake ~> 0.0 development
- rake ~> 13.0 development
- reek ~> 6.1 development
- rspec ~> 3.11 development
- simplecov ~> 0.21 development
ghub.gemspec
rubygems
- dry-container ~> 0.11
- dry-monads ~> 1.5
- dry-schema ~> 1.11
- http ~> 5.1
- infusible ~> 0.2
- refinements ~> 9.7
- transactable ~> 0.2
- zeitwerk ~> 2.6