Mashape Analytics Ruby Agent
for more information on Mashape Analytics, please visit apianalytics.com
Requirements
Installation
gem 'mashape-analytics'
bundle install
Usage
Ruby on Rails
Make sure to add mashape-analytics
to your Gemfile.
Open your config/environment.rb
file, and within the Rails::Initializer.run
block, add the middleware as below:
require 'mashape-analytics'
Rails::Initializer.run do |config|
config.middleware.use MashapeAnalytics::Frameworks::Rails, service_token: 'SERVICE_TOKEN', environment: 'production'
end
In rails 4, put the config.middleware.use
line in the config/application.rb
file.
module MyApp
class Application < Rails::Application
config.middleware.use 'MashapeAnalytics::Frameworks::Rails', service_token: 'SERVICE_TOKEN', environment: 'production'
end
end
Sinatra
Register the middleware. Then activate it.
# myapp.rb
require 'sinatra'
require 'mashape-analytics'
register MashapeAnalytics::Frameworks::Sinatra
mashapeAnalytics! 'SERVICE_TOKEN', environment: 'production'
Rack
Add the middleware.
require 'rack'
require 'mashape-analytics'
use MashapeAnalytics::Frameworks::Rack, service_token: 'SERVICE_TOKEN', environment: 'production'
Copyright and License
Copyright Mashape Inc, 2015.
Licensed under the MIT License