Class: HomeWizard::Client
Overview
Wrapper for the HomeWizard REST API
Instance Attribute Summary collapse
-
#device_info ⇒ Object
readonly
Returns the value of attribute device_info.
Class Method Summary collapse
-
.url(method) ⇒ Object
return api path.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ P1Client
constructor
get client to access P1 meter.
Methods inherited from API
Constructor Details
#initialize(options = {}) ⇒ P1Client
get client to access P1 meter
12 13 14 15 16 17 18 19 |
# File 'lib/homewizard/client.rb', line 12 def initialize( = {}) # create client and copy access_token and set default headers super() @device_info = product_info puts "* probably incompatible api version" unless 'v1'.eql? product_info.api_version rescue Faraday::ForbiddenError => e raise APInotEnabledError.new e.response[:body]['error'] end |
Instance Attribute Details
#device_info ⇒ Object (readonly)
Returns the value of attribute device_info.
9 10 11 |
# File 'lib/homewizard/client.rb', line 9 def device_info @device_info end |
Class Method Details
.url(method) ⇒ Object
return api path
21 22 23 24 |
# File 'lib/homewizard/client.rb', line 21 def self.url(method) path = method ? "v1/#{method}" : '' "/api/#{path}" end |