inteltech_sms 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -52,9 +52,9 @@ Example ruby code:
52
52
 
53
53
  === Dummy for testing
54
54
 
55
- A Dummy class is also provided for use with tests. The dummy class will return a response based on the response code given.
56
-
57
- You can instantiate an instance of the DummyInteltechSms, passing the initial credit, and optionally the response code
55
+ A Dummy class is also provided for use with tests. The dummy class will return a response based on the response code given.
56
+ Instantiate an instance of the DummyInteltechSms, passing the initial credit, and optionally the response code.
57
+ Sms messages will be logged to stdout unless log_to_stdout is set to false.
58
58
 
59
59
  Example ruby code:
60
60
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.1.0
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "inteltech_sms"
8
- s.version = "1.0.0"
8
+ s.version = "1.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ian Heggie"]
@@ -8,13 +8,14 @@ require 'inteltech_sms'
8
8
  class DummyInteltechSms < InteltechSms
9
9
 
10
10
 
11
- attr_accessor :credit, :response_code
11
+ attr_accessor :credit, :response_code, :log_to_stdout
12
12
 
13
13
  def initialize(credit, response_code = InteltechSms::SUCCESS_RESPONSE_CODE)
14
14
  super('dummy_user', 'a_secret')
15
15
  @credit = credit.to_i
16
16
  @response_code = response_code
17
17
  @last_sms = ''
18
+ @log_to_stdout = true
18
19
  end
19
20
 
20
21
  def get_credit
@@ -25,13 +26,15 @@ class DummyInteltechSms < InteltechSms
25
26
  def send_sms(sms, message, options = { })
26
27
  this_response_code = response_code_for_sms(sms)
27
28
  @credit -= 1 if this_response_code == InteltechSms::SUCCESS_RESPONSE_CODE
29
+ puts "WOULD HAVE SENT SMS TO #{sms}: #{message} AND RETURNED STATUS: #{this_response_code}" if @log_to_stdout
28
30
  res = InteltechSms::FakeHTTPSuccess.new(this_response_code)
29
31
  process_send_sms_response(res, sms)
30
32
  end
31
33
 
32
34
  def send_multiple_sms(sms, message, options = { })
33
35
  this_response_code = response_code_for_sms(sms)
34
- sms_array = (sms.respond_to?(:each) ? sms : sms.split(','))
36
+ sms_array = (sms.is_a?(Array) ? sms : sms.split(','))
37
+ puts "WOULD HAVE SENT SMS TO #{sms_array.join(', ')}: #{message} AND RETURNED STATUS: #{this_response_code}" if @log_to_stdout
35
38
  @credit -= sms_array.size if this_response_code == InteltechSms::SUCCESS_RESPONSE_CODE
36
39
 
37
40
  ret = [ ]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inteltech_sms
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -162,7 +162,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
162
162
  version: '0'
163
163
  segments:
164
164
  - 0
165
- hash: -1430435096325391718
165
+ hash: 3823831379726241367
166
166
  required_rubygems_version: !ruby/object:Gem::Requirement
167
167
  none: false
168
168
  requirements: