Sha256: 81e81d6a0081d0b47db2b8e070d90e189b0d6e0713bf1f225ce3f352e52587d3

Contents?: true

Size: 749 Bytes

Versions: 4

Compression:

Stored size: 749 Bytes

Contents

module Octopi
  class DeployKey < Base
    include Resource
    set_resource_name "public_key"

    attr_accessor :title, :id, :key

    create_path "/repos/key/:id/add"
    delete_path "/repos/key/:id/remove"
    find_path "/repos/keys/:id"

    def self.all(options={})
      ensure_hash(options)
      user, repo = gather_details(options)
      self.validate_args(repo => :repo)
      DeployKeySet.new(repo, find_plural([repo], :find))
    end

    def self.create(options={})
      ensure_hash(options)
      repo = options.delete(:repo)
      options[:id] = repo.name
      resp = Api.api.post(path_for(:create), options.merge(:cache => false))
      DeployKeySet.new(repo, resp[resource_name(:plural)].map {|k| self.new(k)})
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dcuddeback-octopi-0.2.12 lib/octopi/deploy_key.rb
dcuddeback-octopi-0.2.11 lib/octopi/deploy_key.rb
dcuddeback-octopi-0.2.9 lib/octopi/deploy_key.rb
dcuddeback-octopi-0.2.8 lib/octopi/deploy_key.rb