it_cloud_sms 0.3 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/it_cloud_sms.rb +19 -13
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 974a76b8eb0240e90db48a26ebac4679dbff4afc26964f549d45ec70504ccb12
|
4
|
+
data.tar.gz: 03a8b427ea96e835330246e5a46c97cad4bdcf0744686b5e7a5b9da0390ddb38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: add6fdcb79680ecd1206067506a176a41c25c6fe6c78eb1d6280a7c544c64192fbb6500e6835928e23def11d1f4aa2dc09da26ae97246915a1e706f090112515
|
7
|
+
data.tar.gz: c8cf33a5429ccf007ea9913f2e98a36f320796c1800e11c52fde5f27278b56803e1c7bd5560a1bb0c8a0bf604b5217dc912112f46f91d7b3964437e794d40531
|
data/lib/it_cloud_sms.rb
CHANGED
@@ -4,7 +4,7 @@ require 'net/https'
|
|
4
4
|
|
5
5
|
module ItCloudSms
|
6
6
|
|
7
|
-
APIUri = URI.parse("https://
|
7
|
+
APIUri = URI.parse("https://contacto-masivo.com/sms/back_sms/public/api/sendsms")
|
8
8
|
|
9
9
|
class << self
|
10
10
|
|
@@ -25,8 +25,8 @@ module ItCloudSms
|
|
25
25
|
# Example:
|
26
26
|
# >> ItCloudSms.send_sms(:login => "login",
|
27
27
|
# :password => "password",
|
28
|
-
# :destination => "+573102111111" || ["+573102111111", "+573102111112"], # Up to
|
29
|
-
# :message => "Message with
|
28
|
+
# :destination => "+573102111111" || ["+573102111111", "+573102111112"], # Up to 5000 numbers
|
29
|
+
# :message => "Message with 765 chars maximum")
|
30
30
|
def send_sms(options = {})
|
31
31
|
# Check for login
|
32
32
|
login = options[:login] || @@login
|
@@ -40,7 +40,7 @@ module ItCloudSms
|
|
40
40
|
options[:destination] = [options[:destination]] unless options[:destination].kind_of?(Array)
|
41
41
|
|
42
42
|
# Check for max destinations
|
43
|
-
raise ArgumentError, "Max of
|
43
|
+
raise ArgumentError, "Max of 5000 destinations exceeded" if (options[:destination].size > 5000)
|
44
44
|
|
45
45
|
destinations = []
|
46
46
|
options[:destination].each do |phone|
|
@@ -54,7 +54,7 @@ module ItCloudSms
|
|
54
54
|
|
55
55
|
message = options[:message].to_s
|
56
56
|
raise ArgumentError, "Message must be present" if message.blank?
|
57
|
-
raise ArgumentError, "Message is
|
57
|
+
raise ArgumentError, "Message is 765 chars maximum" if message.size > 765
|
58
58
|
|
59
59
|
http = Net::HTTP.new(APIUri.host, APIUri.port)
|
60
60
|
http.use_ssl = true
|
@@ -62,10 +62,10 @@ module ItCloudSms
|
|
62
62
|
|
63
63
|
request = Net::HTTP::Post.new(APIUri.request_uri)
|
64
64
|
request.set_form_data({'user' => login,
|
65
|
-
'
|
65
|
+
'token' => password,
|
66
66
|
'GSM' => destinations.join(","),
|
67
67
|
'SMSText' => message,
|
68
|
-
'
|
68
|
+
'metodo_envio' => '1via'})
|
69
69
|
|
70
70
|
response = http.request(request)
|
71
71
|
if response.code == "200"
|
@@ -91,13 +91,19 @@ module ItCloudSms
|
|
91
91
|
destination[:description] = "System under maintenance"
|
92
92
|
when "-7" then
|
93
93
|
destination[:description] = "Max cellphones reached"
|
94
|
-
when "
|
95
|
-
destination[:description] = "
|
94
|
+
when "-8" then
|
95
|
+
destination[:description] = "Cellphone number in black list"
|
96
|
+
when "-9" then
|
97
|
+
destination[:description] = "message rejected for content"
|
98
|
+
when "-10" then
|
99
|
+
destination[:description] = "Message with no link authorized"
|
100
|
+
when "-11" then
|
101
|
+
destination[:description] = "Error in metodo_envio variable"
|
96
102
|
else
|
97
|
-
if destination[:code].to_i
|
98
|
-
destination[:description] = "Unknown error"
|
99
|
-
else
|
103
|
+
if destination[:code].to_i > 0
|
100
104
|
destination[:description] = "OK"
|
105
|
+
else
|
106
|
+
destination[:description] = "Unknown error"
|
101
107
|
end
|
102
108
|
end
|
103
109
|
end
|
@@ -108,4 +114,4 @@ module ItCloudSms
|
|
108
114
|
end
|
109
115
|
|
110
116
|
end
|
111
|
-
end
|
117
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: it_cloud_sms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Angel García Pérez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: global_phone
|
@@ -106,8 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
106
|
- !ruby/object:Gem::Version
|
107
107
|
version: '0'
|
108
108
|
requirements: []
|
109
|
-
|
110
|
-
rubygems_version: 2.7.3
|
109
|
+
rubygems_version: 3.2.5
|
111
110
|
signing_key:
|
112
111
|
specification_version: 4
|
113
112
|
summary: IT Cloud Services Colombia send SMS HTTP gateway
|