action_smser 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/helpers/action_smser/application_helper.rb +9 -0
- data/app/models/action_smser/delivery_report.rb +3 -6
- data/app/views/action_smser/delivery_reports/index.html.erb +52 -34
- data/app/views/layouts/action_smser/delivery_reports.html.erb +6 -0
- data/lib/action_smser/base.rb +5 -1
- data/lib/action_smser/delivery_methods/nexmo.rb +21 -18
- data/lib/action_smser/version.rb +1 -1
- data/lib/action_smser.rb +1 -1
- data/test/dummy/log/test.log +9959 -0
- data/test/unit/action_smser/base_test.rb +9 -0
- data/test/unit/action_smser/delivery_methods/nexmo_test.rb +5 -8
- data/test/unit/action_smser/delivery_report_test.rb +7 -7
- metadata +7 -6
@@ -48,6 +48,15 @@ class ActionSmser::BaseTest < ActiveSupport::TestCase
|
|
48
48
|
assert_equal 500, @sms.body_encoded_escaped.size
|
49
49
|
end
|
50
50
|
|
51
|
+
test "ttl should be 24 hours by default" do
|
52
|
+
assert_equal 24.hours, @sms.ttl_to_i
|
53
|
+
end
|
54
|
+
|
55
|
+
test "should be able to change ttl" do
|
56
|
+
@sms.ttl = "60"
|
57
|
+
assert_equal 1.minute, @sms.ttl_to_i
|
58
|
+
end
|
59
|
+
|
51
60
|
test "should be valid sms" do
|
52
61
|
assert @sms.valid?
|
53
62
|
end
|
@@ -18,24 +18,23 @@ class ActionSmser::NexmoTest < ActiveSupport::TestCase
|
|
18
18
|
@sms.delivery_options[:nexmo] = {:username => 'user', :password => 'pass'}
|
19
19
|
assert_equal ActionSmser::DeliveryMethods::Nexmo, @sms.delivery_method, "cant run tests, wrong delivery method"
|
20
20
|
|
21
|
-
http_mock = stub(
|
21
|
+
@http_mock = stub(
|
22
22
|
:body => '{"message-count":"1","messages":[{"message-price":"0.02500000","status":"0","message-id":"0778DE88","remaining-balance":"1.77500000"}]}')
|
23
|
-
ActionSmser::DeliveryMethods::Nexmo.stubs(:deliver_http_request).returns(http_mock)
|
23
|
+
ActionSmser::DeliveryMethods::Nexmo.stubs(:deliver_http_request).returns(@http_mock)
|
24
24
|
end
|
25
25
|
|
26
26
|
test "should be able to deliver" do
|
27
|
+
ActionSmser::DeliveryMethods::Nexmo.expects(:deliver_http_request).twice().returns(@http_mock)
|
27
28
|
@sms_delivery = @sms.deliver
|
28
29
|
assert @sms_delivery
|
29
|
-
assert_equal
|
30
|
+
assert_equal 2, @sms_delivery.count
|
30
31
|
end
|
31
32
|
|
32
33
|
test "with saving delivery_reports" do
|
33
34
|
@sms.delivery_options[:save_delivery_reports] = true
|
34
35
|
@delivery_reports_count = ActionSmser::DeliveryReport.count
|
35
36
|
|
36
|
-
http_mock
|
37
|
-
:body => '{"message-count":"1","messages":[{"message-price":"0.02500000","status":"0","message-id":"0778DE88","remaining-balance":"1.77500000"},{"error-text":"Message rejected by upstream path","message-price":"0.02500000","status":"6","message-id":"0778D302","remaining-balance":"1.87500000"}]}')
|
38
|
-
ActionSmser::DeliveryMethods::Nexmo.stubs(:deliver_http_request).returns(http_mock)
|
37
|
+
ActionSmser::DeliveryMethods::Nexmo.stubs(:deliver_http_request).returns(@http_mock)
|
39
38
|
|
40
39
|
@sms_delivery = @sms.deliver
|
41
40
|
|
@@ -51,8 +50,6 @@ class ActionSmser::NexmoTest < ActiveSupport::TestCase
|
|
51
50
|
|
52
51
|
@dr2 = @sms_delivery.last
|
53
52
|
assert_equal "123555123", @dr2.to, "receiver wrong"
|
54
|
-
assert_equal "0778D302", @dr2.msg_id, "id wrong"
|
55
|
-
assert_equal "SENT_ERROR_6", @dr2.status
|
56
53
|
end
|
57
54
|
|
58
55
|
test "gateway process_delivery_report(params)" do
|
@@ -73,15 +73,15 @@ class ActionSmser::DeliveryReportTest < ActiveSupport::TestCase
|
|
73
73
|
|
74
74
|
@dr = ActionSmser::DeliveryReport.find(@dr.id)
|
75
75
|
|
76
|
-
|
76
|
+
re_delivarable_sms = @dr.re_delivarable_sms()
|
77
77
|
|
78
|
-
assert
|
78
|
+
assert re_delivarable_sms
|
79
|
+
#assert re_delivarable_sms.is_a?(ActionSmser::Base)
|
79
80
|
assert ActionSmser::DeliveryReport.find(@dr.id).re_delivered?
|
80
|
-
|
81
|
-
|
82
|
-
assert
|
83
|
-
assert
|
84
|
-
assert result.second.first.is_a?(ActionSmser::DeliveryReport)
|
81
|
+
|
82
|
+
dr_result = re_delivarable_sms.deliver
|
83
|
+
assert dr_result.is_a?(Array)
|
84
|
+
assert dr_result.first.is_a?(ActionSmser::DeliveryReport)
|
85
85
|
|
86
86
|
@dr_redelivery = ActionSmser::DeliveryReport.last
|
87
87
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: action_smser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 1.
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 1.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Olli Huotari
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-01-
|
18
|
+
date: 2012-01-25 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rails
|
@@ -70,6 +70,7 @@ extensions: []
|
|
70
70
|
extra_rdoc_files: []
|
71
71
|
|
72
72
|
files:
|
73
|
+
- app/helpers/action_smser/application_helper.rb
|
73
74
|
- app/controllers/action_smser/application_controller.rb
|
74
75
|
- app/controllers/action_smser/delivery_reports_controller.rb
|
75
76
|
- app/views/action_smser/delivery_reports/index.html.erb
|
@@ -168,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
169
|
requirements: []
|
169
170
|
|
170
171
|
rubyforge_project:
|
171
|
-
rubygems_version: 1.8.
|
172
|
+
rubygems_version: 1.8.15
|
172
173
|
signing_key:
|
173
174
|
specification_version: 3
|
174
175
|
summary: ActionSmser == SMS && ActionMailer. Simple way to use SMS (Short Message Service) in the same way as ActionMailer. Includes also delivery reports and easy way to add custom gateways (simple http and nexmo by default).
|