Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ecologi

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ecologi

  • 0.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Ecologi

This is a Ruby library for interacting with the Ecologi API.

Usage

To get started, install the gem as normal:

gem "ecologi"

Then you'll need to grab an API key from your Impact API page.

Once you've got an API key, setup a client like so:

@client = Ecologi::Client.new(api_key: ENV["API_KEY"])

You can then use the following methods.

Purchasing Trees

To purchase trees for an account. Requires a number. The name parameter is optional. Returns a Ecologi::TreePurchase response.

@client.trees.purchase number: 2, name: "Tree's for user"

#=> #<Ecologi::TreePurchase amount=0.38...

Purchasing Carbon Offsets

To purchase carbon offsets for an account. Requires number and units. Returns a Ecologi::CarbonOffsetPurchase response.

Units must be either KG or Tonnes.

@client.carbon_offsets.purchase number: 2, units: "KG"

#=> #<Ecologi::CarbonOffsetPurchase number=2...

Reporting - Total Impact

Returns a Ecologi::Report object with the total number of trees and carbon offset for a user.

@client.reporting.total_impact username: "deanpcmad"

#=> #<Ecologi::Report trees=1337...

Reporting - Total Trees

Returns a Ecologi::Report object with the total number of trees for a user.

@client.reporting.total_trees username: "deanpcmad"

#=> #<Ecologi::Report total=1337...

Reporting - Total Carbon Offset

Returns a Ecologi::Report object with the total amount of carbon offset for a user.

@client.reporting.total_carbon username: "deanpcmad"

#=> #<Ecologi::Report total=1337...

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/deanpcmad/ecologi.

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 24 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc