Module: OnSIP::ClassMethods

Included in:
OnSIP
Defined in:
lib/onsip.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#loggerObject



28
29
30
# File 'lib/onsip.rb', line 28

def logger
  @logger ||= init_logger
end

#sessionObject



57
58
59
60
61
62
63
# File 'lib/onsip.rb', line 57

def session
  if @session && @session.established?
    @session
  elsif @username && @password
    @session = Session.create(@username, @password)
  end
end

Instance Method Details

#auth!(username, password) ⇒ Object



52
53
54
55
# File 'lib/onsip.rb', line 52

def auth!(username, password)
  @username, @password = username, password
  @session = Session.create(@username, @password)
end

#connect(uri, options = {}) ⇒ Object



39
40
41
42
# File 'lib/onsip.rb', line 39

def connect(uri, options = {})
  @options = Hashie::Mash.new options
  @connection = Connection.new(options.merge({:uri => uri}))
end

#connectionObject



44
45
46
# File 'lib/onsip.rb', line 44

def connection
  @connection
end

#init_loggerObject



32
33
34
35
36
37
# File 'lib/onsip.rb', line 32

def init_logger
  @logger = Logger.new(STDOUT)
  @logger.level = Logger::DEBUG

  @logger
end

#optionsObject



48
49
50
# File 'lib/onsip.rb', line 48

def options
  @options
end