Skip to content

Create hub gateway example - #14

Merged
iannorriswork merged 8 commits into
mainfrom
example-api-call
Aug 25, 2026
Merged

Create hub gateway example#14
iannorriswork merged 8 commits into
mainfrom
example-api-call

Conversation

@iannorriswork

@iannorriswork iannorriswork commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

examples: create Hub::Gateway Ruby client for FDSH Hub Services

Problem

Integrated applications need a standardized and secure way to communicate with
the Hub Service API. Previously, there was no centralized Ruby implementation
that handled the specific requirements of the Hub environment, such as mTLS
authentication, TLS 1.2 enforcement, OAuth2 token management, and flexible
routing for local testing or environment-specific service paths.

Solution

Created examples/ruby-gateway.rb which implements Hub::Gateway, a comprehensive
Ruby client providing the following features:

  • mTLS Support: Integrated certificate and key loading via OpenSSL,
    supporting HUB_CLIENT_CERT_PATH and HUB_CLIENT_KEY_PATH.
  • Protocol Security: Enforced TLS 1.2 across all API calls to comply
    with security mandates.
  • OAuth2 Flow: Automated client credentials grant flow for token
    acquisition and management.
  • Network Flexibility: Implemented a resolve mechanism to override
    hostname resolution (similar to curl --resolve), enabling local mocking.
  • Configurable Endpoints: Supported environment-specific service paths,
    allowing injection of custom URLs for services like Education Enrollment.
  • Robust Error Handling: Standardized ApiError and AuthenticationError
    classes with explicit validation of SSL artifacts.

Result

This implementation serves as the foundational Ruby client for FDSH Hub
interactions. It simplifies the integration process for consumers by
abstracting connection complexity while ensuring compliance with technical
and security requirements.

Test Plan

Verified the gateway using a series of automated test scripts covering:

  1. Authentication: Validated OAuth2 token fetching and error handling.
  2. SSL/mTLS: Verified that certificates and keys load correctly and that
    the client fails fast with descriptive errors if files are missing.
  3. Routing: Confirmed the resolve logic correctly maps hostnames to
    intended IPs for local tunnel testing.
  4. Configuration: Demonstrated successful injection of custom service
    URLs and environment variables (HUB_*).
  5. Functionality: Verified get_education_enrollment_v1 with a sample
    JSON payload provided in the documentation.

@iannorriswork
iannorriswork requested a review from a team as a code owner August 24, 2026 22:50
@iannorriswork iannorriswork changed the title Example API query Create hub gateway example Aug 24, 2026

@neilmb neilmb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Is there somewhere in a Markdown doc that we should point people to look at these examples?

@iannorriswork
iannorriswork merged commit 75159ff into main Aug 25, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants