Skip to content

Modernise for 1.0: Faraday client, typed errors, Ruby 3.2+ - #9

Closed
woodhull wants to merge 1 commit into
mainfrom
modernise
Closed

woodhull wants to merge 1 commit into
mainfrom
modernise

Conversation

@woodhull

Copy link
Copy Markdown
Member

Brings the gem up to date so agra can move to json 3. The old gem pinned json ~> 2.1.

What changes

  • Faraday 2 in place of oauth2. Agra does the OAuth handshake itself and only passes a stored access token, so the client now just sends Authorization: Bearer. The password grant, client_id/client_secret and the old oauth2 fork in the Gemfile are gone.
  • Typed errors. Every non-2xx response raises NationBuilder::Error (status, code, body), with NotFoundError, ValidationError (#errors) and RateLimitedError (#limit, #remaining, #reset_at) subclasses.
  • Dependencies trimmed. Faraday is now the only runtime dependency: no activesupport, no json pin.
  • Ruby 3.2+. Juwelier is replaced by a plain gemspec and Bundler gem tasks. Added RuboCop. CI runs on Ruby 3.2–4.0 for pushes to main and for PRs.
  • Specs rewritten with WebMock. The old ones were mostly pending and allowed real network connections.
  • Fixes. Tag names are escaped as path segments (%20, not +). Tags#people now calls tags/:tag/people. Requests have default timeouts.

CHANGELOG.md lists every breaking change. Releasing as 1.0.0 because the API changes.

Test plan

  • bundle exec rake (rubocop + 25 specs) passes locally on Ruby 4.0
  • CI matrix green
  • agra PR (pointing at this branch) green

🤖 Generated with Claude Code

Replace the oauth2 dependency with a plain Faraday 2 client that sends the
access token as a Bearer header. The password grant, client_id/secret and the
juwelier tooling are gone, along with the activesupport dependency and the
json ~> 2.1 pin that blocked consumers from upgrading to json 3.

Non-2xx responses now raise NationBuilder::Error, with NotFoundError,
ValidationError and RateLimitedError subclasses. See CHANGELOG.md for the
full list of breaking changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant