class RailsArchiver::Transport::Base

Public Class Methods

new(model=nil, logger=nil) click to toggle source

@param model [ActiveRecord::Base] the model we will be working with. @param logger [Logger]

# File lib/rails-archiver/transport/base.rb, line 9
def initialize(model=nil, logger=nil)
  @model = model
  @options = {}
  @logger = logger || ::Logger.new(STDOUT)
end

Public Instance Methods

configure(options) click to toggle source

@param options [Hash] A set of options to work with.

# File lib/rails-archiver/transport/base.rb, line 16
def configure(options)
  @options = options
end
retrieve_archive(location=nil) click to toggle source

To be implemented by subclasses. Retrieve the archive that was previously created. @param location [String] if given, the location of the archive (e.g. S3 key). Otherwise will be figured out from the existing model in the database. @return [Hash] the retrieved hash.

# File lib/rails-archiver/transport/base.rb, line 35
def retrieve_archive(location=nil)
  raise NotImplementedError
end
store_archive(hash) click to toggle source

To be implemented by subclasses. Store the archive somewhere to be retrieved later. You should also be storing the location somewhere such as on the model. Use @model to reference it. @param hash [Hash] the hash to store. Generally you'll want to use .to_json on it.

# File lib/rails-archiver/transport/base.rb, line 25
def store_archive(hash)
  raise NotImplementedError
end