README.md in api_analytics-1.0.1 vs README.md in api_analytics-1.0.2

- old
+ new

@@ -1,43 +1,49 @@ -# ApiAnalytics +# API Analytics -Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/api_analytics`. To experiment with that code, run `bin/console` for an interactive prompt. +A lightweight API analytics solution, complete with a dashboard. -TODO: Delete this and the text above, and describe your gem +## Getting Started -## Installation +### 1. Generate a new API key -Add this line to your application's Gemfile: +Head to https://my-api-analytics.vercel.app/generate to generate your unique API key with a single click. This key is used to monitor your specific API, so keep it secret! It's also required in order to view your APIs analytics dashboard. -```ruby -gem 'api_analytics' -``` +### 2. Add middleware to your API -And then execute: +Add our lightweight middleware to your API. Almost all processing is handled by our servers so there should be virtually no impact on your APIs performance. - $ bundle install +```bash +gem install api_analytics +``` -Or install it yourself as: +#### Rails - $ gem install api_analytics +Assign your API key to `ANALYTICS_API_KEY` in `config/secrets.yml`. -## Usage +```yml +development: + ANALYTICS_API_KEY: <api_key> +production: + ANALYTICS_API_KEY: <api_key> +``` -TODO: Write usage instructions here +Require `api_analytics` and add the analytics middleware to your rails application in `config/application.rb`. -## Development +```ruby +require "api_analytics" -After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment. +Bundler.require(*Rails.groups) -To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org). +module RailsMiddleware + class Application < Rails::Application + config.load_defaults 6.1 + config.api_only = true -## Contributing + config.middleware.use ::Analytics::Middleware # Add middleware + end +end +``` -Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/api_analytics. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/api_analytics/blob/master/CODE_OF_CONDUCT.md). +### 3. View your analytics -## License - -The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). - -## Code of Conduct - -Everyone interacting in the ApiAnalytics project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/api_analytics/blob/master/CODE_OF_CONDUCT.md). +Your API will log requests on all valid routes. Head over to https://my-api-analytics.vercel.app/dashboard and paste in your API key to view your dashboard.