Class: MultipleMan::ModelPublisher
- Inherits:
-
Object
- Object
- MultipleMan::ModelPublisher
- Defined in:
- lib/multiple_man/model_publisher.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ ModelPublisher
constructor
A new instance of ModelPublisher.
- #publish(records, operation = :create) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ ModelPublisher
Returns a new instance of ModelPublisher.
14 15 16 |
# File 'lib/multiple_man/model_publisher.rb', line 14 def initialize( = {}) self. = .with_indifferent_access end |
Class Method Details
.build(options = {}) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/multiple_man/model_publisher.rb', line 6 def self.build( = {}) if [:async] == true AsyncModelPublisher.new() else new() end end |
Instance Method Details
#publish(records, operation = :create) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/multiple_man/model_publisher.rb', line 18 def publish(records, operation=:create) return unless MultipleMan.configuration.enabled Connection.connect do |connection| all_records(records) do |record| push_record(connection, record, operation) end end end |