pvoutput-api

A Ruby wrapper around PVOutput API.

Update 30/06/2016: Since working on this over a year ago another similar project has sprung up (see https://github.com/johnf/pvoutput). There is currently no overlap in functionality so I decided to publish the Gem anyway. In the longterm these projects should probably merge.

See also related project pvoutput-qif.

Installation

Add this line to your application's Gemfile:

gem 'pvoutput-api'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install pvoutput-api

Usage

require 'pvoutput-api'

pvo_auth = PVOutput::Auth.new('8313', 'secret')
stat_data = PVOutput::Statistic.fetch("20150622", "20150622", pvo_auth)
puts stat_data.debit_amount
puts stat_data.energy_consumed

Service Capability

At the time of writing, the PVOutput API consists of the following services.

Service Name URL Implemented
Add Output http://pvoutput.org/service/r2/addoutput.jsp no
Add Status http://pvoutput.org/service/r2/addstatus.jsp no
Add Batch Output http://pvoutput.org/service/r2/addbatchoutput.jsp no
Add Batch Status http://pvoutput.org/service/r2/addbatchstatus.jsp no
Get Status http://pvoutput.org/service/r2/getstatus.jsp no
Get Statistic http://pvoutput.org/service/r2/getstatistic.jsp yes
Get System http://pvoutput.org/service/r2/getsystem.jsp no
Get Output http://pvoutput.org/service/r2/getoutput.jsp no
Get Extended http://pvoutput.org/service/r2/getextended.jsp no
Get Favourite http://pvoutput.org/service/r2/getfavourite.jsp no
Get Missing http://pvoutput.org/service/r2/getmissing.jsp no
Get Insolation http://pvoutput.org/service/r2/getinsolation.jsp no
Delete Status http://pvoutput.org/service/r2/deletestatus.jsp no
Search http://pvoutput.org/service/r2/search.jsp no
Get Team http://pvoutput.org/service/r2/getteam.jsp no
Join Team http://pvoutput.org/service/r2/jointeam.jsp no
Leave Team http://pvoutput.org/service/r2/leaveteam.jsp no
Get Supply http://pvoutput.org/service/r2/getsupply.jsp no
Register Notification http://pvoutput.org/service/r2/registernotification.jsp no
Deregister Notification http://pvoutput.org/service/r2/deregisternotification.jsp no

Rate Limits

The following rate limits applies per API key for all request types -

  • 60 requests per hour.
  • 300 requests per hour in donation mode.

It is recommended to make requests at least 10 seconds apart.

via PVOutput API Documentaion

Unit Tests

Tests can be run using:

rake test

or with Guard

bundle exec guard

Debugging Issue

Raise an issue via Github. If the issue is related to the PVOutput API call, enable logging with the following environment variable:


Copy and paste the exact output into the Issue.

## Contributing

1. Fork it ( https://github.com/jonbartlett/pvoutput-api/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request