Module: Simsen

Defined in:
lib/simsen.rb,
lib/simsen/base.rb,
lib/simsen/version.rb,
lib/simsen/bulksms_com.rb

Defined Under Namespace

Classes: Base, BulksmsCom

Constant Summary collapse

VERSION =
"0.0.1"
@@gateway =
nil
@@password =
nil
@@sender =
nil
@@testmode =
false
@@testmode_strategy =
:succeed
@@url =
nil
@@username =
nil

Class Method Summary collapse

Class Method Details

.gateway=(value) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/simsen.rb', line 17

def self.gateway=(value)
  if value
    klassname = value.to_s.split("_").map(&:capitalize).join
    @@gateway = Simsen.const_get(klassname)
  end
  self.url = self.gateway::API_URL if self.gateway
end

.new_sms(message, phone_number) ⇒ Object



77
78
79
# File 'lib/simsen.rb', line 77

def self.new_sms(message, phone_number)
  gateway.new_sms(message, phone_number) if gateway.respond_to?(:new_sms)
end

.setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Simsen)

    the object that the method was called on



73
74
75
# File 'lib/simsen.rb', line 73

def self.setup
  yield(self)
end

.testmode=(value) ⇒ Object



43
44
45
# File 'lib/simsen.rb', line 43

def self.testmode=(value)
  @@testmode = value == :on ? true : false
end

.testmode_strategy=(value) ⇒ Object



54
55
56
# File 'lib/simsen.rb', line 54

def self.testmode_strategy=(value)
  @@testmode_strategy = value == :succeed ? :succeed : :fail
end