This is a sample Ruby on Rails (rubyonrails.org/) application that shows how to use the AMEE API (my.amee.com/developers) 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.
You can create your own copy of this application at my.amee.com/templates/21-construction-calculator, or you can use this codebase to run your own copy on your own servers. You may also use it as a base from which to develop your own AMEE applications.
MIT (see the COPYING file)
Ensure you have Rails 2.3.5 installed.
Download the application, and customise config/amee.example.yml, config/database.example.yml and config/settings.example.yml with your own settings. Then run:
rake gems:install rake db:schema:load
to set up the app.
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 change this and turn the application into a SaaS model. To create these run the following on the command line:
rake "setup:data[<adminlogin>,<adminemail>,<adminname>,<adminpassword>,<clientname>]"
Your application is then ready to use by running script/server.
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 at: explorer.amee.com/categories/Metadata
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
Rails 2.3.5 Rails-compatible database server (MySQL, PostgreSQL, SQLite, etc) gems:
amee ~> 2.0.35 amee_rails_layer ~> 0.4.0 json aasm will_paginate prawn 0.7.1 rspec rspec-rails shoulda factory_girl airbrake