Sha256: 00b5e1eb3a3aea622a7e8f1322cb1899ed031c378b7b7b63b7760808ea32874e

Contents?: true

Size: 575 Bytes

Versions: 27

Compression:

Stored size: 575 Bytes

Contents

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

27 entries across 27 versions & 1 rubygems

Version Path
discourse_api-0.34.0 lib/discourse_api/api/backups.rb
discourse_api-0.33.0 lib/discourse_api/api/backups.rb
discourse_api-0.32.0 lib/discourse_api/api/backups.rb
discourse_api-0.31.0 lib/discourse_api/api/backups.rb
discourse_api-0.30.0 lib/discourse_api/api/backups.rb
discourse_api-0.29.0 lib/discourse_api/api/backups.rb
discourse_api-0.28.1 lib/discourse_api/api/backups.rb
discourse_api-0.28.0 lib/discourse_api/api/backups.rb
discourse_api-0.27.0 lib/discourse_api/api/backups.rb
discourse_api-0.26.0 lib/discourse_api/api/backups.rb
discourse_api-0.25.0 lib/discourse_api/api/backups.rb
discourse_api-0.24.0 lib/discourse_api/api/backups.rb
discourse_api-0.23.1 lib/discourse_api/api/backups.rb
discourse_api-0.23.0 lib/discourse_api/api/backups.rb
discourse_api-0.22.0 lib/discourse_api/api/backups.rb
discourse_api-0.20.1 lib/discourse_api/api/backups.rb
discourse_api-0.20.0 lib/discourse_api/api/backups.rb
discourse_api-0.19.0 lib/discourse_api/api/backups.rb
discourse_api-0.18.0 lib/discourse_api/api/backups.rb
discourse_api-0.17.0 lib/discourse_api/api/backups.rb