movile_sms 0.1.0 → 0.1.1

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9ad5da82b0d0cecbb15f2a653607caefeac3e01e
4
- data.tar.gz: 20d128c4211086067a496939e731a67f1c272c4c
3
+ metadata.gz: 6d424ce4e29e7b818da4f0e14cfda93db5440d4a
4
+ data.tar.gz: f382473f308d0148730f7877431bc7e642ccdfcf
5
5
  SHA512:
6
- metadata.gz: 32dddfc53f44549c3d0a1f94ae78a5efe3f41d7f3bd22e521c7d9bf287af68073ae4189634af19053efac0639ff0e1757aa62257dbd0370ce56b643f35f07f8e
7
- data.tar.gz: e4ad641e7ed4c47d5021d762eae36c74f443a3a3ae97814508dc260e3c692479053367b32e1e52845660e04a4a1d8409b205c235a9579088f38d05164564710b
6
+ metadata.gz: 6eb2395522b34e7ba0a925755fac3c211fdf615a55a6259691efd0d2ed52057b65dffc375c84cd2cbb66da0b5254071e1e824adc641a5deff0570ae100b069c3
7
+ data.tar.gz: 3ef9a1edb44ebd718bc6d1ea264b2fdde0149f3f6b9cf683de60913b02ba171f856e5beae8a76be3517377fd7de6e29fb75d27b92abc7bd996a5aa7590e5991b
@@ -10,8 +10,21 @@ class Sms
10
10
  end
11
11
 
12
12
  def send_message(number, text)
13
- body = { "destination" => number.to_s, "messageText" => text.to_s }.to_json
14
- response = self.class.post(BASE_API_URL, headers: @options, body: body )
13
+ if valid_number?(number) and text_size(text)
14
+ body = { "destination" => number.to_s, "messageText" => text.to_s }.to_json
15
+ response = self.class.post(BASE_API_URL, headers: @options, body: body )
16
+ else
17
+ raise "Check if the imputed number #{number} is valid or if the text has a maximum of 162 characters
18
+ "
19
+ end
20
+ end
21
+
22
+ def valid_number?(number)
23
+ true if Float(number) rescue false
24
+ end
25
+
26
+ def text_size(text)
27
+ text.size <= 162
15
28
  end
16
29
 
17
30
  end
@@ -1,3 +1,3 @@
1
1
  module MovileSms
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: movile_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
  - Leandro