module Simbiotes
This class takes ruby hashes and saves them to the appropriate database table. All model methods that have corresponding IoT interfaces have six database fields associated with them. The first is a field named the same as the method. The second is name_ack, and third is name_complete, the fourth is name_timestamp, the fifth is name_status, the sixth is name_action. In the hash, instance is the record id (not necessarily the id column), driver is the model, interface is the method. Data should be saved both to the model's database table and to the corresponding log table (name_method_logs).
Constants
- VERSION
Attributes
configuration[RW]
Public Class Methods
clear_settings()
click to toggle source
# File lib/simbiotes.rb, line 53 def self.clear_settings SimbiotesSetting.destroy_all end
configure() { |configuration| ... }
click to toggle source
# File lib/simbiotes.rb, line 25 def self.configure yield(configuration) end
get(object, time0= nil, time1= nil)
click to toggle source
# File lib/simbiotes.rb, line 29 def self.get(object, time0= nil, time1= nil) Simbiotes::Extract.get(object, time0, time1) end
get_attributes(parent_name, model_name)
click to toggle source
# File lib/simbiotes.rb, line 33 def self.get_attributes(parent_name, model_name) configuration = Simbiotes::Portal.retrieve_configuration attributes = Simbiotes::Portal.parse_drivers_and_scripts(configuration, parent_name, model_name) end
reset()
click to toggle source
# File lib/simbiotes.rb, line 21 def self.reset @configuration = Configuration.new end
sync(object)
click to toggle source
# File lib/simbiotes.rb, line 42 def self.sync(object) parent = object.class.parent.name child = object.class.name.demodulize attributes = Simbiotes.configuration.targets[parent][child] interfaces = Hash.new attributes.each do |attribute| interfaces[attribute.underscore.downcase.gsub(" ", "_")] = object.send(attribute.underscore.downcase.gsub(" ", "_")).to_s end Simbiotes::Extract.fire(object, interfaces, "get") end
sync_device_instances(worker_name)
click to toggle source
# File lib/simbiotes.rb, line 38 def self.sync_device_instances(worker_name) Simbiotes::Portal.sync_device_instances(worker_name) end