parity-gupshup 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.rdoc +1 -1
- data/lib/parity-gupshup.rb +20 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 10bd72ee0a3d01a5b98c406e5c4bb22ecb1a4c484fa1f7b3c55a614aee7a5986
|
4
|
+
data.tar.gz: 4535f6044c1f624f2f0fd9f23a68b4b033ffa8e0357e9351ff4e0ab163cbde6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9dcef8c33bb22b34cc0a80981e43b5ebd8584a9082981c5695792e2bcdf08765814d9c2ac70d11ca0730c3d140283a32051590e3f78c9a790b6633a093fda2fe
|
7
|
+
data.tar.gz: 46480832cff2eb90c0dd4f7357bc2ce8c8f89fe62f053c24fad908eed23316792d8af26fcbd4050a2c37933d8c471eee3bf33819e8c491d5423f2cc36c9930c8
|
data/README.rdoc
CHANGED
data/lib/parity-gupshup.rb
CHANGED
@@ -22,7 +22,7 @@ module Gupshup
|
|
22
22
|
VERSION = '0.2.1'
|
23
23
|
class Enterprise
|
24
24
|
def initialize(opts)
|
25
|
-
@api_url = opts[:api_url] || '
|
25
|
+
@api_url = opts[:api_url] || 'https://enterprise.smsgupshup.com/GatewayAPI/rest'
|
26
26
|
@api_params = {}
|
27
27
|
@api_params[:userid] = opts[:userid]
|
28
28
|
@api_params[:password] = opts[:password]
|
@@ -71,6 +71,25 @@ module Gupshup
|
|
71
71
|
return false, 'Message should be less than 725 characters long' if msg.to_s.length > 724
|
72
72
|
call_api opts.merge({ :method => 'sendMessage' })
|
73
73
|
end
|
74
|
+
|
75
|
+
def send_bulk_message(opts)
|
76
|
+
msg = opts[:msg]
|
77
|
+
numbers = opts[:send_to]
|
78
|
+
msg_type = opts[:msg_type] || 'TEXT'
|
79
|
+
@api_params[:v] = '1.0' # Only available in 1.0 API of GupShup.
|
80
|
+
|
81
|
+
return false, "Sending to 100 numbers max allowed at a time" if numbers.split(",").size > 100
|
82
|
+
numbers.split(",").each do |number|
|
83
|
+
return false, 'Phone Number is too short' if number.to_s.length < 12
|
84
|
+
return false, 'Phone Number is too long' if number.to_s.length > 12
|
85
|
+
#return false, 'Phone Number should start with "91"' if number.to_s.start_with? "91"
|
86
|
+
return false, 'Phone Number should be numerical value' unless number.to_i.to_s == number.to_s
|
87
|
+
end
|
88
|
+
|
89
|
+
return false, 'Message cannot be empty' if msg.to_s.length == 0
|
90
|
+
return false, 'Message should be less than 725 characters long' if msg.to_s.length > 724
|
91
|
+
call_api opts.merge({ :method => 'sendMessage' })
|
92
|
+
end
|
74
93
|
|
75
94
|
def send_flash_message(opts)
|
76
95
|
send_message(opts.merge({ :msg_type => 'FLASH'}))
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parity-gupshup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Beena Shetty
|
@@ -66,11 +66,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
66
|
version: '0'
|
67
67
|
requirements: []
|
68
68
|
rubyforge_project: parity-gupshup
|
69
|
-
rubygems_version: 2.
|
69
|
+
rubygems_version: 2.7.3
|
70
70
|
signing_key:
|
71
71
|
specification_version: 3
|
72
72
|
summary: Ruby wrapper for SMSGupShup API
|
73
73
|
test_files:
|
74
74
|
- test/test_gupshup.rb
|
75
75
|
- test/test_helper.rb
|
76
|
-
has_rdoc:
|