Module: ActionSms::ConnectionAdapters::TestHelpers::SMSGlobal

Defined in:
lib/action_sms/connection_adapters/test_helpers/sms_global.rb

Instance Method Summary collapse

Instance Method Details

#sample_configuration(options = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/action_sms/connection_adapters/test_helpers/sms_global.rb', line 6

def sample_configuration(options = {})
  config = {
    :adapter => "sms_global",
    :user => "SMSGlobal Username",
    :password => "SMSGlobal Password"
  }
  config.merge!(
    :authentication_key => "My Unique Authentication Key"
  ) if options[:authentication_key]
  config
end

#sample_delivery_receipt(options = {}) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/action_sms/connection_adapters/test_helpers/sms_global.rb', line 18

def sample_delivery_receipt(options = {})
  options[:message_id] ||= "6942744494999745"
  options[:message_id].gsub!("SMSGlobalMsgID:", "")
  options[:status] ||= "DELIVRD"
  options[:error] ||= "000"
  options[:date] ||= "1005132312"
  {
    "msgid"=> options[:message_id],
    "dlrstatus"=> options[:status],
    "dlr_err"=> options[:error],
    "donedate"=> options[:date]
  }
end

#sample_delivery_response(options = {}) ⇒ Object



32
33
34
35
36
# File 'lib/action_sms/connection_adapters/test_helpers/sms_global.rb', line 32

def sample_delivery_response(options = {})
  options[:failed] ||= false
  options[:message_id] ||= "6942744494999745"
  options[:failed] ? "ERROR: No action requested" : "OK: 0; Sent queued message ID: 86b1a945370734f4 #{sample_message_id(:message_id => options[:message_id])}"
end

#sample_delivery_response_with_message_id(message_id, options = {}) ⇒ Object



38
39
40
41
# File 'lib/action_sms/connection_adapters/test_helpers/sms_global.rb', line 38

def sample_delivery_response_with_message_id(message_id, options = {})
  options.merge!(:message_id => message_id)
  sample_delivery_response(options)
end

#sample_incoming_sms(options = {}) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/action_sms/connection_adapters/test_helpers/sms_global.rb', line 43

def sample_incoming_sms(options = {})
  options[:message] ||= "Endia kasdf ofeao"
  options[:to]      ||= "61447100308"
  options[:from]    ||= "61447100399"
  options[:date]    ||= "2010-05-13 23:59:11"
  sample = {
    "to" => options[:to],
    "from" => options[:from],
    "msg"=> options[:message],
    "date" => options[:date]
  }
  sample.merge!(
    "authentication_key" => @config[:authentication_key]
  ) if options[:authentic]
  sample
end

#sample_message_id(options = {}) ⇒ Object



60
61
62
63
# File 'lib/action_sms/connection_adapters/test_helpers/sms_global.rb', line 60

def sample_message_id(options = {})
  options[:message_id] ||= "6942744494999745"
  "SMSGlobalMsgID:#{options[:message_id]}"
end