globelabs_sms_rails 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/lib/globelabs_sms_rails.rb +22 -6
- data/lib/globelabs_sms_rails/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ed0b2bc27b6f7bad6408a8f1c7fc8eb76c0528f
|
4
|
+
data.tar.gz: 68e967beb830ff3d4c7f22533204649b20ba3133
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccf3b7746fa0a076c0814eddd39e19e3efe9eb82e0df4e32c414b515733dfc85f1fbed735dfa8d5e25e7669138d9968fdac344b58a49223bc59afa660d24076a
|
7
|
+
data.tar.gz: d773b3e3647124bffe269d2235988bcfceabf74ccc1c12b107dea1c4c55aafbcad0fe963471643c9580ebd7d0607249089b6de668f879e0c024703d89a29fca4
|
data/.gitignore
CHANGED
data/lib/globelabs_sms_rails.rb
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
require "uri"
|
2
|
+
require "net/https"
|
3
|
+
require "json"
|
1
4
|
require "globelabs_sms_rails/version"
|
2
5
|
|
3
6
|
module GlobelabsSmsRails
|
@@ -25,23 +28,36 @@ module GlobelabsSmsRails
|
|
25
28
|
end
|
26
29
|
end
|
27
30
|
|
28
|
-
def self.send_message(address, message)
|
31
|
+
def self.send_message(address, message, customCred=nil)
|
29
32
|
@address = address
|
30
33
|
@message = message
|
31
34
|
|
32
35
|
if @address.nil? || @message.nil?
|
33
36
|
raise 'Address or message is nil'
|
34
37
|
else
|
38
|
+
unless customCred.nil?
|
39
|
+
appId = customCred[:app_id]
|
40
|
+
appSecret = customCred[:app_secret]
|
41
|
+
passPhrase = customCred[:passphrase]
|
42
|
+
shortCode = customCred[:short_code]
|
43
|
+
else
|
44
|
+
appId = self.configuration.app_id
|
45
|
+
appSecret = self.configuration.app_secret
|
46
|
+
passPhrase = self.configuration.passphrase
|
47
|
+
shortCode = self.configuration.short_code
|
48
|
+
end
|
49
|
+
|
35
50
|
data = {
|
36
51
|
address: @address,
|
37
52
|
message: @message,
|
38
|
-
app_id:
|
39
|
-
app_secret:
|
40
|
-
passphrase:
|
53
|
+
app_id: appId,
|
54
|
+
app_secret: appSecret,
|
55
|
+
passphrase: passPhrase
|
41
56
|
}
|
42
|
-
|
57
|
+
|
58
|
+
uri = URI.parse("https://devapi.globelabs.com.ph/smsmessaging/#{self.configuration.api_version}/outbound/#{shortCode}/requests")
|
43
59
|
res = Net::HTTP.post_form(uri, data)
|
44
|
-
|
60
|
+
|
45
61
|
return JSON.parse(res.body).merge(http_code: res.code)
|
46
62
|
end
|
47
63
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: globelabs_sms_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nujian Den Mark Meralpis
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
93
|
version: '0'
|
94
94
|
requirements: []
|
95
95
|
rubyforge_project:
|
96
|
-
rubygems_version: 2.
|
96
|
+
rubygems_version: 2.6.13
|
97
97
|
signing_key:
|
98
98
|
specification_version: 4
|
99
99
|
summary: Sending SMS using Globe Labs API.
|