Class: Tibber::Client
Overview
Wrapper for the Tibber REST API
Instance Attribute Summary collapse
-
#information ⇒ Object
Returns the value of attribute information.
Class Method Summary collapse
Instance Method Summary collapse
- #consumption(home_id, resolution, count) ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #price_info(resolution = Resolution::HOURLY) ⇒ Object
- #send_push_notification(title, message, screen_to_open) ⇒ Object
Methods inherited from API
Methods included from Authentication
Methods included from Request::GraphQL
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
14 15 16 17 18 19 20 |
# File 'lib/tibber/client.rb', line 14 def initialize( = {}) super() login @information = self.info rescue GraphQLError => e raise AuthenticationError.new e end |
Instance Attribute Details
#information ⇒ Object
Returns the value of attribute information.
12 13 14 |
# File 'lib/tibber/client.rb', line 12 def information @information end |
Class Method Details
.api_endpoint(method, query) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/tibber/client.rb', line 22 def self.api_endpoint(method, query) # all records self.send(:define_method, method) do |params = {}| graphql_call(query, params) end end |
Instance Method Details
#consumption(home_id, resolution, count) ⇒ Object
177 178 179 |
# File 'lib/tibber/client.rb', line 177 def consumption(home_id, resolution, count) _consumption({ id: home_id, resolution: resolution, count: count }) end |
#price_info(resolution = Resolution::HOURLY) ⇒ Object
141 142 143 |
# File 'lib/tibber/client.rb', line 141 def price_info(resolution = Resolution::HOURLY) _price_info({ resolution: resolution }) end |
#send_push_notification(title, message, screen_to_open) ⇒ Object
156 157 158 |
# File 'lib/tibber/client.rb', line 156 def send_push_notification(title, , screen_to_open) _send_push_notification({ title: title, message: , screen_to_open: screen_to_open }).sendPushNotification end |