mblox 0.1.0 → 0.2.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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MmIxY2E0ZmM4NmU1ZWMwZmYwNGFmMDMyZGJkNDY4ZmQ2ZjhmNTM4Mw==
4
+ MThhODgzMTYwYWZmMTdjNDJmNDAyZjY0MjUxMmE0Mzk3YzdmYjRiYw==
5
5
  data.tar.gz: !binary |-
6
- ZTExZGY3ODg3Mzg2M2RkNmQwMTUxNzI5YzRmMGMzYzc3ZjA1NzhlZg==
6
+ YjgyYzE4MGMzNmU4ZDExOGI4NTgzNWE4YWEyODVjOTJlMmY4OTc2Yg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MGQ2MjM0YjY0MDk0MWU1MmIzNTRlZDQwZGIyZjhiNGQ2ZDQ3YjI1ODJmMjk1
10
- YmVlZWViMGIxMjNhY2U1OGI4OGY3YzNlNWM4MGRkNTNjNDdjMzI0NjcxMDZi
11
- YjMwY2MxMjk2ZjU1OThkMjM5MWQ2ZTBhNjQ1NTllZjE2MjJmNDg=
9
+ OTFmODUwMmRhYmUyNGI1ODY4ZDQ4MTU4YzM1OTgyNmZlYmYxZGY3NWIyMzc0
10
+ Mjc1Y2I3YzNmZGI2Y2I5NzBjNDdjYWViNTM2OTVkOGZhMzBhYzRiNjVjZWYx
11
+ NjgxNzJlNTc0Mzc0YmU1ODM0NDJjMjhlZGY3Nzk3NGYzOGJmZjk=
12
12
  data.tar.gz: !binary |-
13
- OTI0ZGM4YTlhNzZmMGU4ZTVkNjg0MjQ5NmUzZTBiZjNlNzBkNDY2Mjg4N2Y1
14
- ZDQyNDUzMjMwMzk0MjI3YTIxM2UzN2FiYWM4YzkxMTg0ZGM2ZTQ0NzE1ZWI3
15
- NmIwMjRjMzk4MmY4NTRiZmIyZjMxYTY3MzE1Y2FjODA1YTY4YmQ=
13
+ NGFkYTc4MGIyZmQyYWI3YjRlM2M5YjQ1MjE4OWJiOGMzNzM5ZjBkODlhMGRm
14
+ YWU5ODQ2ZjU0MGYxNWQ2ODBjODIzNDhiYTY3NTA3MDM0ZWUzNDE2NGI4OTRl
15
+ OTg3NmZkYjAxMzUxNmJkMjI5Yzc3ZDdjMjIyMzJjZGNlODMzYjA=
@@ -21,7 +21,7 @@ module Mblox
21
21
  @code, @text = (code.to_i.to_s == code ? code.to_i : code), text
22
22
  end
23
23
 
24
- def is_ok?
24
+ def ok?
25
25
  0 == @code
26
26
  end
27
27
 
@@ -50,7 +50,7 @@ module Mblox
50
50
  @result = Result.new(result_list['NotificationResultCode'], result_list['NotificationResultText'])
51
51
  @result = nil unless @result.valid?
52
52
 
53
- if @result.is_ok?
53
+ if @result.ok?
54
54
  result_list = result_list['SubscriberResult']
55
55
  raise MissingExpectedXmlContentError, "Xml should have contained a 'NotificationRequestResult' -> 'NotificationResultList' => 'NotificationResult' -> 'SubscriberResult' node, but was #{xml}" if result_list.blank?
56
56
  @subscriber_result = Result.new(result_list['SubscriberResultCode'], result_list['SubscriberResultText'])
@@ -58,12 +58,12 @@ module Mblox
58
58
  end
59
59
  end
60
60
 
61
- def is_ok?
62
- @request.is_ok? && @result.is_ok? && @subscriber_result.is_ok?
61
+ def ok?
62
+ @request.ok? && @result.ok? && @subscriber_result.ok?
63
63
  end
64
64
 
65
- def is_unroutable?
66
- @request.is_ok? && @result.is_ok? && Result::UNROUTABLE == @subscriber_result
65
+ def unroutable?
66
+ @request.ok? && @result.ok? && Result::UNROUTABLE == @subscriber_result
67
67
  end
68
68
  end
69
69
  end
data/lib/mblox/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mblox
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -29,14 +29,14 @@ describe Mblox::SmsResponse::Result do
29
29
  end
30
30
  end
31
31
 
32
- describe "is_ok?" do
32
+ describe "ok?" do
33
33
  it "is true for code 0" do
34
- described_class.new(0, "123").is_ok?.should be_true
34
+ described_class.new(0, "123").ok?.should be_true
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").is_ok?.should be_false
39
+ described_class.new(i+1, "123").ok?.should be_false
40
40
  end
41
41
  end
42
42
  end
data/spec/sms_spec.rb CHANGED
@@ -57,7 +57,7 @@ describe Mblox::Sms do
57
57
  @mblox.message.should 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]}"])
58
58
  response = @mblox.send
59
59
  response.count.should eq(4)
60
- response.each { |r| r.is_unroutable?.should be_true }
60
+ response.each { |r| r.unroutable?.should be_true }
61
61
  end
62
62
 
63
63
  it "should be split into multiple messages when longer than 160 characters if configured to split and not even split" do
@@ -67,7 +67,7 @@ describe Mblox::Sms do
67
67
  @mblox.message.should eq(["(MSG 1/3): #{message[0,145]}", "(MSG 2/3): #{message[145,145]}", "(MSG 3/3): #{message[290..-1]}"])
68
68
  response = @mblox.send
69
69
  response.count.should eq(3)
70
- response.each { |r| r.is_unroutable?.should be_true }
70
+ response.each { |r| r.unroutable?.should be_true }
71
71
  end
72
72
 
73
73
  it "should be safe from changing when short" do
@@ -96,8 +96,8 @@ describe Mblox::Sms do
96
96
 
97
97
  describe "SMS messages" do
98
98
  def expect_ok_response(response)
99
- response.is_ok?.should be_true
100
- response.is_unroutable?.should be_false
99
+ response.ok?.should be_true
100
+ response.unroutable?.should be_false
101
101
  end
102
102
 
103
103
  it "should be sent when the phone number is a Fixnum" do
@@ -121,16 +121,16 @@ describe Mblox::Sms do
121
121
  it "should be unroutable when sent to a landline" do
122
122
  response = Mblox::Sms.new(LANDLINE,the_message).send
123
123
  response.size.should eq(1)
124
- response.first.is_unroutable?.should be_true, "#{response.first.inspect} should have been unroutable"
125
- response.first.is_ok?.should be_false
124
+ response.first.unroutable?.should be_true, "#{response.first.inspect} should have been unroutable"
125
+ response.first.ok?.should be_false
126
126
  end
127
127
 
128
128
  "\r\n!\"#$\%&'\(\)*+,-.\/:;<=>?@_£¤¥§¿iÄÅÆÇÉÑÖØÜßáäåæèéìñòöøùü\tí¡ ".each_char do |i|
129
129
  it "allows the special char #{i}, correctly escaping illegal XML characters where necessary" do
130
130
  response = Mblox::Sms.new(LANDLINE,"#{the_message}#{i}#{the_message}").send
131
131
  response.size.should eq(1)
132
- response.first.is_ok?.should be_false
133
- response.first.is_unroutable?.should be_true
132
+ response.first.ok?.should be_false
133
+ response.first.unroutable?.should be_true
134
134
  end
135
135
  end
136
136
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mblox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Isaac Betesh