class InfobipApi::Utils
Public Class Methods
empty(obj)
click to toggle source
# File lib/infobipapi/utils.rb, line 83 def self.empty(obj) if obj == nil return true end if obj.instance_of? Hash or obj.instance_of? Array or obj.instance_of? String return obj.size == 0 end return obj == 0 end
get_random_alphanumeric_string(length=10)
click to toggle source
# File lib/infobipapi/utils.rb, line 112 def self.get_random_alphanumeric_string(length=10) get_random_string(length, 'qwertzuiopasdfghjklyxcvbnm123456789') end
get_random_string(length, chars)
click to toggle source
# File lib/infobipapi/utils.rb, line 95 def self.get_random_string(length, chars) if not length raise "Invalid random string length: #{length}" end if not chars raise "Invalid random chars: #{chars}" end result = '' length.times do result += chars[rand(chars.length - 1), 1] end result end
in_gsm7_set?(c)
click to toggle source
# File lib/infobipapi/utils.rb, line 116 def self.in_gsm7_set?(c) @@gsm7_set.has_key?(c) end