README.md in api_analytics-1.0.2 vs README.md in api_analytics-1.0.3
- old
+ new
@@ -16,32 +16,41 @@
gem install api_analytics
```
#### Rails
-Assign your API key to `ANALYTICS_API_KEY` in `config/secrets.yml`.
+Add the analytics middleware to your rails application in `config/application.rb`.
-```yml
-development:
- ANALYTICS_API_KEY: <api_key>
-production:
- ANALYTICS_API_KEY: <api_key>
-```
-
-Require `api_analytics` and add the analytics middleware to your rails application in `config/application.rb`.
-
```ruby
-require "api_analytics"
+require 'rails'
+require 'api_analytics'
Bundler.require(*Rails.groups)
module RailsMiddleware
class Application < Rails::Application
config.load_defaults 6.1
config.api_only = true
- config.middleware.use ::Analytics::Middleware # Add middleware
+ config.middleware.use ::Analytics::Middleware, <api_key> # Add middleware
end
+end
+```
+
+#### Sinatra
+
+```ruby
+require 'sinatra'
+require 'api_analytics'
+
+use Analytics::Middleware, <api_key>
+
+before do
+ content_type 'application/json'
+end
+
+get '/' do
+ {message: 'Hello World!'}.to_json
end
```
### 3. View your analytics