Skip to content

Convert HTTParty to Faraday for HTTP client standardization#289

Merged
bertrama merged 8 commits intomainfrom
copilot/convert-httparty-to-faraday
Jan 22, 2026
Merged

Convert HTTParty to Faraday for HTTP client standardization#289
bertrama merged 8 commits intomainfrom
copilot/convert-httparty-to-faraday

Conversation

Copy link
Contributor

Copilot AI commented Jan 16, 2026

Replaced all HTTParty usage with Faraday to standardize the HTTP client library across the codebase.

Changes

  • Dependencies: Replaced httparty with faraday in spectrum-config.gemspec and spectrum-json.gemspec
  • HTTP calls: Converted 4 HTTParty calls to Faraday equivalents:
    • engine.rb: Primo search API call
    • lib_key.rb: LibKey API call with custom headers and 0.5s timeout
    • Rakefile: GitHub releases API and CMS staff API calls
  • Error handling: Added JSON::ParserError and Faraday::Error exception handling for all converted calls
  • Requires: Added explicit require "json" statements in config.rb and Rakefile

API mapping

# Before (HTTParty)
response = HTTParty.get(url)
data = response.parsed_response
status = response.code

# After (Faraday)
response = Faraday.get(url)
data = JSON.parse(response.body)
status = response.status

# With timeout (HTTParty)
HTTParty.get(url, headers: headers, open_timeout: 0.5)

# With timeout (Faraday)
conn = Faraday.new { |f| f.options.open_timeout = 0.5 }
conn.get(url, {}, headers)

All existing tests pass. Faraday was already present as a transitive dependency through alma_rest_client.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • s3.amazonaws.com
    • Triggering command: /usr/bin/ruby3.2 /usr/bin/ruby3.2 -I/usr/lib/ruby/vendor_ruby extconf.rb --gdwarf-5 --64 -o escape.o /tmp/cclXPxzP.s -Wdate-time y-3.2.0 -g -gcc -I by-3.2.0 86_64-linux-gnu//usr/include/ruby-3.2.0 kward uby-3.2.0 /usr/include/rub-I -I E=3 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Standardize on Faraday</issue_title>
<issue_description>We're standardizing on Faraday.

Task: Convert calls to HTTParty to something equivalent in Faraday. </issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 6 commits January 16, 2026 15:01
Co-authored-by: bertrama <2932803+bertrama@users.noreply.github.com>
Co-authored-by: bertrama <2932803+bertrama@users.noreply.github.com>
Co-authored-by: bertrama <2932803+bertrama@users.noreply.github.com>
Co-authored-by: bertrama <2932803+bertrama@users.noreply.github.com>
Co-authored-by: bertrama <2932803+bertrama@users.noreply.github.com>
Co-authored-by: bertrama <2932803+bertrama@users.noreply.github.com>
Copilot AI changed the title [WIP] Standardize HTTP calls to use Faraday Convert HTTParty to Faraday for HTTP client standardization Jan 16, 2026
Copilot AI requested a review from bertrama January 16, 2026 15:18
@bertrama bertrama marked this pull request as ready for review January 22, 2026 20:20
@bertrama bertrama merged commit 4428e51 into main Jan 22, 2026
3 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.

Standardize on Faraday

2 participants