class SFRest::Backup

Backup a site or restore onto that site

Public Class Methods

new(conn) click to toggle source

@param [SFRest::Connection] conn

# File lib/sfrest/backup.rb, line 7
def initialize(conn)
  @conn = conn
end

Public Instance Methods

backup_url(site_id, backup_id, lifetime = 60) click to toggle source

Gets a url to download a backup @param [Integer] site_id Node id of site @param [Integer] backup_id Id of backup to delete @param [Integer] lifetime TTL of the url

# File lib/sfrest/backup.rb, line 44
def backup_url(site_id, backup_id, lifetime = 60)
  @conn.get("/api/v1/sites/#{site_id}/backups/#{backup_id}/url?lifetime=#{lifetime}")
end
create_backup(site_id, datum = nil) click to toggle source

Backs up a site. @param [Integer] site_id @param [Hash] datum Options to the backup @option datum [String] 'label' @option datum [Url] 'callback_url' @option datum [String] 'callback_method' GET|POST @option datum [Json] 'caller_data' json encoded string

# File lib/sfrest/backup.rb, line 35
def create_backup(site_id, datum = nil)
  current_path = "/api/v1/sites/#{site_id}/backup"
  @conn.post(current_path, datum.to_json)
end
delete_backup(site_id, backup_id) click to toggle source

Deletes a site backup. @param [Integer] site_id Node id of site @param [Integer] backup_id Id of backup to delete

# File lib/sfrest/backup.rb, line 23
def delete_backup(site_id, backup_id)
  current_path = "/api/v1/sites/#{site_id}/backups/#{backup_id}"
  @conn.delete(current_path)
end
get_backups(site_id, datum = nil) click to toggle source

cool stuff goes here @param [Integer] site_id the node id of the site node @return [Hash]

# File lib/sfrest/backup.rb, line 14
def get_backups(site_id, datum = nil)
  current_path = "/api/v1/sites/#{site_id}/backups"
  pb = SFRest::Pathbuilder.new
  @conn.get URI.parse(pb.build_url_query(current_path, datum)).to_s
end