Git Product home page Git Product logo

tibber's Introduction

Tibber API

Version

This is a wrapper for the Tibber rest API.

Installation

Add this line to your application's Gemfile:

gem 'tibber'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install tibber

Usage

Before you start making the requests to API provide the endpoint and api key using the configuration wrapping.

require 'tibber'
require 'logger'

# use do block
Tibber.configure do |config|
  config.access_token = ENV['TIBBER_ACCESS_TOKEN']
  config.logger = Logger.new(TEST_LOGGER)
end

# or configure with options hash
client = Tibber.client
client.login

Resources

Authentication

# setup
#
begin
  client = Tibber.client
  client.login
rescue Tibber::AuthenticationError => e
  puts "Error logging in tibber api"
  puts e
end

Graph QL Data resources

Endpoint for data related requests

# show todays prices
prices = client.price_info

prices.homes.each do |home|
  puts "Today's prices:"
  home.currentSubscription.priceInfo.today.each do |hour|
    puts "#{hour.startsAt} #{hour.total} #{hour.currency} (#{hour.energy} + #{hour.tax})"
  end
end
Resource API endpoint
.information returns name userId login accountType websocketSubscriptionUrl homes including homes meteringPointData, subscriptions and features
.price_info price information for all homes[id,currentSubscription{priceInfo{current,today[],tomorrow[]}}]
.consumption(home_id, resolution, count) Array of home.consumption.nodes[]: from to cost unitPrice unitPriceVAT consumption consumptionUnit
.send_push_notification(title, message, screen_to_open) send notificartion ot devices and returns successful & pushedToNumberOfDevices

Publishing

  1. Update version in version.rb.
  2. Add release to CHANGELOG.md
  3. Commit.
  4. Test build.
> rake build

  1. Release
> rake release

## Contributing

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

## License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

tibber's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.