Module: ImportableAttachments::Base::InstanceMethods

Defined in:
lib/importable_attachments/base.rb

Instance Method Summary collapse

Instance Method Details

#import_attachmentObject

: call-seq: import_attachment

imports an attachment of a given mime-type (data-stream to ruby), calls import_rows with a ruby data-store

NOTE: this is a stub

Raises:

  • (RuntimeError)


86
87
88
# File 'lib/importable_attachments/base.rb', line 86

def import_attachment
  raise RuntimeError, '[importable_attachments] .import_attachment not implemented'
end

#import_rows(*opts) ⇒ Object

: call-seq: import_rows params

imports an attachment contents into :import_into association

NOTE: this is a stub

Raises:

  • (RuntimeError)


97
98
99
100
101
# File 'lib/importable_attachments/base.rb', line 97

def import_rows(*opts)
  return unless self.attachment
  logger.debug "[importable_attachments] .import_rows #{opts}"
  raise RuntimeError, '[importable_attachments] .import_rows not implemented'
end

#invalid_attachment_error(msg) ⇒ Object



103
104
105
106
# File 'lib/importable_attachments/base.rb', line 103

def invalid_attachment_error(msg)
  attachment.errors.add(:base, msg)
  errors.add(:attachment, 'invalid attachment')
end