A parody Ruby gem that randomly selects from installed HTTP client libraries for each request. The module name is AllTheHTTPs (capital HTTP, lowercase s). File names use snake_case all_the_https per Ruby convention.
lib/all_the_https.rb— Main entry point. Defines convenience methods (.get,.post, etc.) that delegate to a sharedClientinstance.lib/all_the_https/version.rb— Gem version constant.lib/all_the_https/response.rb— Normalized response object withstatus,body,headers,adapter_used, andsuccess?.lib/all_the_https/client.rb— Core logic. Discovers available adapters, randomly selects one per request, excludes GET-only adapters from non-GET requests.lib/all_the_https/adapters/— One file per HTTP client library (11 total). Each adapter implementsadapter_name,display_name,available?, andrequest.
Every adapter class must implement:
.adapter_name— Returns a Symbol identifier (e.g.,:net_http).display_name— Human-readable name for the announcement (e.g.,"Net::HTTP").available?— Attemptsrequire, returnstrue/false.request(method, url, headers: {}, body: nil)— Executes the request, returnsAllTheHTTPs::Response
- Lazy loading: Adapters call
requireinsideavailable?and rescueLoadError - GET-only filtering: OpenURI is excluded from non-GET request pools
- Announcement: Each request prints which adapter was chosen to stdout
- Stdlib fallback: Net::HTTP and OpenURI are always available as a baseline
- Uses RSpec + WebMock
- Adapter specs skip themselves if their gem isn't installed (
skip "X not installed" unless described_class.available?) - Client/module specs force a known adapter via
allow(...).to receive(:available_adapters)for determinism AllTheHTTPs.reset!is called inbefore(:each)to clear memoization
- Module:
AllTheHTTPs(notAllTheHttps) - Files:
all_the_https(snake_case) - All adapters are class methods (no instances needed)
- Response is a simple value object (no behavior beyond
success?andinspect)