class Rhc::Rest::Key

Attributes

content[R]
name[R]
type[R]

Public Class Methods

new(args) click to toggle source
# File lib/rhc-rest/key.rb, line 6
def initialize(args)
  @name = args[:name] || args["name"]
  @type = args[:type] || args["type"]
  @content = args[:content] || args["content"]
  @links = args[:links] || args["links"]
end

Public Instance Methods

delete() click to toggle source
Alias for: destroy
destroy() click to toggle source

Delete Key

# File lib/rhc-rest/key.rb, line 24
def destroy
  logger.debug "Deleting key #{self.name}" if @mydebug
  url = @links['DELETE']['href']
  method =  @links['DELETE']['method']
  request = RestClient::Request.new(:url => url, :method => method, :headers => @@headers)
  return send(request)
end
Also aliased as: delete
update(type, content) click to toggle source

Update Key

# File lib/rhc-rest/key.rb, line 14
def update(type, content)
  logger.debug "Updating key #{self.name}" if @mydebug
  url = @links['UPDATE']['href']
  method =  @links['UPDATE']['method']
  payload = {:type => type, :content => content}
  request = RestClient::Request.new(:url => url, :method => method, :headers => @@headers, :payload => payload)
  return send(request)
end