Class: TableSync::Publishing::Batch
- Inherits:
-
Object
- Object
- TableSync::Publishing::Batch
- Defined in:
- lib/table_sync/publishing/batch.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#custom_version ⇒ Object
Returns the value of attribute custom_version.
-
#event ⇒ Object
Returns the value of attribute event.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#object_class ⇒ Object
Returns the value of attribute object_class.
-
#original_attributes ⇒ Object
Returns the value of attribute original_attributes.
-
#routing_key ⇒ Object
Returns the value of attribute routing_key.
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ Batch
constructor
A new instance of Batch.
- #message ⇒ Object
- #publish_later ⇒ Object (also: #publish_async)
- #publish_now ⇒ Object
Constructor Details
#initialize(attrs = {}) ⇒ Batch
Returns a new instance of Batch.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/table_sync/publishing/batch.rb', line 11 def initialize(attrs = {}) attrs = attrs.with_indifferent_access self.object_class = attrs[:object_class] self.original_attributes = attrs[:original_attributes] self.custom_version = attrs[:custom_version] self.routing_key = attrs[:routing_key] self.headers = attrs[:headers] self.event = attrs.fetch(:event, :update).to_sym validate_required_attributes! end |
Instance Attribute Details
#custom_version ⇒ Object
Returns the value of attribute custom_version.
4 5 6 |
# File 'lib/table_sync/publishing/batch.rb', line 4 def custom_version @custom_version end |
#event ⇒ Object
Returns the value of attribute event.
4 5 6 |
# File 'lib/table_sync/publishing/batch.rb', line 4 def event @event end |
#headers ⇒ Object
Returns the value of attribute headers.
4 5 6 |
# File 'lib/table_sync/publishing/batch.rb', line 4 def headers @headers end |
#object_class ⇒ Object
Returns the value of attribute object_class.
4 5 6 |
# File 'lib/table_sync/publishing/batch.rb', line 4 def object_class @object_class end |
#original_attributes ⇒ Object
Returns the value of attribute original_attributes.
4 5 6 |
# File 'lib/table_sync/publishing/batch.rb', line 4 def original_attributes @original_attributes end |
#routing_key ⇒ Object
Returns the value of attribute routing_key.
4 5 6 |
# File 'lib/table_sync/publishing/batch.rb', line 4 def routing_key @routing_key end |
Instance Method Details
#message ⇒ Object
32 33 34 |
# File 'lib/table_sync/publishing/batch.rb', line 32 def TableSync::Publishing::Message::Batch.new(attributes) end |
#publish_later ⇒ Object Also known as: publish_async
24 25 26 |
# File 'lib/table_sync/publishing/batch.rb', line 24 def publish_later job.perform_later(job_attributes) end |
#publish_now ⇒ Object
28 29 30 |
# File 'lib/table_sync/publishing/batch.rb', line 28 def publish_now .publish end |