Class: Teamspeak::Server

Inherits:
Base
  • Object
show all
Defined in:
lib/teamspeak.rb

Instance Attribute Summary

Attributes inherited from Base

#api, #attributes, #parent, #server

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

create, #initialize, #save, #update_attributes

Constructor Details

This class inherits a constructor from Teamspeak::Base

Class Method Details

.find(*args) ⇒ Object


234
235
236
237
238
239
240
241
242
243
244
# File 'lib/teamspeak.rb', line 234

def find(*args)
	puts "Server FIND: #{args.inspect}"

	if args.first.is_a?(Integer)
		Teamspeak.servers.each {|server|
			return server if server.id == args.first
		}
	else
		# find by conditions eh
	end
end

Instance Method Details

#channelsObject


209
210
211
212
213
# File 'lib/teamspeak.rb', line 209

def channels
	@channels ||= cmd(:channellist)
	@channels.each{|g| g.server = self}
	return Teamspeak::Association.new(@channels, :class => Teamspeak::Channel, :parent => self)
end

#clientsObject


194
195
196
197
198
199
200
201
# File 'lib/teamspeak.rb', line 194

def clients
	@clients ||= cmd(:clientlist)

	# because clientlist should only be called on the Server class, we can assign the server dependency here as well
	@clients.each{|c| c.server = self}

	return @clients
end

#cmd(command, *args) ⇒ Object


189
190
191
192
# File 'lib/teamspeak.rb', line 189

def cmd(command, *args)
	Teamspeak.cmd(:use, id)
	Teamspeak.cmd(command, args[0])
end

#groupsObject


203
204
205
206
207
# File 'lib/teamspeak.rb', line 203

def groups
	@groups ||= cmd(:servergrouplist)
	@groups.each{|g| g.server = self}
	return Teamspeak::Association.new(@groups, :class => Teamspeak::Group, :parent => self)
end

#socketObject


185
186
187
# File 'lib/teamspeak.rb', line 185

def socket
	Teamspeak.socket
end

#tokensObject


215
216
217
218
# File 'lib/teamspeak.rb', line 215

def tokens
	@tokens ||= cmd(:tokenlist)
	return Teamspeak::Association.new(@tokens, :class => Teamspeak::Token, :parent => self)
end