Module: BridgeCache::Data::BridgeModel
- Included in:
- AffiliatedSubAccount, CourseTemplate, CustomField, BridgeCache::Domain, Enrollment, Grant, Group, GroupEnrollment, LearnerCustomFieldValue, Membership, Program, ProgramEnrollment, ProgramGroupEnrollment, ProgramItem, Tag, Tagging, User
- Defined in:
- app/lib/bridge_cache/data/bridge_model.rb
Instance Method Summary collapse
- #cleanup(row_ids) ⇒ Object
- #create_from_csv_row(row) ⇒ Object
- #import_from_csv(file_path) ⇒ Object
- #webhook_completed(message) ⇒ Object
- #webhook_created(message) ⇒ Object
- #webhook_deleted(message) ⇒ Object
- #webhook_updated(message) ⇒ Object
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() 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() create_or_update_from_webhook() end |
#webhook_deleted(message) ⇒ Object
24 25 26 |
# File 'app/lib/bridge_cache/data/bridge_model.rb', line 24 def webhook_deleted() .payload_class.where(bridge_id: .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() create_or_update_from_webhook() end |