Skip to content
/ flurry Public

A wrapper around Flurry Analytics Reporting API

License

Notifications You must be signed in to change notification settings

rbague/flurry

Repository files navigation

Flurry

Gem Version Build Status Reviewed by Hound

Flurry provides easy access to Flurry Analytics Reporting API

Keep track of changes in Changelog

Installation

Add this line to your application's Gemfile:

gem 'flurry'

And then execute:

$ bundle

Or install it yourself as:

$ gem install flurry

Usage

To start using the gem provide an api token through Flurry#configure. The results are displayed in UTC time zone and JSON format (as defined in Flurry), this can be changed by setting the respective configuration:

Flurry.configure do |config|
  config.token = ENV['FLURRY_API_TOKEN']

  # Optional configuration
  config.time_zone = 'Europe/Madrid'
  config.format = :csv
  config.timeout = 30 # Timeout for opening connection and reading data
end

Once an API token has been set, requesting data is really easy

require 'flurry'

# Gets todays the number of sessions from appUsage table grouped by day (default)
Flurry.from(:app_usage).select(:sessions).between(Date.today).fetch # Flurry::Response

# Same as above but grouping by hour
Flurry.from(:app_usage, :hour).select(:sessions).between(Date.today).fetch

# Use the sort method to sort the query results. Defaults to descending
Flurry.from(:app_usage).select(:sessions).sort(sessions: :asc).between(Date.today).fetch

# Gets the results from last week, also returning the app id, and the platform name (showing accepts an array as the key values)
Flurry.from(:app_usage).select(:sessions).showing(app: :id, platform: :name).between(Date.today - 7, Date.today).fetch

# To get only the metrics that match a condition: (gt, lt, eq)
Flurry.from(:app_usage).select(:sessions).having(sessions: { gt: 10, lt: 100 }).between(Date.today).fetch

# Change default configuration per request
Flurry.from(:app_usage).format(:csv).time_zone('Europe/Madrid')

TODO

  • Sort by metrics (select)
  • Filter by dimension (showing)
  • Havings
  • Response format
  • Custom response class
  • Add documentation

Contributing

  1. Fork the project https://github.com/rbague/flurry/fork
  2. Get an api token and set it to FLURRY_TOKEN environment variable
  3. Run bundle and bundle exec rake
  4. Make your feature or bug fix
  5. Add tests for it. This is important so that it does not break in a future version.
  6. Submit a new Pull Request

License

The gem is available as open source under the terms of the MIT License.

About

A wrapper around Flurry Analytics Reporting API

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages