laurent-martin / ruby-suez-mon-eau

A Ruby gem to retrieve water consumption from portal www.toutsurmoneau.fr

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This gem provides a simple API to retrieve water consumption from french provider Suez.

All is required is an account on https://www.toutsurmoneau.fr

Example

An example of use is provided in script: bin/suez_mon_eau

To display the current volume:

ruby -Ilib -r suez_mon_eau -e 'puts SuezMonEau.new(username:"_username_here_",password:"_password_here_").total_volume'

Gem Signature

SuezMonEau is cryptographically signed. To be sure the gem you install hasn’t been tampered with:

Add the public key (if you haven’t already) as a trusted certificate:

gem cert --add <(curl -Ls https://github.com/laurent-martin/ruby-suez-mon-eau/blob/main/certs/laurent.cert.pem)

gem install metric_fu -P MediumSecurity

The MediumSecurity trust profile will verify signed gems, but allow the installation of unsigned dependencies.

This is necessary because not all of SuezMonEau’s dependencies are signed, so we cannot use HighSecurity.

Refer to: https://guides.rubygems.org/security/

Build

To build the signed gem:

SIGNING_KEY=/path/to/signing_key.pem make

To build without signature:

make unsigned_gem

Counter id

The gem will figure out the counter id to use, but if you prefer to specify it, it can be retrieved like this:

Go to https://www.toutsurmoneau.fr/mon-compte-en-ligne/historique-de-consommation-tr

View page source and search: /month/ : the counter id is located just after that path:

var $url = '/mon-compte-en-ligne/exporter-consommation/month/7444012345';

About

A Ruby gem to retrieve water consumption from portal www.toutsurmoneau.fr

License:Apache License 2.0


Languages

Language:Ruby 86.5%Language:Makefile 13.5%