textveloper 0.1.3 → 0.1.4
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/textveloper.rb +10 -4
- data/lib/textveloper/version.rb +1 -1
- data/spec/lib/textveloper_spec.rb +8 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb13e6515739f34b203ac84a0d13a326c3661a7a
|
4
|
+
data.tar.gz: 455fe700e59e2a684ce6321aaa61de83a93c0365
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f64e59c6063f38108cf3ae246c1d32a0a90dff01279c7cdbc72a26799b30e69641424b0fb7463925a134b77af26b4d0620dc2ae0467c42f81e9dbc938103a798
|
7
|
+
data.tar.gz: 3fc202d17f5c90c636bfa11d1534e87ca426036cd6e48b7467dc267c10d8b73abdf8f899f69189e2a7712322c4d66d2891b1c5518a0c17d3b3fc8ce2ee10f36f
|
data/lib/textveloper.rb
CHANGED
@@ -36,7 +36,7 @@ module Textveloper
|
|
36
36
|
|
37
37
|
def send_sms(number,message)
|
38
38
|
response = []
|
39
|
-
if message.size <=
|
39
|
+
if message.size <= 160
|
40
40
|
response << core_operation(number,message)
|
41
41
|
else
|
42
42
|
chunck_message(message).each do |m|
|
@@ -48,7 +48,7 @@ module Textveloper
|
|
48
48
|
|
49
49
|
def mass_messages(numbers, message)
|
50
50
|
response = []
|
51
|
-
if message.size <=
|
51
|
+
if message.size <= 160
|
52
52
|
numbers.each do |number|
|
53
53
|
response << core_operation(number, message)
|
54
54
|
end
|
@@ -112,6 +112,8 @@ module Textveloper
|
|
112
112
|
data
|
113
113
|
end
|
114
114
|
|
115
|
+
private
|
116
|
+
|
115
117
|
def format_phone(phone_number)
|
116
118
|
phone_number.nil? ? "" : phone_number.gsub(/\W/,"").sub(/^58/,"").sub(/(^4)/, '0\1')
|
117
119
|
end
|
@@ -121,10 +123,14 @@ module Textveloper
|
|
121
123
|
end
|
122
124
|
|
123
125
|
def chunck_message(message)
|
124
|
-
|
126
|
+
#Leave space for pagination i.e: "BLAh blah blah (2/3)"
|
127
|
+
paginate(message.scan(/.{1,155}/).map(&:strip))
|
128
|
+
end
|
129
|
+
|
130
|
+
def paginate(arr)
|
131
|
+
arr.map!.with_index {|elem,i| elem << " #{i+1}/#{arr.size}" }
|
125
132
|
end
|
126
133
|
|
127
|
-
private
|
128
134
|
|
129
135
|
def url
|
130
136
|
'http://api.textveloper.com/'
|
data/lib/textveloper/version.rb
CHANGED
@@ -54,18 +54,18 @@ describe Textveloper do
|
|
54
54
|
end
|
55
55
|
|
56
56
|
it "formatear el numero de telefono a la forma 04xxxxxxxx" do
|
57
|
-
notificator.format_phone
|
58
|
-
notificator.format_phone
|
59
|
-
notificator.format_phone
|
60
|
-
notificator.format_phone
|
61
|
-
notificator.format_phone
|
62
|
-
notificator.format_phone
|
63
|
-
notificator.format_phone
|
57
|
+
notificator.send(:format_phone,"+584121234567").should eq("04121234567")
|
58
|
+
notificator.send(:format_phone,"+58-412.123.45.67").should eq("04121234567")
|
59
|
+
notificator.send(:format_phone,"0412-123-45-67").should eq("04121234567")
|
60
|
+
notificator.send(:format_phone,"0412.123.45.67").should eq("04121234567")
|
61
|
+
notificator.send(:format_phone,"+58-412.158.58.58").should eq("04121585858")
|
62
|
+
notificator.send(:format_phone,"58.412.1.2.3.4.5.6.7").should eq("04121234567")
|
63
|
+
notificator.send(:format_phone,"+58 412 123 45 67").should eq("04121234567")
|
64
64
|
|
65
65
|
end
|
66
66
|
|
67
67
|
it "formatear response a hash " do
|
68
|
-
notificator.hash_contructor
|
68
|
+
notificator.send(:hash_contructor,points).should eq(hash_response_points)
|
69
69
|
end
|
70
70
|
|
71
71
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: textveloper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gustavo Gimenez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curb
|