Class: RestUser
- Inherits:
-
OpenShift::Model
- Object
- OpenShift::Model
- RestUser
- Defined in:
- app/models/rest_user.rb
Instance Attribute Summary collapse
-
#capabilities ⇒ Object
Returns the value of attribute capabilities.
-
#consumed_gear_sizes ⇒ Object
Returns the value of attribute consumed_gear_sizes.
-
#consumed_gears ⇒ Object
Returns the value of attribute consumed_gears.
-
#links ⇒ Object
Returns the value of attribute links.
-
#login ⇒ Object
Returns the value of attribute login.
-
#max_gears ⇒ Object
Returns the value of attribute max_gears.
-
#plan_id ⇒ Object
Returns the value of attribute plan_id.
-
#usage_account_id ⇒ Object
Returns the value of attribute usage_account_id.
Instance Method Summary collapse
-
#initialize(cloud_user, url, nolinks = false) ⇒ RestUser
constructor
A new instance of RestUser.
- #to_xml(options = {}) ⇒ Object
Constructor Details
#initialize(cloud_user, url, nolinks = false) ⇒ RestUser
Returns a new instance of RestUser.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/models/rest_user.rb', line 4 def initialize(cloud_user, url, nolinks=false) self.login = cloud_user.login self.consumed_gears = cloud_user.consumed_gears self.max_gears = cloud_user.max_gears self.capabilities = cloud_user.capabilities self.plan_id = cloud_user.plan_id self.usage_account_id = cloud_user.usage_account_id unless nolinks @links = { "LIST_KEYS" => Link.new("Get SSH keys", "GET", URI::join(url, "user/keys")), "ADD_KEY" => Link.new("Add new SSH key", "POST", URI::join(url, "user/keys"), [ Param.new("name", "string", "Name of the key"), 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)"), ]) } @links["DELETE_USER"] = Link.new("Delete user. Only applicable for subaccount users.", "DELETE", URI::join(url, "user"), nil, [ OptionalParam.new("force", "boolean", "Force delete user. i.e. delete any domains and applications under this user", [true, false], false) ]) if cloud_user.parent_user_login end consumed_map = {} if cloud_user.applications cloud_user.applications.each { |a| a.gears.each { |g| size = g.node_profile || Application.DEFAULT_NODE_PROFILE consumed_map[size] = 0 if not consumed_map.has_key? size consumed_map[size] = consumed_map[size] +1 } } end self.consumed_gear_sizes = consumed_map end |
Instance Attribute Details
#capabilities ⇒ Object
Returns the value of attribute capabilities.
2 3 4 |
# File 'app/models/rest_user.rb', line 2 def capabilities @capabilities end |
#consumed_gear_sizes ⇒ Object
Returns the value of attribute consumed_gear_sizes.
2 3 4 |
# File 'app/models/rest_user.rb', line 2 def consumed_gear_sizes @consumed_gear_sizes end |
#consumed_gears ⇒ Object
Returns the value of attribute consumed_gears.
2 3 4 |
# File 'app/models/rest_user.rb', line 2 def consumed_gears @consumed_gears end |
#links ⇒ Object
Returns the value of attribute links.
2 3 4 |
# File 'app/models/rest_user.rb', line 2 def links @links end |
#login ⇒ Object
Returns the value of attribute login.
2 3 4 |
# File 'app/models/rest_user.rb', line 2 def login @login end |
#max_gears ⇒ Object
Returns the value of attribute max_gears.
2 3 4 |
# File 'app/models/rest_user.rb', line 2 def max_gears @max_gears end |
#plan_id ⇒ Object
Returns the value of attribute plan_id.
2 3 4 |
# File 'app/models/rest_user.rb', line 2 def plan_id @plan_id end |
#usage_account_id ⇒ Object
Returns the value of attribute usage_account_id.
2 3 4 |
# File 'app/models/rest_user.rb', line 2 def usage_account_id @usage_account_id end |
Instance Method Details
#to_xml(options = {}) ⇒ Object
39 40 41 42 |
# File 'app/models/rest_user.rb', line 39 def to_xml(={}) [:tag_name] = "user" super() end |