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/). |
✅ |
HttpClient → Request 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.1 → 1.2.0. |
✅ |
| Gap analysis doc |
Added docs/gap_analysis.md analyzing how this gem fits into core-api's payment gateway framework. |
✅ |
Synopsis
Refactoring pass over the
rail0-rubygem: idiom cleanup, HTTP/logging layer restructuring, and docs/test hygiene. No public API removed; behavior verified against the full spec suite after each change.sign_charge/sign_authorizeandStablecoinstoken filters; consolidated scatteredattr_readercalls; fixedrescue LoadError; raise LoadErrorto rebind and re-raise the caught error.@param/@return.Rakefile(default task runs specs); switched.rspecto theprogress(dots) formatter.require_relativewithrequire+ explicit$LOAD_PATHentries (lib/,lib/rail0/,lib/rail0/resources/).HttpClient→RequestextractionHttpClient#requestinto a dedicatedRail0::Requestclass;HttpClientis now a thin per-verb facade.DEBUG_LOGGERlambda withRail0::DefaultLogger(a realLoggersubclass) andRail0::NullLogger; added shared frozenRail0::DEFAULT_LOGGER/Rail0::NULL_LOGGERconstants to avoid re-allocating.while/attempt += 1loop withbegin/rescue/retrywrapped in awith_retriesblock method; extracted the rescued exception list into anERRORSconstant.Requestnowextend Forwardable/def_delegatorsfor the client's config (base_url,headers,timeout,logger,max_retries,retry_delay) instead of repeatedclient.foochains.HttpClient#perform→#request;Request#do_request→#prepare.attr_readervisibility/placementinitializein every class, instead of trailing after aprivateblock.required_ruby_versionto>= 3.0, matching theethgem's own floor.eth/siwe-rb's own$VERBOSEwarning noise during their lazyrequire, without affecting warnings from this gem's own code.StablecoinInfo#bridged,DefaultLogger, andNullLogger.Rail0::VERSION1.1.1→1.2.0.docs/gap_analysis.mdanalyzing how this gem fits into core-api's payment gateway framework.