class Pantry::Commands::RegisterClient

Public Class Methods

new(client_info = nil) click to toggle source
# File lib/pantry/commands/register_client.rb, line 6
def initialize(client_info = nil)
  @client_info = client_info
end

Public Instance Methods

perform(message) click to toggle source

Take note that a Client has connected and registered itself with this Server.

# File lib/pantry/commands/register_client.rb, line 22
def perform(message)
  details = message.body[0]

  @client_info = Pantry::ClientInfo.new(
    identity:    message.from,
    application: details[:application],
    environment: details[:environment],
    roles:       details[:roles]
  )

  self.server.register_client(@client_info)
end
to_message() click to toggle source
Calls superclass method Pantry::Command#to_message
# File lib/pantry/commands/register_client.rb, line 10
def to_message
  message = super
  message << {
    application: @client_info.application,
    environment: @client_info.environment,
    roles:       @client_info.roles
  }
  message
end