Sha256: 1cc376a01269fb0452dbeb7cb35adaf96bf830bb82062d8386788ea9a93c9031

Contents?: true

Size: 929 Bytes

Versions: 1

Compression:

Stored size: 929 Bytes

Contents

class Apitool::Client::Backup < Apitool::Client::ApitoolClient

  def path_to_b64_path(path)
    Base64.strict_encode64(path)
  end

  def index
    get('/backups') do |response, request, result|
      if response.code == 200
        parse(response)
      else
        nil
      end
    end
  end

  def show(path)
    get("/backups/#{path_to_b64_path(path)}") do |response|
      if response.code == 200
        parse(response)
      else
        nil
      end
    end
  end

  def create(path = '')
    parameters = {
      backup: {
        b64_path: path_to_b64_path(path)
      }
    }
    post("/backups", parameters) do |response|
      if response.code == 200
        parse(response)
      else
        nil
      end
    end
  end

  def destroy(path)
    delete("/backups/#{path_to_b64_path(path)}") do |response|
      if response.code == 200
        parse(response)
      else
        nil
      end
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
apitool-client-0.0.8 lib/apitool/client/backup.rb