Class: RHC::Rest::User

Inherits:
Base show all
Defined in:
lib/rhc/rest/user.rb

Direct Known Subclasses

Mock::MockRestUser

Instance Method Summary collapse

Methods inherited from Base

#add_message, #has_param?, #initialize, #link_href, #links, #rest_method, #supports?

Methods included from AttributesClass

#define_attr, #model_name

Methods included from Attributes

#attribute, #attributes, #attributes=, #clear_attribute

Constructor Details

This class inherits a constructor from RHC::Rest::Base

Instance Method Details

#add_key(name, content, type) ⇒ Object



8
9
10
11
# File 'lib/rhc/rest/user.rb', line 8

def add_key(name, content, type)
  debug "Add key #{name} of type #{type} for user #{}"
  rest_method "ADD_KEY", :name => name, :type => type, :content => content
end

#capabilitiesObject



27
28
29
# File 'lib/rhc/rest/user.rb', line 27

def capabilities
  @capabilities ||= OpenStruct.new attribute('capabilities')
end

#find_key(name) ⇒ Object

Find Key by name



19
20
21
# File 'lib/rhc/rest/user.rb', line 19

def find_key(name)
  keys.detect { |key| key.name == name }
end

#keysObject



13
14
15
16
# File 'lib/rhc/rest/user.rb', line 13

def keys
  debug "Getting all keys for user #{}"
  rest_method "LIST_KEYS"
end

#max_domainsObject



23
24
25
# File 'lib/rhc/rest/user.rb', line 23

def max_domains
  attributes['max_domains'] || 1
end