Class: Splat::Bulksmspune

Inherits:
Gateway
  • Object
show all
Defined in:
lib/splat/vendors/bulksmspune/bulksmspune_gateway.rb

Instance Attribute Summary

Attributes inherited from Gateway

#vendor

Instance Method Summary collapse

Methods inherited from Gateway

[], #config_option, #configuration, default_configuration, inherited, #required_config

Methods included from Utils

#url_escape

Methods included from Insertion

#insert_values

Constructor Details

#initializeBulksmspune

Returns a new instance of Bulksmspune.



8
9
10
11
12
13
14
15
16
# File 'lib/splat/vendors/bulksmspune/bulksmspune_gateway.rb', line 8

def initialize()
  super
  self.required_config([:provider_url, :username, :password, :senderid])
  @url = "#{self.config_option(:provider_url)}?user=#{self.config_option(:username)}&pwd=#{self.config_option(:password)}&senderid=#{self.config_option(:senderid)}"

  #if options[:callbacks]
  #   before_send = options[:callback][:before_send]
  #end
end

Instance Method Details

#send_bulk_sms(message, numbers, options = {}) ⇒ Object



23
24
25
26
27
# File 'lib/splat/vendors/bulksmspune/bulksmspune_gateway.rb', line 23

def send_bulk_sms(message, numbers, options = {})
  numbers = numbers.collect{ |x| parse_number(x) }.join(',')
  options[:response].message = call_service(message, numbers)
  options[:response]
end

#send_bulk_sms_with_insertion(message, insertions = {}, options = {}) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/splat/vendors/bulksmspune/bulksmspune_gateway.rb', line 29

def send_bulk_sms_with_insertion(message, insertions = {}, options = {})
  
  number_message_map  = insert_values(message, insertions)
  number_message_map.each do |number, message|
     options[:response].add(number, call_service(message, parse_number(number)))
  end
  options[:response]
end

#send_sms(message, number, options = {}) ⇒ Object



18
19
20
21
# File 'lib/splat/vendors/bulksmspune/bulksmspune_gateway.rb', line 18

def send_sms(message, number, options = {})
  options[:response].add(number, call_service(message, parse_number(number)))
   options[:response]
end