Module: DiscourseApi::API::Backups
- Included in:
- Client
- Defined in:
- lib/discourse_api/api/backups.rb
Instance Method Summary collapse
- #backups ⇒ Object
- #create_backup ⇒ Object
- #download_backup(file_name, destination) ⇒ Object
- #restore_backup(file_name) ⇒ Object
Instance Method Details
#backups ⇒ Object
5 6 7 8 |
# File 'lib/discourse_api/api/backups.rb', line 5 def backups response = get("/admin/backups.json") response.body end |
#create_backup ⇒ Object
10 11 12 |
# File 'lib/discourse_api/api/backups.rb', line 10 def create_backup post("/admin/backups", with_uploads: true) end |
#download_backup(file_name, destination) ⇒ Object
18 19 20 21 22 |
# File 'lib/discourse_api/api/backups.rb', line 18 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 |
#restore_backup(file_name) ⇒ Object
14 15 16 |
# File 'lib/discourse_api/api/backups.rb', line 14 def restore_backup(file_name) post("/admin/backups/#{file_name}/restore") end |