inteltech_sms 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -11,3 +11,7 @@ before_install:
11
11
  - gem --version
12
12
  - gem install bundler
13
13
  - bundle --version
14
+ before_script:
15
+ - bundle exec rake install
16
+ env:
17
+ - TEST_GEM=true
data/Gemfile CHANGED
@@ -9,7 +9,11 @@ group :development do
9
9
  gem "rdoc", "~> 3.12"
10
10
  gem "bundler", "~> 1.2.3"
11
11
  gem "jeweler", "~> 1.8.4"
12
- gem "rcov", ">= 0"
12
+ gem "travis-lint", ">= 0"
13
13
  gem 'shoulda-context', '>= 0'
14
14
  end
15
15
 
16
+ group :test do
17
+ gem "rcov", ">= 0", :platforms => :ruby_18
18
+ gem "simplecov", ">= 0", :require => false, :platforms => :ruby_19
19
+ end
data/Gemfile.lock CHANGED
@@ -2,17 +2,25 @@ GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
4
  git (1.2.5)
5
+ hashr (0.0.22)
5
6
  jeweler (1.8.4)
6
7
  bundler (~> 1.0)
7
8
  git (>= 1.2.5)
8
9
  rake
9
10
  rdoc
10
11
  json (1.7.6)
12
+ multi_json (1.5.0)
11
13
  rake (10.0.3)
12
14
  rcov (1.0.0)
13
15
  rdoc (3.12)
14
16
  json (~> 1.4)
15
17
  shoulda-context (1.0.2)
18
+ simplecov (0.7.1)
19
+ multi_json (~> 1.0)
20
+ simplecov-html (~> 0.7.1)
21
+ simplecov-html (0.7.1)
22
+ travis-lint (1.5.0)
23
+ hashr (~> 0.0.22)
16
24
 
17
25
  PLATFORMS
18
26
  ruby
@@ -23,3 +31,5 @@ DEPENDENCIES
23
31
  rcov
24
32
  rdoc (~> 3.12)
25
33
  shoulda-context
34
+ simplecov
35
+ travis-lint
data/README.rdoc CHANGED
@@ -2,16 +2,6 @@
2
2
 
3
3
  InteltechSms is a ruby gem that provides an InteltechSms class to check credit and send SMS text messages to single or multiple recipients
4
4
 
5
- == Contributing to inteltech_sms
6
-
7
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
- * Fork the project.
10
- * Start a feature/bugfix branch.
11
- * Commit and push until you are happy with your contribution.
12
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
-
15
5
  == Installation
16
6
 
17
7
  As a Plugin (eg rails 2.3.x)
@@ -64,7 +54,25 @@ Example ruby code:
64
54
 
65
55
  Travis CI testing result: {<img src="https://travis-ci.org/ianheggie/inteltech_sms.png" />}[https://travis-ci.org/ianheggie/inteltech_sms]
66
56
 
57
+ == Contributing to inteltech_sms
58
+
59
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
60
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
61
+ * Fork the project.
62
+ * Start a feature/bugfix branch.
63
+ * Commit and push until you are happy with your contribution.
64
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
65
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
66
+
67
67
  == Copyright
68
68
 
69
69
  Copyright (c) 2013 Ian Heggie. See LICENSE.txt for further details.
70
70
 
71
+ === Main Contributors
72
+
73
+ * Ian Heggie - Developer - Heggie Enterprises Pty Ltd - Contributed development of tests and packaging as gem
74
+ * Timelapse Pty Ltd (timelapse.com.au) - Paid for development of lib/inteltech_sms.rb and released code for public use
75
+
76
+ === Other/Ongoing Contributors
77
+ * Intelligent Technologies - Contributing an hour and 5% commission to development costs
78
+
data/Rakefile CHANGED
@@ -32,22 +32,32 @@ Rake::TestTask.new(:test) do |test|
32
32
  test.verbose = true
33
33
  end
34
34
 
35
- require 'rcov/rcovtask'
36
- Rcov::RcovTask.new do |test|
37
- test.libs << 'test'
38
- test.pattern = 'test/**/test_*.rb'
39
- test.verbose = true
40
- test.rcov_opts << '--exclude "gems/*"'
35
+ begin
36
+ require 'rcov/rcovtask'
37
+ Rcov::RcovTask.new do |test|
38
+ test.libs << 'test'
39
+ test.pattern = 'test/**/test_*.rb'
40
+ test.verbose = true
41
+ test.rcov_opts << '--exclude "gems/*"'
42
+ end
43
+ rescue LoadError
44
+ puts "rcov (or a dependency) is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
41
45
  end
42
46
 
43
47
  task :default => :test
44
48
 
45
- require 'rdoc/task'
46
- Rake::RDocTask.new do |rdoc|
47
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
49
+ begin
50
+ require 'rdoc/task'
51
+ Rake::RDocTask.new do |rdoc|
52
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
48
53
 
49
- rdoc.rdoc_dir = 'rdoc'
50
- rdoc.title = "inteltech_sms #{version}"
51
- rdoc.rdoc_files.include('README*')
52
- rdoc.rdoc_files.include('lib/**/*.rb')
54
+ rdoc.rdoc_dir = 'rdoc'
55
+ rdoc.title = "inteltech_sms #{version}"
56
+ rdoc.rdoc_files.include('README*')
57
+ rdoc.rdoc_files.include('lib/**/*.rb')
58
+ end
59
+ rescue LoadError
60
+ puts "rdoc (or a dependency) not available. Install it with: gem install rdoc"
53
61
  end
62
+
63
+ # vi: sw=2 sm ai:
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.2
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "inteltech_sms"
8
- s.version = "0.1.0"
8
+ s.version = "0.1.2"
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"]
@@ -43,20 +43,20 @@ Gem::Specification.new do |s|
43
43
  s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
44
44
  s.add_development_dependency(%q<bundler>, ["~> 1.2.3"])
45
45
  s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
46
- s.add_development_dependency(%q<rcov>, [">= 0"])
46
+ s.add_development_dependency(%q<travis-lint>, [">= 0"])
47
47
  s.add_development_dependency(%q<shoulda-context>, [">= 0"])
48
48
  else
49
49
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
50
50
  s.add_dependency(%q<bundler>, ["~> 1.2.3"])
51
51
  s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
52
- s.add_dependency(%q<rcov>, [">= 0"])
52
+ s.add_dependency(%q<travis-lint>, [">= 0"])
53
53
  s.add_dependency(%q<shoulda-context>, [">= 0"])
54
54
  end
55
55
  else
56
56
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
57
57
  s.add_dependency(%q<bundler>, ["~> 1.2.3"])
58
58
  s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
59
- s.add_dependency(%q<rcov>, [">= 0"])
59
+ s.add_dependency(%q<travis-lint>, [">= 0"])
60
60
  s.add_dependency(%q<shoulda-context>, [">= 0"])
61
61
  end
62
62
  end
data/test/helper.rb CHANGED
@@ -10,8 +10,11 @@ end
10
10
  require 'test/unit'
11
11
  require 'shoulda-context'
12
12
 
13
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
- $LOAD_PATH.unshift(File.dirname(__FILE__))
13
+ unless ENV['TEST_GEM']
14
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
15
+ end
16
+ #$LOAD_PATH.unshift(File.dirname(__FILE__))
17
+
15
18
  require 'inteltech_sms'
16
19
 
17
20
  class Test::Unit::TestCase
@@ -80,7 +80,7 @@ class TestInteltechSms < Test::Unit::TestCase
80
80
 
81
81
  context "with blank username" do
82
82
  setup do
83
- @bad_gateway = InteltechSms.new('', @@secure_key)
83
+ @bad_gateway = InteltechSms.new('', SECURE_KEY_WITHOUT_CREDIT)
84
84
  end
85
85
 
86
86
  should "raise an Unauthorized Error exception when get_credit is called" do
@@ -112,30 +112,32 @@ class TestInteltechSms < Test::Unit::TestCase
112
112
  # --------------------------------------------------
113
113
  # Code 2015 The destination mobile number is invalid.
114
114
 
115
- context "with a bad sms number" do
116
- setup do
117
- @good_gateway = InteltechSms.new(@@username, @@secure_key)
118
- end
115
+ if defined? @@username
116
+ context "with a bad sms number" do
117
+ setup do
118
+ @good_gateway = InteltechSms.new(@@username, @@secure_key)
119
+ end
119
120
 
120
- should "raise a BadRequest Error exception when send_sms is called" do
121
- ex = assert_raises InteltechSms::Error do
122
- @good_gateway.send_sms BAD_SMS, 'test'
121
+ should "raise a BadRequest Error exception when send_sms is called" do
122
+ ex = assert_raises InteltechSms::Error do
123
+ @good_gateway.send_sms BAD_SMS, 'test'
124
+ end
125
+ assert_equal InteltechSms::BadRequest.new(BAD_SMS, "2015"), ex.response
123
126
  end
124
- assert_equal InteltechSms::BadRequest.new(BAD_SMS, "2015"), ex.response
125
- end
126
127
 
127
- should "return an array with BadRequest responses when send_multiple_sms is called with some bad numbers" do
128
- @res = @good_gateway.send_multiple_sms [BAD_SMS, TEST_SMS, LANDLINE_SMS], 'Test from Ruby'
129
- assert_kind_of Array, @res
130
- assert_equal 3, @res.length, "send_multiple_sms returns results for each sms sent"
131
- assert_kind_of InteltechSms::BadRequest, @res[0], "send_multiple_sms returns BadRequest for 1st element"
132
- assert_equal InteltechSms::BadRequest.new(BAD_SMS, "2015"), @res[0]
133
- assert_kind_of InteltechSms::Success, @res[1], "send_multiple_sms returns Success for 2nd element"
134
- assert_equal InteltechSms::Success.new(TEST_SMS, "0000"), @res[1]
135
- assert_kind_of InteltechSms::BadRequest, @res[2], "send_multiple_sms returns BadRequest for 2nd element"
136
- assert_equal InteltechSms::BadRequest.new(LANDLINE_SMS, "2015"), @res[2]
137
- end
128
+ should "return an array with BadRequest responses when send_multiple_sms is called with some bad numbers" do
129
+ @res = @good_gateway.send_multiple_sms [BAD_SMS, TEST_SMS, LANDLINE_SMS], 'Test from Ruby'
130
+ assert_kind_of Array, @res
131
+ assert_equal 3, @res.length, "send_multiple_sms returns results for each sms sent"
132
+ assert_kind_of InteltechSms::BadRequest, @res[0], "send_multiple_sms returns BadRequest for 1st element"
133
+ assert_equal InteltechSms::BadRequest.new(BAD_SMS, "2015"), @res[0]
134
+ assert_kind_of InteltechSms::Success, @res[1], "send_multiple_sms returns Success for 2nd element"
135
+ assert_equal InteltechSms::Success.new(TEST_SMS, "0000"), @res[1]
136
+ assert_kind_of InteltechSms::BadRequest, @res[2], "send_multiple_sms returns BadRequest for 2nd element"
137
+ assert_equal InteltechSms::BadRequest.new(LANDLINE_SMS, "2015"), @res[2]
138
+ end
138
139
 
140
+ end
139
141
  end
140
142
 
141
143
  # --------------------------------------------------
@@ -174,7 +176,7 @@ class TestInteltechSms < Test::Unit::TestCase
174
176
 
175
177
  context "With an incorrect secure_key" do
176
178
  setup do
177
- @bad_gateway = InteltechSms.new(@@username, BAD_SECURE_KEY)
179
+ @bad_gateway = InteltechSms.new(USERNAME_WITHOUT_CREDIT, BAD_SECURE_KEY)
178
180
  end
179
181
 
180
182
  should "raise an Unauthorized Error exception when get_credit is called" do
@@ -205,7 +207,7 @@ class TestInteltechSms < Test::Unit::TestCase
205
207
 
206
208
  context "with blank secure_key" do
207
209
  setup do
208
- @bad_gateway = InteltechSms.new(@@username, '')
210
+ @bad_gateway = InteltechSms.new(USERNAME_WITHOUT_CREDIT, '')
209
211
  end
210
212
 
211
213
  should "raise an Unauthorized Error exception when get_credit is called" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inteltech_sms
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ian Heggie
@@ -75,7 +75,7 @@ dependencies:
75
75
  - 0
76
76
  version: "0"
77
77
  version_requirements: *id004
78
- name: rcov
78
+ name: travis-lint
79
79
  prerelease: false
80
80
  type: :development
81
81
  - !ruby/object:Gem::Dependency