Sha256: 0ebb6db031ed45c1005d447c62bff57ba9d33a54a1f7a46abaf46f0cb21d5c66

Contents?: true

Size: 527 Bytes

Versions: 1

Compression:

Stored size: 527 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_storrage(validator.json_data)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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