IFD Tools

This gem provides common functionality for use with all IFD server applications, including:

  • Base tweaks in styling and functionality for ActiveAdmin
  • User management for access to the /admin area
  • Management of EmergencyMessage, NotifierUpdate & SoftwareUpdate resources
  • Management of Customer
  • IfdTools::Tracking::Event & framework for tracking API and reporting (customer trends, etc)
  • Automatic inclusion of modules for generating API XML responses for /api/emergency_messages.xml, /api/notifier_updates.xml & /api/software_updates.xml
  • Protected API requests by Devise authentication (auth_token)

Usage

To install:

  1. Create a new Rails project
  2. Add gem 'ifd_tools' to your Gemfile
  3. Run bundle
  4. Run rails g ifd_tools:install
  5. Start your server, login credentials are "[email protected]" & "P@$$w0rd" for http://localhost:5000/admin

Tracking

  1. There are several configuration options for color choices in the ifd_tools.rb initializer.
  2. To track specific events, create subclasses of IfdTools::Tracking::Event in your application, in app/models/ifd_tools/tracking folder.
  3. Be sure to override the assign_trackable_item_by_id method per subclass (default implement is to raise an exception)
  4. Tracking requests can be initiated via the API at /api/track.xml?type=product_event&id=14. The type parameter is the class name without the module prefixes, underscored -> "IfdTools::Tracking::ProductEvent" should be sent as "product_event".
  5. Also have "batch tracking" functionality available, which will accept JSON or XML in a request to process multiple entries. Each "event" is id, type and optionally timestamp (UNIX) or platform.

Customer Creation

A special helper method is provided on the ApiController class to facilitate easy Customer creation. There is plenty of inline documentation on usage there, but here's an example:

class ApiController < ApplicationController

  before_filter :authenticate_customer!, :except => [:software_updates, :emergency_messages, :notifier_updates]
  respond_to :json, :xml

  include IfdTools::ApiControllerExtensions

  create_customer do |customer|
      # customer = Customer.new(params[:request][:customer]) already passed in to us, just handle special use cases for data transformations
      customer. = CustomerAccountLevel.find_by_abbreviation(params[:account_level])
      customer
  end

end