- 
                Notifications
    
You must be signed in to change notification settings  - Fork 13
 
Description
Overview
It is my understanding that new API consumers are meant to be using the "beta 1.0.0" version of this library, however we've run into some issues loading it which I think are related to how the library is registered with RubyGems. Here is the guide we are following: https://github.com/OneSignal/onesignal-ruby-client/blob/aa5a0bea2fadf3f023d76de5f1492f25af3f7d34/README.md. After installing the gem, when trying to require it in our project in the boot-file (or in a console), we see the following error:
[1] pry(main)> require 'onesignal'
LoadError: cannot load such file -- onesignal
from /home/$USER/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `require'
Steps to Reproduce
Per the documentation, we've added the following to our Gemfile:
gem 'onesignal', '~> 1.0.0.beta1'
Then we run bundle, which appears to work and yields the following output:
Fetching onesignal 1.0.0.beta1 (was 0.3.0)
Installing onesignal 1.0.0.beta1 (was 0.3.0)
Then, either in a console or on application-startup, add the line require 'onesignal' and you should see the error above.
Temporary Fix
For the time being, we have found that we can work around this issue by specifying the git location and the git branch for the targeted beta release; the line in the Gemfile must be changed to:
gem 'onesignal', '~> 1.0.0.beta1', git: 'git://github.com/OneSignal/onesignal-ruby-client.git', branch: '1.0.0.beta1'
When running bundle with that in our Gemfile, we are able to use the library as expected:
[6] pry(main)> require 'onesignal'
=> false # Already required.
[8] pry(main)> OneSignal::DefaultApi
=> OneSignal::DefaultApi # Working as expected.
Summary
The temporary fix will give us access to the library in our project for now, but it is not an optimal solution. When targeting this branch bundle could begin failing if this branch were deleted from GitHub, or if the release were removed from the branch etc. In the short-term it would make sense to update the docs to reflect this usage, but long-term we would like to just target the gem version alone rather than listing the repository and branch as well.