Class: RestKey
- Inherits:
-
OpenShift::Model
- Object
- OpenShift::Model
- RestKey
- Defined in:
- app/models/rest_key.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#links ⇒ Object
Returns the value of attribute links.
-
#name ⇒ Object
Returns the value of attribute name.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(name, content, type, url, nolinks = false) ⇒ RestKey
constructor
A new instance of RestKey.
- #to_xml(options = {}) ⇒ Object
Constructor Details
#initialize(name, content, type, url, nolinks = false) ⇒ RestKey
Returns a new instance of RestKey.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/models/rest_key.rb', line 4 def initialize(name, content, type, url, nolinks=false) self.name= name self.content = content self.type = type || Key::DEFAULT_SSH_KEY_TYPE self.links = { "GET" => Link.new("Get SSH key", "GET", URI::join(url, "user/keys/#{name}")), "UPDATE" => Link.new("Update SSH key", "PUT", URI::join(url, "user/keys/#{name}"), [ Param.new("type", "string", "Type of Key", Key::VALID_SSH_KEY_TYPES), Param.new("content", "string", "The key portion of an ssh key (excluding ssh type and comment)"), ]), "DELETE" => Link.new("Delete SSH key", "DELETE", URI::join(url, "user/keys/#{name}")) } unless nolinks end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
2 3 4 |
# File 'app/models/rest_key.rb', line 2 def content @content end |
#links ⇒ Object
Returns the value of attribute links.
2 3 4 |
# File 'app/models/rest_key.rb', line 2 def links @links end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'app/models/rest_key.rb', line 2 def name @name end |
#type ⇒ Object
Returns the value of attribute type.
2 3 4 |
# File 'app/models/rest_key.rb', line 2 def type @type end |
Instance Method Details
#to_xml(options = {}) ⇒ Object
19 20 21 22 |
# File 'app/models/rest_key.rb', line 19 def to_xml(={}) [:tag_name] = "key" super() end |