Module: Bulksms
- Extended by:
- Bulksms
- Included in:
- Bulksms
- Defined in:
- lib/bulksms.rb,
lib/bulksms/account.rb,
lib/bulksms/message.rb,
lib/bulksms/railtie.rb,
lib/bulksms/service.rb,
lib/bulksms/version.rb,
lib/bulksms/response.rb,
lib/bulksms/configuration.rb
Defined Under Namespace
Classes: Account, AccountError, Configuration, Message, Railtie, Response, Service
Constant Summary collapse
- VERSION =
"0.5.2"
Instance Method Summary collapse
- #config {|@config| ... } ⇒ Object
-
#credits(*args) ⇒ Object
Request the number of credits available in your account.
-
#deliver(*args) ⇒ Object
Simple wrapper for sending SMS messages via BulkSMS API.
Instance Method Details
#config {|@config| ... } ⇒ Object
18 19 20 21 22 |
# File 'lib/bulksms.rb', line 18 def config @config ||= Configuration.new yield @config if block_given? @config end |
#credits(*args) ⇒ Object
Request the number of credits available in your account. Returns a single float if successful, or raises an AccountError exception.
44 45 46 47 48 |
# File 'lib/bulksms.rb', line 44 def credits(*args) opts = args.last || { } account = Account.new(opts) account.credits end |
#deliver(*args) ⇒ Object
Simple wrapper for sending SMS messages via BulkSMS API. The most simple message should be provided as a hash as follows:
{
:message => "Body of message to send",
:recipient => "+34644477123"
}
An array of messages may also be provided to send multiple SMS in the same HTTP connection.
35 36 37 38 39 40 |
# File 'lib/bulksms.rb', line 35 def deliver(*args) msg = args.shift opts = args.shift || {} service = Service.new(opts) service.deliver(msg) end |