Class: TableSync::Publishing::Raw

Inherits:
Object
  • Object
show all
Includes:
Utils::RequiredValidator
Defined in:
lib/table_sync/publishing/raw.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils::RequiredValidator

included

Constructor Details

#initialize(attributes = {}) ⇒ Raw

Returns a new instance of Raw.



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/table_sync/publishing/raw.rb', line 15

def initialize(attributes = {})
  attributes = attributes.with_indifferent_access

  self.model_name           = attributes[:model_name]
  self.table_name           = attributes[:table_name]
  self.schema_name          = attributes[:schema_name]
  self.original_attributes  = attributes[:original_attributes]
  self.custom_version       = attributes[:custom_version]
  self.routing_key          = attributes[:routing_key]
  self.headers              = attributes[:headers]
  self.event                = attributes.fetch(:event, :update).to_sym
end

Instance Attribute Details

#custom_versionObject

Returns the value of attribute custom_version.



6
7
8
# File 'lib/table_sync/publishing/raw.rb', line 6

def custom_version
  @custom_version
end

#eventObject

Returns the value of attribute event.



6
7
8
# File 'lib/table_sync/publishing/raw.rb', line 6

def event
  @event
end

#headersObject

Returns the value of attribute headers.



6
7
8
# File 'lib/table_sync/publishing/raw.rb', line 6

def headers
  @headers
end

#model_nameObject

Returns the value of attribute model_name.



6
7
8
# File 'lib/table_sync/publishing/raw.rb', line 6

def model_name
  @model_name
end

#original_attributesObject

Returns the value of attribute original_attributes.



6
7
8
# File 'lib/table_sync/publishing/raw.rb', line 6

def original_attributes
  @original_attributes
end

#routing_keyObject

Returns the value of attribute routing_key.



6
7
8
# File 'lib/table_sync/publishing/raw.rb', line 6

def routing_key
  @routing_key
end

#schema_nameObject

Returns the value of attribute schema_name.



6
7
8
# File 'lib/table_sync/publishing/raw.rb', line 6

def schema_name
  @schema_name
end

#table_nameObject

Returns the value of attribute table_name.



6
7
8
# File 'lib/table_sync/publishing/raw.rb', line 6

def table_name
  @table_name
end

Instance Method Details

#messageObject



34
35
36
# File 'lib/table_sync/publishing/raw.rb', line 34

def message
  TableSync::Publishing::Message::Raw.new(attributes)
end

#publish_nowObject



30
31
32
# File 'lib/table_sync/publishing/raw.rb', line 30

def publish_now
  message.publish
end