The api_path is calculated based on the base_path and version_path
Now, we can put something like this in an initializer in a Rails application for example:
ClarifaiRuby.configure do |config|
config.base_url = "https://api.clarifai.com/v1"
config.version_path = "/v1"
config.client_id = "THISISAN_ID"
config.client_secret = "-123wedkfjnkj3"
end
and when we want to use these configured values in the gem itself:
ClarifaiRuby.configuration.client_id #=> will result in the configured value, "THISISAN_ID"
Try it out by running rake console and manually typing in the config, and seeing that you can access the configured value using ClarifaiRuby.configuration.whatever_config_value :D
This allows us to configure values for the gem to use later. Configuration values added were:
The
api_path
is calculated based on thebase_path
andversion_path
Now, we can put something like this in an initializer in a Rails application for example:
and when we want to use these configured values in the gem itself:
Try it out by running
rake console
and manually typing in the config, and seeing that you can access the configured value usingClarifaiRuby.configuration.whatever_config_value
:D