Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility issue: Ruby 3 keyword arguments for Request constructor #6

Closed
andreihelo opened this issue Jan 11, 2023 · 2 comments
Closed
Labels

Comments

@andreihelo
Copy link
Contributor

Description

I am running into the following issue when trying to upgrade our app to Ruby 3.

ArgumentError:
  wrong number of arguments (given 1, expected 0)
# .../bundler/gems/crefo-b950bca2ae6e/lib/crefo/service/request.rb:8:in `initialize'
# .../bundler/gems/crefo-b950bca2ae6e/lib/crefo/service.rb:15:in `new'
# .../bundler/gems/crefo-b950bca2ae6e/lib/crefo/service.rb:15:in `process'

Fix

The fix is very simple in fact. An explicit keyword arguments delegation in lib/crefo/service.rb:15

require 'crefo/service/request'
require 'crefo/service/response'

module Crefo
  class Service
    ...

    def process
      begin
        url = Crefo.config.endpoint
        request = self.class::Request.new(**options)
        ...
@lagr lagr added the TODO label Jan 13, 2023
@lagr
Copy link
Contributor

lagr commented Jan 13, 2023

@andreihelo Thank you for raising the issue and adding a proposed fix in the same go! I think the best way to proceed is for us to migrate the CI to GitHub Actions and bump the supported Ruby version to 3.0+ and to apply your fix at the same time.

@lagr
Copy link
Contributor

lagr commented Jan 13, 2023

Solved through #8

@lagr lagr closed this as completed Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants