Skip to content

Refactoring #1

Description

@mkcosta

Synopsis

Refactoring pass over the rail0-ruby gem: idiom cleanup, HTTP/logging layer restructuring, and docs/test hygiene. No public API removed; behavior verified against the full spec suite after each change.

Item Info
CLAUDE.md docs Added Commands and Architecture sections.
Ruby idiom cleanup Deduplicated sign_charge/sign_authorize and Stablecoins token filters; consolidated scattered attr_reader calls; fixed rescue LoadError; raise LoadError to rebind and re-raise the caught error.
Comment cleanup Stripped inline implementation comments and section dividers repo-wide; kept class/module docs and YARD @param/@return.
Rakefile + rspec format Added Rakefile (default task runs specs); switched .rspec to the progress (dots) formatter.
Require style Replaced require_relative with require + explicit $LOAD_PATH entries (lib/, lib/rail0/, lib/rail0/resources/).
HttpClientRequest extraction Split the retry/pagination/error-mapping/logging logic out of HttpClient#request into a dedicated Rail0::Request class; HttpClient is now a thin per-verb facade.
Logging redesign Replaced the DEBUG_LOGGER lambda with Rail0::DefaultLogger (a real Logger subclass) and Rail0::NullLogger; added shared frozen Rail0::DEFAULT_LOGGER/Rail0::NULL_LOGGER constants to avoid re-allocating.
Retry loop rewrite Replaced the manual while/attempt += 1 loop with begin/rescue/retry wrapped in a with_retries block method; extracted the rescued exception list into an ERRORS constant.
Delegation cleanup Request now extend Forwardable/def_delegators for the client's config (base_url, headers, timeout, logger, max_retries, retry_delay) instead of repeated client.foo chains.
Naming HttpClient#perform#request; Request#do_request#prepare.
attr_reader visibility/placement Made public (no encapsulation need) and moved to sit right above initialize in every class, instead of trailing after a private block.
Ruby version floor Raised required_ruby_version to >= 3.0, matching the eth gem's own floor.
Warning suppression Silenced eth/siwe-rb's own $VERBOSE warning noise during their lazy require, without affecting warnings from this gem's own code.
Test coverage Added specs for StablecoinInfo#bridged, DefaultLogger, and NullLogger.
Version bump Rail0::VERSION 1.1.11.2.0.
Gap analysis doc Added docs/gap_analysis.md analyzing how this gem fits into core-api's payment gateway framework.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions