class SmsKit::MobiWeb

Constants

ERROR_CODES
HTTP_ENDPOINT

api2.solutions4mobiles.com/bulksms/bulksend.go?msgtext=&originator=&password=mobiweb-pass&phone=491231234567&showDLR=1&username=mail@example.com

Public Instance Methods

deliver() click to toggle source
# File lib/sms_kit/providers/mobi_web.rb, line 25
def deliver
  response = get params
  status   = response.body[/([a-z]+)(\d+)?/i, 1]
  code     = response.body[/([a-z]+)(\d+)?/i, 2]

  if 'ERROR' == status
    raise DeliveryError, "#{ERROR_CODES[code.to_i]} (#{code})"
  end

  status == "OK" ? code.to_i : nil
end
params() click to toggle source
# File lib/sms_kit/providers/mobi_web.rb, line 37
def params
  _data = data.dup
  {
    username:   config.username,
    password:   config.password,
    originator: _data.delete(:from) || config.sender,
    phone:      _data.delete(:to),
    msgtext:    _data.delete(:text),
    showDLR:    _data.delete(:dlr) || 1
  }.merge _data
end