Sha256: c19f865e874b31f86f06d531436f1a86430c23b827ffea74f8fc8ac6e0642676
Contents?: true
Size: 785 Bytes
Versions: 2
Compression:
Stored size: 785 Bytes
Contents
module NestConnect module Device class BaseDevice def self.from_hash_collection(hash) hash.values.map { |value| new(value) } end def self.all(api_class: self.api_class, access_token: nil) remote_hash = api_class.new(access_token: access_token).all.body from_hash_collection(remote_hash) end def initialize(api_class: self.class.api_class, **args) @api_class = api_class args.each do |key, value| instance_variable_set("@#{key}", value) end end def reload api_runner.get.body.each do |key, value| instance_variable_set("@#{key}", value) end end attr_accessor :access_token private attr_reader :api_class end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nest_connect-0.1.7 | lib/nest_connect/devices/base_device.rb |
nest_connect-0.1.6 | lib/nest_connect/devices/base_device.rb |