Module: Simbiotes
- Defined in:
- lib/simbiotes/insert.rb,
lib/simbiotes.rb,
lib/simbiotes/parse.rb,
lib/simbiotes/client.rb,
lib/simbiotes/portal.rb,
lib/simbiotes/server.rb,
lib/simbiotes/extract.rb,
lib/simbiotes/railtie.rb,
lib/simbiotes/version.rb,
lib/simbiotes/configuration.rb,
lib/generators/simbiotes/view/view_generator.rb,
lib/generators/simbiotes/model/model_generator.rb,
lib/generators/simbiotes/script/script_generator.rb,
lib/generators/simbiotes/channel/channel_generator.rb,
lib/generators/simbiotes/install/install_generator.rb,
lib/generators/simbiotes/migration/migration_generator.rb,
lib/generators/simbiotes/controller/controller_generator.rb,
lib/generators/simbiotes/initializer/initializer_generator.rb,
lib/generators/simbiotes/create_model/create_model_generator.rb,
lib/generators/simbiotes/create_table/create_table_generator.rb
Overview
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).
Defined Under Namespace
Classes: ChannelGenerator, Client, Configuration, ControllerGenerator, CreateModelGenerator, CreateTableGenerator, Extract, InitializerGenerator, Insert, InstallGenerator, MigrationGenerator, ModelGenerator, Parse, Portal, Railtie, ScriptGenerator, Server, ViewGenerator
Constant Summary
collapse
- VERSION =
'0.1.21'
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.configuration ⇒ Object
Returns the value of attribute configuration.
14
15
16
|
# File 'lib/simbiotes.rb', line 14
def configuration
@configuration
end
|
Class Method Details
.clear_settings ⇒ Object
53
54
55
|
# File 'lib/simbiotes.rb', line 53
def self.clear_settings
SimbiotesSetting.destroy_all
end
|
25
26
27
|
# File 'lib/simbiotes.rb', line 25
def self.configure
yield(configuration)
end
|
.get(object, time0 = nil, time1 = nil) ⇒ Object
29
30
31
|
# 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) ⇒ Object
.reset ⇒ Object
21
22
23
|
# File 'lib/simbiotes.rb', line 21
def self.reset
@configuration = Configuration.new
end
|
.sync(object) ⇒ Object
42
43
44
45
46
47
48
49
50
51
|
# 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) ⇒ Object