Module: BridgeCache::Data::BridgeModel

Instance Method Summary collapse

Instance Method Details

#cleanup(row_ids) ⇒ Object



11
12
13
14
# File 'app/lib/bridge_cache/data/bridge_model.rb', line 11

def cleanup(row_ids)
  # Implement this method in your model if you want to do any sort of post creation cleanup.
  # See tagging.rb for an example.
end

#create_from_csv_row(row) ⇒ Object



7
8
9
# File 'app/lib/bridge_cache/data/bridge_model.rb', line 7

def create_from_csv_row(row)
  BridgeCache::Plugins::CSVDump::dump_row(self, row)
end

#import_from_csv(file_path) ⇒ Object



3
4
5
# File 'app/lib/bridge_cache/data/bridge_model.rb', line 3

def import_from_csv(file_path)
  BridgeCache::Plugins::CSVDump::dump_to_table(self, file_path)
end

#webhook_completed(message) ⇒ Object



28
29
30
# File 'app/lib/bridge_cache/data/bridge_model.rb', line 28

def webhook_completed(message)
  raise "Method not implemented"
end

#webhook_created(message) ⇒ Object



20
21
22
# File 'app/lib/bridge_cache/data/bridge_model.rb', line 20

def webhook_created(message)
  create_or_update_from_webhook(message)
end

#webhook_deleted(message) ⇒ Object



24
25
26
# File 'app/lib/bridge_cache/data/bridge_model.rb', line 24

def webhook_deleted(message)
  message.payload_class.where(bridge_id: message.resource_object['id']).destroy_all
end

#webhook_updated(message) ⇒ Object



16
17
18
# File 'app/lib/bridge_cache/data/bridge_model.rb', line 16

def webhook_updated(message)
  create_or_update_from_webhook(message)
end