Module: Spice::Connection::Roles

Included in:
Spice::Connection
Defined in:
lib/spice/connection/roles.rb

Instance Method Summary collapse

Instance Method Details

#role(name) ⇒ Spice::Role

Retrieve a single role

Examples:

Retrieve the role “app_server”

Spice.role("app_server")

Parameters:

  • name (String)

    The role name

Returns:

Raises:


20
21
22
23
# File 'lib/spice/connection/roles.rb', line 20

def role(name)
  attributes = get("/roles/#{name}")
  Spice::Role.new(attributes)
end

#roles(options = Mash.new) ⇒ Array<Spice::Role>

A collection of roles

Examples:

Retrieve all roles that start with “app_”

Spice.roles(:q => "name:app_*")

Parameters:

  • options (Hash) (defaults to: Mash.new)

    An options hash that is passed to Search#search

Returns:

See Also:


10
11
12
# File 'lib/spice/connection/roles.rb', line 10

def roles(options=Mash.new)
  search('role', options)
end