cm-sms 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ae5829f7cdabf0ba1718966f9c60d8385652c23
4
- data.tar.gz: ccce1ca4e19521f593939c4aeb9ddbe4ec5eadbb
3
+ metadata.gz: 3ecd3db47425dc4674d6fc430ee560d655679905
4
+ data.tar.gz: 1f942f55ed21a4aaa42756245419ca976f3418da
5
5
  SHA512:
6
- metadata.gz: 1653ab8d2a9a400ed8264557eeb2bc5c9b7dcb09df4411920c315f467c427d8e5c8eaf169eaff7293b2b6527ee15b39d3eb32bf6beb29e049ef515b9ddaf6286
7
- data.tar.gz: 0ec72afd8498809c8de78ecbe6e84d2f8a54948f4290db9f52cefa17e7a119e8b48a2116c336cddc6b4add37342b097e8a681ac654327f2888fceaf9b35c3b55
6
+ metadata.gz: ea7cfe4ce02a7ded74d242eecf107a7a20e6e82c45eb182f88413921ec5deda9394af54936be0a3c31eb2e1526971377e0601932d1e5b69c26b40757a3f08fe9
7
+ data.tar.gz: 1ea76eed0a75a934f57479cbeeefb0a5742e21f29b0a785105f970d465385e58794ed3d958c99ac4da45b313846a5d69d39c01ac5d426b8b41faa96321f5124b
data/cm-sms-0.1.0.gem ADDED
Binary file
@@ -7,7 +7,7 @@ module CmSms
7
7
  module VERSION
8
8
  MAJOR = 0
9
9
  MINOR = 1
10
- TINY = 0
10
+ TINY = 1
11
11
  PRE = nil
12
12
 
13
13
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
@@ -7,6 +7,7 @@ module CmSms
7
7
  class FromMissing < ArgumentError; end
8
8
  class ToMissing < ArgumentError; end
9
9
  class BodyMissing < ArgumentError; end
10
+ class BodyToLong < ArgumentError; end
10
11
  class ToUnplausible < ArgumentError; end
11
12
 
12
13
  attr_accessor :from, :to, :body, :dcs, :reference
@@ -37,6 +38,10 @@ module CmSms
37
38
  !body.nil? && !body.empty?
38
39
  end
39
40
 
41
+ def body_correct_length?
42
+ body_present? && body.length <= 160
43
+ end
44
+
40
45
  def product_token_present?
41
46
  !@product_token.nil? && !@product_token.empty?
42
47
  end
@@ -55,6 +60,7 @@ module CmSms
55
60
  raise FromMissing.new('The from attribute is missing.') unless sender_present?
56
61
  raise ToMissing.new('The to attribute is missing.') unless receiver_present?
57
62
  raise BodyMissing.new('The body of the message is missing.') unless body_present?
63
+ raise BodyToLong.new('The body of the message has a length greater than 160.') unless body_correct_length?
58
64
  raise ToUnplausible.new("THe given to attribute is not a plausible phone number.\nMaybe the country code is missing.") unless receiver_plausible?
59
65
 
60
66
  deliver
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cm-sms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - itschn
@@ -98,6 +98,7 @@ files:
98
98
  - Rakefile
99
99
  - bin/console
100
100
  - bin/setup
101
+ - cm-sms-0.1.0.gem
101
102
  - cm-sms.gemspec
102
103
  - lib/cm-sms.rb
103
104
  - lib/cm_sms.rb