github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

Floppy / amee-ruby

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 22
    • 1
  • Source
  • Commits
  • Network (1)
  • Issues (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (3)
    • 264bd94c3c4c130425a51812b3505698ab0d73b5
    • master ✓
    • v2
  • Tags (2)
    • 0.1.1
    • 0.1.0
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

A ruby gem for accessing the AMEE carbon calculator — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

tiny bugfix for 2.0.30 
James Smith (author)
Fri Dec 11 05:33:30 -0800 2009
commit  e91a3408b87de75ae5e709112f604503226dd6e4
tree    0fcc82a2b768dcef0beed93ece927b8a2beb568f
parent  0f36af154cae16c94da59cb6b1a349f260a3e777
amee-ruby /
name age
history
message
file .gitignore Loading commit data...
file COPYING
file README
file Rakefile
file amee-ruby.gemspec Fri Dec 11 05:33:30 -0800 2009 tiny bugfix for 2.0.30 [James Smith]
file amee.example.yml Fri Sep 11 08:28:01 -0700 2009 Add sample amee.yml file [Floppy]
directory bin/
directory examples/ Thu Feb 19 07:23:21 -0800 2009 Update example for v2 gem [Floppy]
file init.rb
directory lib/ Fri Dec 11 05:32:24 -0800 2009 wrong output format in one of the error messages [James Smith]
directory rails/
directory spec/ Fri Dec 11 05:26:46 -0800 2009 2.0.30 - improve exception error messages to in... [James Smith]
README
== AMEE-Ruby

A gem to provide a Ruby interface to the AMEE carbon calculator (http://amee.cc)

Licensed under the MIT license (See COPYING file for details)

Author: James Smith (james@floppy.org.uk / http://www.floppy.org.uk)

Homepage: http://github.com/Floppy/amee-ruby

Documentation: http://docs.github.com/Floppy/amee-ruby

== INSTALLATION

1) Enable gems from gemcutter, if you haven't already done so: 
    > sudo gem install gemcutter
    > sudo gem tumble

2) Install gem
    > sudo gem install amee

== IMPORTANT CHANGES when upgrading beyond 2.0.25

If you are using the $amee connection in your Rails apps, this is now deprecated
and will be removed in future releases. See the "Rails" section below for details 
of what you should use instead.

== USAGE

Currently, you can read DataCategories, DataItems and DataItemValues. See 
examples/view_data_*.rb for simple usage examples. You can also get the list
of available Profiles, and create and delete them. See examples/list_profiles.rb
and examples/create_profile.rb for details. You can also load ProfileCategories,
and load, create and update ProfileItems.

The gem will use the AMEE JSON API if the JSON gem is installed on the local
system. Otherwise the XML API will be used.

== SUPPORT
                    Create    Read     Update    Delete
DataCategories         N        Y         N         N
DataItems              N        Y         N         N
DataItemValues         N        Y         N         Y
Profile List           -        Y         -         -
Profiles               Y        -         -         Y
ProfileCategories      -        Y         -         -
 - drilldown           -        Y         -         -
ProfileItems           Y        Y         Y         Y

== INTERACTIVE SHELL

You can use the 'ameesh' app to interactively explore the AMEE data area. Run
'ameesh -u USERNAME -p PASSWORD -s SERVER' to try it out. Source code for this 
tool is in bin/ameesh and lib/amee/shell.rb. Profiles are not accessible through
this interface yet.

== RAILS

This gem can also be used as a Rails plugin. You can either extract it into
vendor/plugins, or use the new-style config.gem command in environment.rb. For
example:

    config.gem "amee", :version => '>= 2.0.26'

If you copy amee.example.yml from the gem source directory to amee.yml in your
app's config directory, a persistent AMEE connection will be available from 
AMEE::Rails#connection, which you can use anywhere. In your controllers, you can
also use the global_amee_connection function to access the same global connection.

    data = AMEE::Data::Category.root(global_amee_connection)

If you do not use this facility, you will have to create your own connection
objects and manage them yourself, which you can do using AMEE::Connection#new

There is a helper for ActiveRecord models which should be linked to an AMEE profile.
By adding:

    has_amee_profile

to your model, and by adding an amee_profile:string field to the model in the
database, an AMEE profile will be automatically created and destroyed with your
model. By overriding the function amee_save in your model, you can store data in
AMEE when your model is saved.

== CACHING

The AMEE::Connection object implements an optional cache for GET requests. This is
currently a versy simple implementation which caches the result of all GET requests
until a POST, PUT, or DELETE is executed, at which point the cache is cleared. To
enable caching, set the enable_caching parameter of AMEE::Connection.new to true.
Caching is disabled by default.

== UPGRADING TO VERSION > 2

There are a few changes to the API exposed by this gem for version 2. The main
ones are:

1) AMEE::Connection#new takes a hash of options instead of an explicit parameter list.
   Whereas before you would have used new(server, username, password, use_json, enable_cache, enable_debug)
   you would now use new(server, username, password, :format => :json, :enable_caching => true, :enable_debug => true)

2) Many get functions take a hash of options instead of explicit date and itemsPerPage parameters.
   get(... , :start_date => {your_date}, :itemsPerPage => 20)

3) total_amount_per_month functions have been replaced with total_amount. There are also
   total_amount_unit and total_amount_per_unit functions which give the units that the total
   amount is in.
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server