Sha256: db1807fdf7cef80c062d576f5a4c4d128814c208731ca44783c07f93a1f79934

Contents?: true

Size: 605 Bytes

Versions: 22

Compression:

Stored size: 605 Bytes

Contents

# frozen_string_literal: true
module DiscourseApi
  module API
    module Backups
      def backups
        response = get("/admin/backups.json")
        response.body
      end

      def create_backup
        post("/admin/backups", with_uploads: true)
      end

      def restore_backup(file_name)
        post("/admin/backups/#{file_name}/restore")
      end

      def download_backup(file_name, destination)
        response = get("/admin/backups/#{file_name}")
        # write file
        File.open("#{destination}/#{file_name}", 'wb') { |fp| fp.write(response.body) }
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
discourse_api-1.1.0 lib/discourse_api/api/backups.rb
discourse_api-1.0.0 lib/discourse_api/api/backups.rb
discourse_api-0.48.1 lib/discourse_api/api/backups.rb
discourse_api-0.48.0 lib/discourse_api/api/backups.rb
discourse_api-0.47.0 lib/discourse_api/api/backups.rb
discourse_api-0.46.0 lib/discourse_api/api/backups.rb
discourse_api-0.45.1 lib/discourse_api/api/backups.rb
discourse_api-0.45.0 lib/discourse_api/api/backups.rb
discourse_api-0.44.0 lib/discourse_api/api/backups.rb
discourse_api-0.43.1 lib/discourse_api/api/backups.rb
discourse_api-0.43.0 lib/discourse_api/api/backups.rb
discourse_api-0.42.0 lib/discourse_api/api/backups.rb
discourse_api-0.41.0 lib/discourse_api/api/backups.rb
discourse_api-0.40.0 lib/discourse_api/api/backups.rb
discourse_api-0.39.3 lib/discourse_api/api/backups.rb
discourse_api-0.39.2 lib/discourse_api/api/backups.rb
discourse_api-0.39.1 lib/discourse_api/api/backups.rb
discourse_api-0.39.0 lib/discourse_api/api/backups.rb
discourse_api-0.38.0 lib/discourse_api/api/backups.rb
discourse_api-0.37.0 lib/discourse_api/api/backups.rb