Module: Spice::Connection::Clients

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

Instance Method Summary collapse

Instance Method Details

#client(name) ⇒ Spice::Client

Retrieve a single client

Examples:

Retrieve the client named “admin”

Spice.client("name")

Parameters:

  • name (String)

    The client name

Returns:

Raises:


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

def client(name)
  attributes = get("/clients/#{name}")
  Spice::Client.get_or_new(attributes)
end

#clients(options = Mash.new) ⇒ Array<Spice::Client>, Array

A collection of clients

Examples:

Retrieve all clients with names that begin with “app”

Spice.clients(: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/clients.rb', line 10

def clients(options=Mash.new)
  search('client', options)
end

#create_client(params = Mash.new) ⇒ Object

def client


25
26
27
28
# File 'lib/spice/connection/clients.rb', line 25

def create_client(params=Mash.new)
  attributes = post("/clients", params)
  Spice::Client.get_or_new(attributes)
end

#delete_client(name) ⇒ Object

def update_client


35
36
37
38
# File 'lib/spice/connection/clients.rb', line 35

def delete_client(name)
  client = delete("/clients/#{name}")
  nil
end

#reregister_client(name) ⇒ Object

def delete_client


40
41
42
43
# File 'lib/spice/connection/clients.rb', line 40

def reregister_client(name)
  attributes = put("/clients/#{name}", :private_key => true)
  Spice::Client.get_or_new(attributes)
end

#update_client(name, params = Mash.new) ⇒ Object

def create_client


30
31
32
33
# File 'lib/spice/connection/clients.rb', line 30

def update_client(name, params=Mash.new)
  attributes = put("/clients/#{name}", params)
  Spice::Client.get_or_new(attributes)
end