Class: Zizia::RecordImporter
- Inherits:
-
Object
- Object
- Zizia::RecordImporter
- Defined in:
- lib/zizia/record_importer.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#batch_id ⇒ String
An optional batch id for this import run.
-
#failure_count ⇒ Integer
A count of the records that failed import.
-
#success_count ⇒ Integer
A count of the records that were successfully created.
Instance Method Summary collapse
Instance Attribute Details
#batch_id ⇒ String
Returns an optional batch id for this import run.
12 13 14 |
# File 'lib/zizia/record_importer.rb', line 12 def batch_id @batch_id end |
#failure_count ⇒ Integer
Returns a count of the records that failed import.
12 |
# File 'lib/zizia/record_importer.rb', line 12 attr_accessor :batch_id, :success_count, :failure_count |
#success_count ⇒ Integer
Returns a count of the records that were successfully created.
12 |
# File 'lib/zizia/record_importer.rb', line 12 attr_accessor :batch_id, :success_count, :failure_count |
Instance Method Details
#import(record:) ⇒ void
This method returns an undefined value.
18 19 20 21 22 23 24 25 |
# File 'lib/zizia/record_importer.rb', line 18 def import(record:) create_for(record: record) rescue Faraday::ConnectionFailed, Ldp::HttpError => e Rails.logger.error "[zizia] #{e}" rescue RuntimeError => e Rails.logger.error "[zizia] #{e}" raise e end |
#import_type ⇒ Object
27 28 29 30 31 32 |
# File 'lib/zizia/record_importer.rb', line 27 def import_type raise 'No curation_concern found for import' unless defined?(Hyrax) && Hyrax&.config&.curation_concerns&.any? Hyrax.config.curation_concerns.first end |