Sha256: 28226059218549323129c18dca6f0fa66aaf928c98d11d23dbc74c89a8e3e1a6

Contents?: true

Size: 526 Bytes

Versions: 1

Compression:

Stored size: 526 Bytes

Contents

module StatusPageVi
  class BackupService < BaseService
    def self.backup(path, resource)
      resources(resource).each do |resource|
        FileUtils.cp(
          resource.cache_file_path,
          "#{path}/#{resource.name.split("::").last}.json"
        )
      end
    end

    def self.restore(path_to_file)
      validator = StatusPageVi::BackupFileValidator.new(path_to_file)

      raise InvalidBackup unless validator.valid_backup?

      validator.resource.update_storage(validator.json_data)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
status_page_vi-0.2.0 lib/status_page_vi/services/backup_service.rb