Passing a value from the user to the gem method

I created a gem pushofy for sending push notifications to android and ios device which I will be using in a rails app.

This is one of the methods in gem file which sends a push to an ios device.

def push(payload_hash, deviceTokenHex,cert_name)

The cert_name has to be received from the user of the rails app. He will either upload the certificate to the rails app or uses the gem from the command line to sent a push notification. How can I get the name of the certificate ? Should I ask him to store the value in the environment variables?

Environment variables are definitely an option, you can also make your gem configurable, and add that as a configuration option, such as application.rb in a rails app.

If the certificate name changes a lot, having it a configuration is not very good, if the class where this method is defined is instantiated from outside the gem, you can pass it in on the constructor, or even on every call, if it comes to it.

It all depends on how you’re going to use it.