Class: Rhc::Rest::Key
Constant Summary
Constants included from Rhc::Rest
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#destroy ⇒ Object
(also: #delete)
Delete Key.
-
#initialize(args) ⇒ Key
constructor
A new instance of Key.
-
#update(type, content) ⇒ Object
Update Key.
Methods included from Rhc::Rest
#logger, #parse_response, #process_error_response, #send
Constructor Details
#initialize(args) ⇒ Key
Returns a new instance of Key.
6 7 8 9 10 11 |
# 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 |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
5 6 7 |
# File 'lib/rhc-rest/key.rb', line 5 def content @content end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/rhc-rest/key.rb', line 5 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
5 6 7 |
# File 'lib/rhc-rest/key.rb', line 5 def type @type end |
Instance Method Details
#destroy ⇒ Object Also known as: delete
Delete Key
24 25 26 27 28 29 30 |
# 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 |
#update(type, content) ⇒ Object
Update Key
14 15 16 17 18 19 20 21 |
# 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 |