Class: Tibber::Client

Inherits:
API
  • Object
show all
Defined in:
lib/tibber/client.rb

Overview

Wrapper for the Tibber REST API

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from API

#config

Methods included from Authentication

#login

Methods included from Request::GraphQL

#graphql_call

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



12
13
14
15
16
17
18
# File 'lib/tibber/client.rb', line 12

def initialize(options = {})
  super(options)
  
  @information = self.info
rescue GraphQLError => e
  raise AuthenticationError.new e
end

Instance Attribute Details

#informationObject

Returns the value of attribute information.



10
11
12
# File 'lib/tibber/client.rb', line 10

def information
  @information
end

Instance Method Details

#consumption(home_id, resolution, count) ⇒ Object



173
174
175
# File 'lib/tibber/client.rb', line 173

def consumption(home_id, resolution, count)
  _consumption({ id: home_id, resolution: resolution, count: count })
end

#send_push_notification(title, message, screen_to_open) ⇒ Object



152
153
154
# File 'lib/tibber/client.rb', line 152

def send_push_notification(title, message, screen_to_open)
  _send_push_notification({ title: title, message: message, screen_to_open: screen_to_open }).sendPushNotification
end