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

Undefined method `=~' for [:ReturnEnvelope, :Boolean]:Array #215

Open
acimadamore opened this issue Jul 28, 2023 · 5 comments
Open

Undefined method `=~' for [:ReturnEnvelope, :Boolean]:Array #215

acimadamore opened this issue Jul 28, 2023 · 5 comments

Comments

@acimadamore
Copy link

I'm receiving the error in the title when sending a Letter. It seems that the problem is with attributes that are mapped to Open API type that is an Ruby Array.

In this error in particular return_envelope is mapped to Array[:ReturnEnvelope, :Boolean]:

:'return_envelope' => Array[:'ReturnEnvelope', :'Boolean'],

The second if in Letter#build_from_hash breaks because a =~ is sent to the array instance:

elsif type =~ /\AArray<(.*)>/i

Maybe the third if should precede the second one and add a check if type responds_to(:=~)? This problem should be present in all the implementations of build_form_hash of other model classes.

Thanks!

@arich
Copy link

arich commented Oct 12, 2023

Hey, I hit this issue too: #216, see their reply there.

@palu3492
Copy link

palu3492 commented May 3, 2024

I'm hitting this same issue with gem version 6.0.9 after upgrading to Ruby 3.2.0. Is Lob doing anything about this? Am I expected to patch the code myself and rebuild the gem?

@arich
Copy link

arich commented May 7, 2024

That's a shame, I was hoping the newer versions fixed it.
You can use my fork over here. I haven't updated it to the latest, it's on 6.0.5.
https://github.com/hellobrightline/lob-ruby

gem "lob", github: "hellobrightline/lob-ruby"

@palu3492
Copy link

palu3492 commented May 7, 2024

@arich Thanks. I ended up forking it as well and patching it with your code suggestion. That fixed the issue. I will hold out hope that Lob figures this out so I can use the official gem.

@arich
Copy link

arich commented May 7, 2024

Sounds good, I'm not promising I'll maintain this forever so best to use your own fork!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants