Undefined method `=~' for [:ReturnEnvelope, :Boolean]:Array
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]:
https://github.com/lob/lob-ruby/blob/2591d23a0993a373121e8c7e03d09bc3db260563/lib/openapi_client/models/letter.rb#L190
The second if in Letter#build_from_hash breaks because a =~ is sent to the array instance: https://github.com/lob/lob-ruby/blob/2591d23a0993a373121e8c7e03d09bc3db260563/lib/openapi_client/models/letter.rb#L624
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!
Hey, I hit this issue too: https://github.com/lob/lob-ruby/pull/216, see their reply there.
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?
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"
@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.
Sounds good, I'm not promising I'll maintain this forever so best to use your own fork!