class Smsapi::BulkSMS

Attributes

message[R]
sent[R]
to[R]

Public Class Methods

new(to, message, server, options = {}) click to toggle source
# File lib/smsapi/bulk_sms.rb, line 6
def initialize(to, message, server, options = {})
  @options = default_options.merge options
  @to = to
  @message = message
  @server = server
  @sent = []
end

Public Instance Methods

deliver() click to toggle source
# File lib/smsapi/bulk_sms.rb, line 14
def deliver
  read_response @server.sms(server_params)
  self
end

Private Instance Methods

read_response(response) click to toggle source
# File lib/smsapi/bulk_sms.rb, line 28
def read_response(response)
  response.each do |single_response|
    sms = SMS.new(single_response.split(':').last, message, @server, @options)
    sms.read_response(single_response)
    @sent << sms
  end
end
server_params() click to toggle source
# File lib/smsapi/bulk_sms.rb, line 21
def server_params
  @options.merge(
    to: to.join(','),
    message: message
  )
end