The drivin ruby library provides convenient access to the Driv.in API from applications written in the Ruby language.
Add this to your Gemfile and run bundle install
:
gem 'drivin', git: 'git@github.com:MeruImports/drivin.git'
Before using the gem, configure it in your application. You can create an initializer to set up the configuration. Provide your api key. Here's an example using the drivin
gem in a Ruby on Rails application:
-
Create a new initializer file in the
config/initializers
directory of your Rails application. For example, you can create a file nameddrivin.rb
. -
In the initializer file, configure the
drivin
gem as follows:
# config/initializers/drivin.rb
Drivin.configure do |config|
config.api_key = "your_private_key"
config.livemode = Rails.env.production?
config.logger = YourCustomLogger.new($stdout) # Optional custom logger, or gem take Rails logger or default ruby logger
end
Make sure to replace "your_private_key" with your own API key provided by Drivin using this configuration in your application. The key are sensitive value and should be kept secure.
To access the development console, run:
make console
Execute the gem's tests using Rake:
make tests
Ensure that your code adheres to Ruby's style conventions by utilizing Rubocop. Validate your code with:
make linter
Alejandro Cen Software Engineer |
Andrés Arias Software Engineer |
Carlos Gonzalez Software Engineer |