mblox 0.4.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/mblox/sms.rb +2 -1
- data/lib/mblox/version.rb +1 -1
- data/mblox.gemspec +1 -1
- data/spec/configuration_spec.rb +5 -5
- data/spec/sms_receipt_spec.rb +10 -10
- data/spec/sms_response_result_spec.rb +9 -9
- data/spec/sms_response_spec.rb +6 -6
- data/spec/sms_spec.rb +42 -39
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YzUzOTg0OWI2N2UyZjBlNDM3ZjA4ZTUzNTZlNDE5NTg4YTIxMTQwMQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NmIwYzg1ZTYzNzRlMjIzYzc2ODE4NTk3OTM0Zjc1Njk5YTY5NGVlYw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MGFhNzJlYjJjMGNiN2Y4ZGZhNzk3YzZmZTc4OTkxY2UyZjE1OWVmMGQzMGNh
|
10
|
+
YmY5Yzk1MjIyMDUyYzI3Yzk3YjZkODVjNmE5NjQ2NTU4NjY3YjQzNDZiNDYw
|
11
|
+
ZWRjZmViNDI5NjhhNTRiMTJiNDRlZmNiMTZiY2VmMDY4ZDA0Mjk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MDRkZTEwYzE0NDk1MGQxZTg5YWNmZWZmMjVjZjQxNGU4Y2JhNjFhYTk1NGE1
|
14
|
+
NjhiNTZlNzU0NDZhYzA3MzYzYzRiNjVhYjhjMGFiYmIyNWEyZDkyM2IyMjc4
|
15
|
+
MWVkMmQ4NmNjMzAyNzI1MTRkZDhmM2YzNzM5NzEyZjIzODBjYWE=
|
data/lib/mblox/sms.rb
CHANGED
@@ -11,6 +11,7 @@ module Mblox
|
|
11
11
|
class InvalidMessageError < ::ArgumentError; end
|
12
12
|
class BatchIdOutOfRangeError < ::ArgumentError; end
|
13
13
|
class InvalidSenderIdError < ::ArgumentError; end
|
14
|
+
class MessageTooLongError < ::ArgumentError; end
|
14
15
|
MAX_LENGTH = 160
|
15
16
|
MAX_SECTION_LENGTH = MAX_LENGTH - "(MSG XXX/XXX): ".size
|
16
17
|
LEGAL_CHARACTERS = "~\`!\"#\$\%&'\(\)*+,-.\/:;<=>?@_£¤¥§¿i¡ÄÅÆÇÉÑÖØÜßâáäåæèéìñòöøóùüú\n\r\tí "
|
@@ -19,7 +20,7 @@ module Mblox
|
|
19
20
|
attr_reader :phone, :message
|
20
21
|
|
21
22
|
ON_MESSAGE_TOO_LONG_HANDLER = {
|
22
|
-
:raise_error => Proc.new { raise
|
23
|
+
:raise_error => Proc.new { raise MessageTooLongError, "Message cannot be longer than #{MAX_LENGTH} characters" },
|
23
24
|
:truncate => Proc.new { |message| Mblox.log "Truncating message due to length. Message was: \"#{message}\" but will now be \"#{message = message[0,MAX_LENGTH]}\""; [message] },
|
24
25
|
:split => Proc.new { |message| split_message(message) }
|
25
26
|
}
|
data/lib/mblox/version.rb
CHANGED
data/mblox.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.3"
|
22
22
|
spec.add_development_dependency "rake"
|
23
|
-
spec.add_development_dependency "rspec"
|
23
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
24
24
|
|
25
25
|
spec.add_runtime_dependency 'activemodel'
|
26
26
|
spec.add_runtime_dependency 'activesupport'
|
data/spec/configuration_spec.rb
CHANGED
@@ -19,7 +19,7 @@ describe Mblox::Configuration do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
it "should default to log level debug" do
|
22
|
-
Mblox.config.log_level.
|
22
|
+
expect(Mblox.config.log_level).to eq(:debug)
|
23
23
|
expect { Mblox.log "Some debug info" }.to_not raise_error
|
24
24
|
end
|
25
25
|
|
@@ -32,7 +32,7 @@ describe Mblox::Configuration do
|
|
32
32
|
it "should not allow log level news when the logger is created before log level is set and should remain in a valid state" do
|
33
33
|
Mblox.config.logger = ::Logger.new("/dev/null")
|
34
34
|
expect { Mblox.config.log_at :news }.to raise_error(ArgumentError, "Mblox log level must be set to :fatal, :error, :warn, :info or :debug")
|
35
|
-
Mblox.config.log_level.
|
35
|
+
expect(Mblox.config.log_level).to eq(:debug)
|
36
36
|
expect { Mblox.log "Some news" }.to_not raise_error
|
37
37
|
end
|
38
38
|
end
|
@@ -40,20 +40,20 @@ describe Mblox::Configuration do
|
|
40
40
|
describe "on_message_too_long" do
|
41
41
|
it "should default to :raise_error" do
|
42
42
|
Mblox.reset_configuration
|
43
|
-
Mblox.config.on_message_too_long.
|
43
|
+
expect(Mblox.config.on_message_too_long).to eq(:raise_error)
|
44
44
|
end
|
45
45
|
|
46
46
|
[:raise_error, :split, :truncate].each do |val|
|
47
47
|
it "should allow the value ':#{val}'" do
|
48
48
|
expect { Mblox.config.on_message_too_long = val }.to_not raise_error
|
49
|
-
Mblox.config.on_message_too_long.
|
49
|
+
expect(Mblox.config.on_message_too_long).to eq(val)
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
53
|
it "should not allow other values and should remain in a valid state" do
|
54
54
|
original = Mblox.config.on_message_too_long
|
55
55
|
expect { Mblox.config.on_message_too_long = :do_nothing }.to raise_error(ArgumentError, "Mblox.config.on_message_too_long must be either :truncate, :split or :raise_error")
|
56
|
-
Mblox.config.on_message_too_long.
|
56
|
+
expect(Mblox.config.on_message_too_long).to eq(original)
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
data/spec/sms_receipt_spec.rb
CHANGED
@@ -105,13 +105,13 @@ describe Mblox::SmsReceipt do
|
|
105
105
|
|
106
106
|
it "should access attributes for valid data" do
|
107
107
|
target = described_class.from_xml(valid)
|
108
|
-
target.batch_id.
|
109
|
-
target.subscriber_number.
|
110
|
-
target.timestamp.
|
111
|
-
target.msg_reference.
|
112
|
-
target.status.
|
113
|
-
target.reason.
|
114
|
-
target.operator.
|
108
|
+
expect(target.batch_id).to eq(batch_id)
|
109
|
+
expect(target.subscriber_number).to eq(subscriber_number)
|
110
|
+
expect(target.timestamp).to eq(DateTime.new(2013,10,7,17,36))
|
111
|
+
expect(target.msg_reference).to eq(msg_reference)
|
112
|
+
expect(target.status).to eq(status)
|
113
|
+
expect(target.reason).to eq(reason)
|
114
|
+
expect(target.operator).to eq(10487)
|
115
115
|
end
|
116
116
|
|
117
117
|
it "should raise error when missing root node" do
|
@@ -137,21 +137,21 @@ describe Mblox::SmsReceipt do
|
|
137
137
|
describe "subscriber_number" do
|
138
138
|
it "should not drop leading character unless it is '1'" do
|
139
139
|
target = described_class.from_xml(unexpected_nested_values)
|
140
|
-
target.subscriber_number.
|
140
|
+
expect(target.subscriber_number).to eq("2#{subscriber_number}")
|
141
141
|
end
|
142
142
|
end
|
143
143
|
|
144
144
|
describe "reason" do
|
145
145
|
it "should leave reason blank if it is nil" do
|
146
146
|
target = described_class.from_xml(unexpected_nested_values)
|
147
|
-
target.reason.
|
147
|
+
expect(target.reason).to be_nil
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
151
151
|
describe "timestamp" do
|
152
152
|
it "should fail gracefully if it can't be converted into a DateTime" do
|
153
153
|
target = described_class.from_xml(unexpected_nested_values)
|
154
|
-
target.timestamp.
|
154
|
+
expect(target.timestamp).to be_nil
|
155
155
|
end
|
156
156
|
end
|
157
157
|
end
|
@@ -5,19 +5,19 @@ describe Mblox::SmsResponse::Result do
|
|
5
5
|
it "cannot be blank" do
|
6
6
|
result = described_class.new(nil, "123")
|
7
7
|
result.valid?
|
8
|
-
result.errors[:code].
|
8
|
+
expect(result.errors[:code]).to include("Code cannot be blank")
|
9
9
|
end
|
10
10
|
|
11
11
|
it "must be a number" do
|
12
12
|
result = described_class.new('abc', "123")
|
13
13
|
result.valid?
|
14
|
-
result.errors[:code].
|
14
|
+
expect(result.errors[:code]).to include("Code must be an integer")
|
15
15
|
end
|
16
16
|
|
17
17
|
it "must be an integer" do
|
18
18
|
result = described_class.new(3.14159, "123")
|
19
19
|
result.valid?
|
20
|
-
result.errors[:code].
|
20
|
+
expect(result.errors[:code]).to include("Code must be an integer")
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -25,18 +25,18 @@ describe Mblox::SmsResponse::Result do
|
|
25
25
|
it "cannot be blank" do
|
26
26
|
result = described_class.new(0, '')
|
27
27
|
result.valid?
|
28
|
-
result.errors[:text].
|
28
|
+
expect(result.errors[:text]).to include("Text cannot be blank")
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
describe "ok?" do
|
33
33
|
it "is true for code 0" do
|
34
|
-
described_class.new(0, "123").
|
34
|
+
expect(described_class.new(0, "123")).to be_ok
|
35
35
|
end
|
36
36
|
|
37
37
|
10.times do |i|
|
38
38
|
it "is false for code #{i+1}" do
|
39
|
-
described_class.new(i+1, "123").
|
39
|
+
expect(described_class.new(i+1, "123")).not_to be_ok
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
@@ -45,18 +45,18 @@ describe Mblox::SmsResponse::Result do
|
|
45
45
|
it "should be true if code and text are the same" do
|
46
46
|
lhs = described_class.new(0, 'OK')
|
47
47
|
rhs = described_class.new(0, 'OK')
|
48
|
-
(lhs
|
48
|
+
expect(lhs).to eq(rhs)
|
49
49
|
end
|
50
50
|
|
51
51
|
it "should be false if code does not match" do
|
52
52
|
lhs = described_class.new(0, 'OK')
|
53
53
|
rhs = described_class.new(4, 'OK')
|
54
|
-
(lhs
|
54
|
+
expect(lhs).not_to eq(rhs)
|
55
55
|
end
|
56
56
|
it "should be false if text does not match" do
|
57
57
|
lhs = described_class.new(0, 'OK')
|
58
58
|
rhs = described_class.new(0, '__OK__')
|
59
|
-
(lhs
|
59
|
+
expect(lhs).not_to eq(rhs)
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end
|
data/spec/sms_response_spec.rb
CHANGED
@@ -5,21 +5,21 @@ describe Mblox::SmsResponse do
|
|
5
5
|
let(:args) { { :request => Mblox::SmsResponse::Result.new(9, "SomeRequest"), :result => Mblox::SmsResponse::Result.new(10, "SomeResult") , :subscriber_result => Mblox::SmsResponse::Result.new(11, "SomeSubscriberResult") } }
|
6
6
|
|
7
7
|
[:request, :result, :subscriber_result].each do |attr|
|
8
|
-
describe attr do
|
8
|
+
describe "##{attr}" do
|
9
9
|
it "must be a Result" do
|
10
10
|
expect{described_class.new(args.merge(:"#{attr}" => 123))}.to raise_error(Mblox::ValidationError, "#{attr} must be of type Mblox::SmsResponse::Result")
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
14
14
|
[:request, :result].each do |attr|
|
15
|
-
describe attr do
|
15
|
+
describe "##{attr}" do
|
16
16
|
it "cannot be blank" do
|
17
17
|
expect{described_class.new(args.merge(:"#{attr}" => nil))}.to raise_error(Mblox::ValidationError, "#{attr} cannot be blank")
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
describe
|
22
|
+
describe '#subscriber_result' do
|
23
23
|
it "cannot be blank if result is ok" do
|
24
24
|
expect{described_class.new(args.merge(:subscriber_result => nil))}.to_not raise_error
|
25
25
|
end
|
@@ -45,17 +45,17 @@ describe Mblox::SmsResponse do
|
|
45
45
|
let(:args) { { :request => Mblox::SmsResponse::Result.new(0, "OKRequest"), :result => Mblox::SmsResponse::Result.new(0, "OKResult") , :subscriber_result => Mblox::SmsResponse::Result.new(0, "OKSubscriberResult") } }
|
46
46
|
|
47
47
|
it "should be ok if all attributes are ok" do
|
48
|
-
described_class.new(args).
|
48
|
+
expect(described_class.new(args)).to be_ok
|
49
49
|
end
|
50
50
|
|
51
51
|
[:request, :result, :subscriber_result].each do |attr|
|
52
52
|
it "should not be ok if #{attr} is not ok" do
|
53
|
-
described_class.new(args.merge(:"#{attr}" => Mblox::SmsResponse::Result.new(1,"NotOK"))).
|
53
|
+
expect(described_class.new(args.merge(:"#{attr}" => Mblox::SmsResponse::Result.new(1,"NotOK")))).not_to be_ok
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
57
|
it "should be unroutable if subscriber_result is unroutable and other attirbutes are ok" do
|
58
|
-
described_class.new(args.merge(:subscriber_result => Mblox::SmsResponse::Result::UNROUTABLE)).
|
58
|
+
expect(described_class.new(args.merge(:subscriber_result => Mblox::SmsResponse::Result::UNROUTABLE))).to be_unroutable
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
data/spec/sms_spec.rb
CHANGED
@@ -33,7 +33,7 @@ describe Mblox::Sms do
|
|
33
33
|
number = TEST_NUMBER.to_s
|
34
34
|
mblox = Mblox::Sms.new(number,the_message)
|
35
35
|
number[1..3] = ''
|
36
|
-
mblox.phone.
|
36
|
+
expect(mblox.phone).to eq("1#{TEST_NUMBER}")
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
@@ -50,39 +50,39 @@ describe Mblox::Sms do
|
|
50
50
|
message = "A"+"ABCDEFGHIJ"*16
|
51
51
|
Mblox.config.on_message_too_long = :truncate
|
52
52
|
expect { @mblox = Mblox::Sms.new(LANDLINE, message) }.to_not raise_error
|
53
|
-
@mblox.message.
|
53
|
+
expect(@mblox.message).to eq([message[0,160]])
|
54
54
|
end
|
55
55
|
|
56
56
|
it "cannot be longer than 160 characters if configured to raise error" do
|
57
57
|
Mblox.config.on_message_too_long = :raise_error
|
58
|
-
expect { Mblox::Sms.new(LANDLINE, "A"*161) }.to raise_error(Mblox::Sms::
|
58
|
+
expect { Mblox::Sms.new(LANDLINE, "A"*161) }.to raise_error(Mblox::Sms::MessageTooLongError, "Message cannot be longer than 160 characters")
|
59
59
|
end
|
60
60
|
|
61
61
|
it "should be split into multiple messages when longer than 160 characters if configured to split and even split" do
|
62
62
|
message = "ABCDEFGHIJ"*58
|
63
63
|
Mblox.config.on_message_too_long = :split
|
64
64
|
expect { @mblox = Mblox::Sms.new(LANDLINE, message) }.to_not raise_error
|
65
|
-
@mblox.message.
|
65
|
+
expect(@mblox.message).to eq(["(MSG 1/4): #{message[0,145]}", "(MSG 2/4): #{message[145,145]}", "(MSG 3/4): #{message[290,145]}", "(MSG 4/4): #{message[435,145]}"])
|
66
66
|
response = @mblox.send
|
67
|
-
response.count.
|
68
|
-
response.each { |r| r.
|
67
|
+
expect(response.count).to eq(4)
|
68
|
+
response.each { |r| expect(r).to be_unroutable }
|
69
69
|
end
|
70
70
|
|
71
71
|
it "should be split into multiple messages when longer than 160 characters if configured to split and not even split" do
|
72
72
|
message = "ABCDEFGHIJ"*32
|
73
73
|
Mblox.config.on_message_too_long = :split
|
74
74
|
expect { @mblox = Mblox::Sms.new(LANDLINE, message) }.to_not raise_error
|
75
|
-
@mblox.message.
|
75
|
+
expect(@mblox.message).to eq(["(MSG 1/3): #{message[0,145]}", "(MSG 2/3): #{message[145,145]}", "(MSG 3/3): #{message[290..-1]}"])
|
76
76
|
response = @mblox.send
|
77
|
-
response.count.
|
78
|
-
response.each { |r| r.
|
77
|
+
expect(response.count).to eq(3)
|
78
|
+
response.each { |r| expect(r).to be_unroutable }
|
79
79
|
end
|
80
80
|
|
81
81
|
it "should be safe from changing when short" do
|
82
82
|
msg = the_message
|
83
83
|
mblox = Mblox::Sms.new(TEST_NUMBER,msg)
|
84
84
|
msg[1..3] = ''
|
85
|
-
mblox.message.
|
85
|
+
expect(mblox.message).to eq([the_message])
|
86
86
|
end
|
87
87
|
|
88
88
|
it "should be safe from changing when long when configured to split" do
|
@@ -90,7 +90,7 @@ describe Mblox::Sms do
|
|
90
90
|
msg = the_message * 10
|
91
91
|
mblox = Mblox::Sms.new(TEST_NUMBER,msg)
|
92
92
|
msg[1..3] = ''
|
93
|
-
mblox.message[0][11, 20].
|
93
|
+
expect(mblox.message[0][11, 20]).to eq(the_message[0,20])
|
94
94
|
end
|
95
95
|
|
96
96
|
it "should be safe from changing when long when configured to truncate" do
|
@@ -98,82 +98,85 @@ describe Mblox::Sms do
|
|
98
98
|
msg = the_message * 10
|
99
99
|
mblox = Mblox::Sms.new(TEST_NUMBER,msg)
|
100
100
|
msg[1..3] = ''
|
101
|
-
mblox.message[0][0, 20].
|
101
|
+
expect(mblox.message[0][0, 20]).to eq(the_message[0,20])
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
105
105
|
describe "SMS messages" do
|
106
106
|
def expect_ok_response(response)
|
107
|
-
response.
|
108
|
-
response.
|
107
|
+
expect(response).to be_ok
|
108
|
+
expect(response).not_to be_unroutable
|
109
109
|
end
|
110
110
|
|
111
111
|
it "should be sent when the phone number is a Fixnum" do
|
112
112
|
response = Mblox::Sms.new(TEST_NUMBER.to_i,the_message).send
|
113
|
-
response.size.
|
113
|
+
expect(response.size).to eq(1)
|
114
114
|
expect_ok_response(response.first)
|
115
115
|
end
|
116
116
|
|
117
117
|
it "should be sent when the phone number is a String" do
|
118
118
|
response = Mblox::Sms.new(TEST_NUMBER.to_s,the_message).send
|
119
|
-
response.size.
|
119
|
+
expect(response.size).to eq(1)
|
120
120
|
expect_ok_response(response.first)
|
121
121
|
end
|
122
122
|
|
123
123
|
it "should allow 160-character messages" do
|
124
124
|
response = Mblox::Sms.new(TEST_NUMBER,"A"*160).send
|
125
|
-
response.size.
|
125
|
+
expect(response.size).to eq(1)
|
126
126
|
expect_ok_response(response.first)
|
127
127
|
end
|
128
128
|
|
129
129
|
it "should be unroutable when sent to a landline" do
|
130
130
|
response = Mblox::Sms.new(LANDLINE,the_message).send
|
131
|
-
response.size.
|
132
|
-
response.first.
|
133
|
-
response.first.
|
131
|
+
expect(response.size).to eq(1)
|
132
|
+
expect(response.first).to be_unroutable, "#{response.first.inspect} should have been unroutable"
|
133
|
+
expect(response.first).not_to be_ok
|
134
134
|
end
|
135
135
|
|
136
136
|
Mblox::Sms::LEGAL_CHARACTERS.each_char do |i|
|
137
137
|
it "allows the special char #{i}, correctly escaping illegal XML characters where necessary" do
|
138
138
|
response = Mblox::Sms.new(LANDLINE,"#{the_message}#{i}#{the_message}").send
|
139
|
-
response.size.
|
140
|
-
response.first.
|
141
|
-
response.first.
|
139
|
+
expect(response.size).to eq(1)
|
140
|
+
expect(response.first).not_to be_ok
|
141
|
+
expect(response.first).to be_unroutable
|
142
142
|
end
|
143
143
|
end
|
144
144
|
|
145
145
|
it "can send all the legal characters" do
|
146
146
|
response = Mblox::Sms.new(TEST_NUMBER,Mblox::Sms::LEGAL_CHARACTERS).send
|
147
|
-
response.size.
|
148
|
-
response.first.
|
147
|
+
expect(response.size).to eq(1)
|
148
|
+
expect(response.first).to be_ok
|
149
149
|
end
|
150
150
|
|
151
151
|
it "can send a backslash" do
|
152
152
|
response = Mblox::Sms.new(TEST_NUMBER,'\\').send
|
153
|
-
response.size.
|
154
|
-
response.first.
|
153
|
+
expect(response.size).to eq(1)
|
154
|
+
expect(response.first).to be_ok
|
155
155
|
end
|
156
156
|
end
|
157
157
|
|
158
158
|
describe "batch_id" do
|
159
|
+
def batch_id(content)
|
160
|
+
content['NotificationRequest']['NotificationList']['BatchID']
|
161
|
+
end
|
159
162
|
it "can be specified" do
|
160
163
|
batch_id = 12345
|
161
164
|
sms = Mblox::Sms.new(LANDLINE,the_message, batch_id)
|
162
165
|
content = Hash.from_xml(sms.build_for_test(the_message))
|
163
|
-
content
|
166
|
+
expect(batch_id(content)).to eq("#{batch_id}")
|
164
167
|
end
|
165
168
|
|
166
169
|
it "get converted to a Fixnum" do
|
167
170
|
batch_id = 12345
|
168
171
|
sms = Mblox::Sms.new(LANDLINE,the_message, "#{batch_id}ab")
|
169
172
|
content = Hash.from_xml(sms.build_for_test(the_message))
|
170
|
-
content
|
173
|
+
expect(batch_id(content)).to eq("#{batch_id}")
|
171
174
|
end
|
172
175
|
|
173
176
|
it "defaults to 1" do
|
174
177
|
sms = Mblox::Sms.new(LANDLINE,the_message)
|
175
178
|
content = Hash.from_xml(sms.build_for_test(the_message))
|
176
|
-
content
|
179
|
+
expect(batch_id(content)).to eq('1')
|
177
180
|
end
|
178
181
|
|
179
182
|
it "can be 99999999" do
|
@@ -233,21 +236,21 @@ describe Mblox::Sms do
|
|
233
236
|
end
|
234
237
|
|
235
238
|
it "should send from the specified sender_id" do
|
236
|
-
@sms.instance_variable_get("@sender_id").
|
239
|
+
expect(@sms.instance_variable_get("@sender_id")).to be_nil
|
237
240
|
expect{@sms.send_from(55555)}.to_not raise_error
|
238
|
-
@sms.send.first.
|
239
|
-
@sms.instance_variable_get("@sender_id").
|
241
|
+
expect(@sms.send.first).to be_ok
|
242
|
+
expect(@sms.instance_variable_get("@sender_id")).to eq("55555")
|
240
243
|
end
|
241
244
|
|
242
245
|
it "should send from the specified sender_id and service_id" do
|
243
|
-
@sms.instance_variable_get("@service_id").
|
246
|
+
expect(@sms.instance_variable_get("@service_id")).to be_nil
|
244
247
|
expect{@sms.send_from(55555, 44444)}.to_not raise_error
|
245
248
|
response = @sms.send.first
|
246
|
-
response.
|
247
|
-
response.request.
|
248
|
-
response.result.
|
249
|
-
response.subscriber_result.
|
250
|
-
@sms.instance_variable_get("@service_id").
|
249
|
+
expect(response).not_to be_ok
|
250
|
+
expect(response.request).to be_ok
|
251
|
+
expect(response.result).to be_ok
|
252
|
+
expect(response.subscriber_result).to eq(Mblox::SmsResponse::Result.new(10, "MsipRejectCode=63 Invalid ServiceId:2e Do not retry:2e"))
|
253
|
+
expect(@sms.instance_variable_get("@service_id")).to eq("44444")
|
251
254
|
end
|
252
255
|
end
|
253
256
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mblox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Isaac Betesh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
47
|
+
version: '3.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
54
|
+
version: '3.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: activemodel
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|