module Punchblock

Constants

BASE_ASTERISK_NAMESPACE
BASE_RAYO_NAMESPACE
Error

This exception may be raised if a transport error is detected.

RAYO_NAMESPACES
RAYO_VERSION
VERSION

Public Class Methods

client_with_connection(type, options) click to toggle source

Get a new Punchblock client with a connection attached

@param [Symbol] type the connection type (eg :XMPP, :asterisk, :freeswitch) @param [Hash] options the options to pass to the connection (credentials, etc

@return [Punchblock::Client] a punchblock client object

# File lib/punchblock.rb, line 53
def client_with_connection(type, options)
  connection = Connection.const_get(type == :xmpp ? 'XMPP' : type.to_s.classify).new options
  Client.new :connection => connection
rescue NameError
  raise ArgumentError, "Connection type #{type.inspect} is not valid."
end
jruby?() click to toggle source
# File lib/punchblock.rb, line 68
def jruby?
  @jruby ||= !!(RUBY_PLATFORM =~ /java/)
end
logger() click to toggle source
# File lib/punchblock.rb, line 33
def logger
  @logger || reset_logger
end
logger=(other) click to toggle source
# File lib/punchblock.rb, line 37
def logger=(other)
  @logger = other
end
new_request_id() click to toggle source
# File lib/punchblock.rb, line 64
def new_request_id
  new_uuid
end
new_uuid() click to toggle source
# File lib/punchblock.rb, line 60
def new_uuid
  SecureRandom.uuid
end
reset_logger() click to toggle source
# File lib/punchblock.rb, line 41
def reset_logger
  @logger = NullObject.new
end