module Apiotics
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/apiotics.rb, line 54 def self.clear_settings ApioticsSetting.destroy_all end
configure() { |configuration| ... }
click to toggle source
# File lib/apiotics.rb, line 26 def self.configure yield(configuration) end
get(object, time0= nil, time1= nil)
click to toggle source
# File lib/apiotics.rb, line 30 def self.get(object, time0= nil, time1= nil) Apiotics::Extract.get(object, time0, time1) end
get_attributes(parent_name, model_name)
click to toggle source
# File lib/apiotics.rb, line 34 def self.get_attributes(parent_name, model_name) configuration = Apiotics::Portal.retrieve_configuration attributes = Apiotics::Portal.parse_drivers_and_scripts(configuration, parent_name, model_name) end
reset()
click to toggle source
# File lib/apiotics.rb, line 22 def self.reset @configuration = Configuration.new end
sync(object)
click to toggle source
# File lib/apiotics.rb, line 43 def self.sync(object) parent = object.class.parent.name child = object.class.name.demodulize attributes = Apiotics.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 Apiotics::Extract.fire(object, interfaces, "get") end
sync_device_instances(worker_name, sync_data= false)
click to toggle source
# File lib/apiotics.rb, line 39 def self.sync_device_instances(worker_name, sync_data= false) Apiotics::Portal.sync_device_instances(worker_name, sync_data) end