README.rdoc in inteltech_sms-0.1.4 vs README.rdoc in inteltech_sms-1.0.0
- old
+ new
@@ -48,9 +48,52 @@
res2 = gateway.send_multiple_sms([test_sms, test_sms2, landline_sms],'Test from Ruby to multiple numbers')
puts "send_multiple_sms (sending to mobiles should work, sending to a landline should fail):"
puts res2.collect {|r| "sms to #{r.sms} #{r.success? ? 'was successfull' : "failed (#{r.class} with code #{r.response_code})"}."}.join("\n")
+=== Dummy for testing
+
+A Dummy class is also provided for use with tests. The dummy class will return a response based on the response code given.
+
+You can instantiate an instance of the DummyInteltechSms, passing the initial credit, and optionally the response code
+
+Example ruby code:
+
+ require 'rubygems'
+
+ require 'dummy_inteltech_sms'
+
+ test_sms = '123'
+
+ gateway = DummyInteltechSms.new(1)
+
+ credit = gateway.get_credit.inspect
+
+ puts "You have #{credit} Credit/s left"
+
+ res = gateway.send_sms(test_sms,'Test from Ruby')
+ puts "send_sms to #{res.sms} was successfull."
+
+ credit = gateway.get_credit.inspect
+ puts "You have #{credit} Credit/s left"
+
+ begin
+ # This will return no credit
+ res = gateway.send_sms(test_sms,'Test from Ruby')
+ puts "send_sms to #{res.sms} was successfull."
+ rescue ex => InteltechSms::Error
+ puts "send_sms to #{res.sms} failed. Gateway response #{ex.response.class} with code #{ex.response.response_code}."
+ end
+
+ res2 = gateway.send_multiple_sms([test_sms, test_sms2, landline_sms],'Test from Ruby to multiple numbers')
+
+ gateway.response_code = InteltechSms::UNAUTHORIZED_RESPONSE_CODE
+ # OR
+ gateway = DummyInteltechSms.new(1,InteltechSms::UNAUTHORIZED_RESPONSE_CODE)
+
+ puts "send_multiple_sms (sending to mobiles should work, sending to a landline should fail):"
+ puts res2.collect {|r| "sms to #{r.sms} #{r.success? ? 'was successfull' : "failed (#{r.class} with code #{r.response_code})"}."}.join("\n")
+
=== Optional arguments
There are a few optional parameters that the gateway will accept.
• senderid – 15 character custom sender ID which can be a mobile number or a alphanumeric string.