Class: Providers::Elk

Inherits:
SmsProvider show all
Defined in:
lib/multi_sms/providers/elk.rb

Constant Summary collapse

BASE_DOMAIN =
'api.46elks.com'
API_VERSION =
'a1'

Instance Method Summary collapse

Methods inherited from SmsProvider

#config

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Providers::SmsProvider

Instance Method Details

#send(parameters) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/multi_sms/providers/elk.rb', line 13

def send(parameters)
  base_url = "https://#{config.elk.username}:#{config.elk.password}@#{BASE_DOMAIN}/#{API_VERSION}"
  path = "/SMS"
  { message: [] }
  response = MultiSms.post(base_url, path, parameters)

  MultiSms.parse_json(response.body)
end

#usable?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/multi_sms/providers/elk.rb', line 9

def usable?
  config.elk.username.present? and config.elk.password.present?
end