Shopify / oktakit

Ruby toolkit for working with the Okta API
https://rubygems.org/gems/oktakit
MIT License
69 stars 60 forks source link

Ruby 3 update #42

Closed agrberg closed 2 years ago

agrberg commented 3 years ago

The Oktakit.new convenience method will not work in Ruby 3. More details in commit 1cb45ea

ryanmt commented 3 years ago

:+1: Just ran into this on ruby 3.0 myself. This implementation works fine on 2.6 as well. I'd really like it to land sometime as I've got a locally modified copy of the gem installed RN. :smile:

agrberg commented 3 years ago

Thanks @ryanmt. The current version only coincidentally works on Ruby <= 2.7 as they coerce a hash into positional arguments. Interesting change I wrote a bit up about in this post.

I'm not a maintainer on this repo so I cannot request a review beyond popping this up and 🙏 + 🤞

ryanmt commented 3 years ago

Actually, this change is also effective on Ruby 3.0. I'll admit I don't have a great intuition for that change as I thought it wouldn't work with 2.6 until I tested this to confirm the behavior.

I'm sharing your hope but believe this is a good fix for both 2.6 but more importantly allows for use of latest Ruby releases, especially since Ruby 2.6 only has 5 months of support remaining.

agrberg commented 3 years ago

I believe this would work on any version of Ruby after the double splat and keyword args were introduced since all it is doing is capturing and forwarding the args to Oktakit::Client#new which only has kw args. Because of that I don't think this library can be used on Ruby w/o kw args.

FWIW you can use Oktakit::Client.new(your: args, go: here) instead of the Oktakit.new(your: args, go: here) convenience method if you don't want to maintain a modified version.

ltk commented 2 years ago

Thanks! I'll try to cut a new release sometime this week.