voodoo_sms 0.0.1 → 0.0.2
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 +4 -4
- data/lib/voodoo_sms.rb +3 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d0057f8c30e558de041d9a13606ba959f8bce97
|
4
|
+
data.tar.gz: 9b629ba6b7a4be3da6b1ea1e24f847eb82e1a0df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40985ea1e7b931896593e956661600bdd2636d60d208dcf169fed744604ec6fdbd01f34f1aa80d2cda58fbc5418663b0c2bf6acd1a6fc29e24986a653c819971
|
7
|
+
data.tar.gz: e68b6f89f098db112d2ab7cd6f952b7bc5a054efe755833ca2c9768c75c473d9907847527a5660bf4d6cf9e46f10ab5015e0b45d936943ac7edd76b5ba1c13a3
|
data/lib/voodoo_sms.rb
CHANGED
@@ -10,6 +10,7 @@ class VoodooSMS
|
|
10
10
|
class Forbidden < StandardError; end
|
11
11
|
class MessageTooLarge < StandardError; end
|
12
12
|
class Unexpected < StandardError; end
|
13
|
+
class RequiredParameter < StandardError; end
|
13
14
|
class InvalidParameterFormat < StandardError; end
|
14
15
|
end
|
15
16
|
|
@@ -86,12 +87,14 @@ class VoodooSMS
|
|
86
87
|
end
|
87
88
|
|
88
89
|
def validate_originator(input)
|
90
|
+
raise Error::RequiredParameter.new if input.nil? || input.empty?
|
89
91
|
unless input.match /^[a-zA-Z0-9]{1,11}(\d{4})?$/
|
90
92
|
raise Error::InvalidParameterFormat.new('must be 15 numeric digits or 11 alphanumerics')
|
91
93
|
end
|
92
94
|
end
|
93
95
|
|
94
96
|
def validate_destination(input)
|
97
|
+
raise Error::RequiredParameter.new if input.nil? || input.empty?
|
95
98
|
unless input.match /^\d{10,15}$/
|
96
99
|
raise Error::InvalidParameterFormat.new('must be valid E.164 format')
|
97
100
|
end
|