team-telnyx / telnyx-ruby

Telnyx API Ruby Client
https://developers.telnyx.com/docs/api/v2/overview
MIT License
24 stars 17 forks source link

Address ruby 2.7 deprecation warnings #53

Closed ledbettj closed 3 years ago

ledbettj commented 3 years ago

Two changes in tests/library code to address two warnings:

warning: Passing the keyword argument as the last hash parameter is deprecated warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call

  1. We must explicitly pass a hash when a function accepts both keyword args and a hash parameter.
  2. We must explicitly convert hash to keyword args with ** when passing a hash as keyword arguments.

One dependency version change, Faraday:

Currently the Gemfile is locked 0.15.4, while the gemspec allows 0.13.x - 0.17.x, excluding some bad 0.16 releases. This 0.15.4 version contains various deprecation warnings under ruby 2.7:

warning: Capturing the given block using Proc.new is deprecated; use &block instead

Here we update the Gemfile to point to the latest 0.x version, which is 0.17.3, and disallow 0.17.1 in the gemspec, which has some error class hierarchy changes (which were reverted in 0.17.3) that break tests. For more details, see https://github.com/lostisland/faraday/blob/master/CHANGELOG.md