Skip to content
AMEE edited this page Sep 14, 2010 · 6 revisions

Carbon Calculating Sample Application

This is a sample Ruby on Rails application that shows how to use the AMEE API in a real life application. The application was designed as a sample carbon calculator similar to one that would be used by a construction company. Whilst this is a sample application and is known to work at time of release, there is no guarantee that AMEE will fix any bugs found, or update this application if a substantial new version of the AMEE API is introduced.

Getting Started

Before starting install the gem dependencies:

b1q rake gems:install

The project requires an initial client and super admin before it is usable. There is currently only one client supported but the application shows how to easily turn the application into this into a SaaS model. To create these run the following on the command line:

rake “setup:data[adminlogin,adminemail,adminname,adminpassword,clientname]”

Further notes

This software was designed as an example UK calculator. The AMEE API assumes that any data submitted is for the UK unless a metadata profile item is created explicitly specifying the country. Any project using this codebase as a basis for their software should therefore set the country if it is not the UK. More details can be found in AMEE Explorer

As AMEE can update the algorithms that produce the carbon output as more accurate data becomes available, any application that caches the carbon output needs a way to updates its cache. This project includes a rake project for that purpose and can be run via:

rake cronjobs:update_carbon_cache

Clone this wiki locally