it_cloud_sms 0.3 → 0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/it_cloud_sms.rb +19 -13
  3. metadata +3 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 00cc16a043957c563f085914c16e7a04f1b9cbd2c93fc054c3d2d628d6e3a8d8
4
- data.tar.gz: 8953bedc14d3a2a37bebb4306b78a301a81dc902d730145d01275c9cb84feb57
3
+ metadata.gz: 974a76b8eb0240e90db48a26ebac4679dbff4afc26964f549d45ec70504ccb12
4
+ data.tar.gz: 03a8b427ea96e835330246e5a46c97cad4bdcf0744686b5e7a5b9da0390ddb38
5
5
  SHA512:
6
- metadata.gz: f785186a085dc91964122cff5415589e7e32b65ab0f6831c024bcee974832c54e7712f93add6021ddddddb71e5d298e1b783ac5712ebfd09f5ad69f335aee44d
7
- data.tar.gz: d8b8307a3d064a6db1cd807ace3f0d2ec06df3bdd1bc35c22ee924ecf19d1af622e14e5ea8b3a8152f9888ea9fc1cd9fefe5aeecbcddea3ba84a85afc7a9b0f0
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://sistemasmasivos.com/itcloud/api/sendsms/send.php")
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 500 numbers
29
- # :message => "Message with 159 chars maximum")
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 500 destinations exceeded" if (options[:destination].size > 500)
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 159 chars maximum" if message.size > 159
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
- 'password' => password,
65
+ 'token' => password,
66
66
  'GSM' => destinations.join(","),
67
67
  'SMSText' => message,
68
- 'individualws' => ((destinations.size == 1) ? "1" : "0")})
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 "0" then
95
- destination[:description] = "Operator not found"
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 == 0
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.3'
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: 2015-06-16 00:00:00.000000000 Z
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
- rubyforge_project:
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