smsgh_sms 0.0.3 → 0.1.0
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.
- data/README.md +26 -1
- data/lib/smsgh_sms.rb +9 -4
- data/lib/smsgh_sms/version.rb +1 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -18,7 +18,32 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
Setup your SMSGH API username and password
|
22
|
+
|
23
|
+
SmsghSms.api_username = "YOUR_USERNAME"
|
24
|
+
SmsghSms.api_password = "YOUR_PASSWORD"
|
25
|
+
|
26
|
+
Optionally set global Sender ID
|
27
|
+
|
28
|
+
SmsghSms.api_senderid = "YOUR_SENDERID"
|
29
|
+
|
30
|
+
Sending an SMS Message
|
31
|
+
|
32
|
+
SmsghSms.push(:to => 'PHONE-NUMBER', :msg => "Your SMS Message goes here")
|
33
|
+
|
34
|
+
How to override the global SENDER ID config
|
35
|
+
|
36
|
+
SmsghSms.push(:to => 'PHONE-NUMBER', :msg => "Your SMS Message goes here", :from => "SENDERID")
|
37
|
+
|
38
|
+
Sample Results Returned
|
39
|
+
|
40
|
+
{:status=>200, :notice=>"OK: 62357215"}
|
41
|
+
|
42
|
+
Any returned status code other than 200 is a failed response.
|
43
|
+
|
44
|
+
## About SMSGH
|
45
|
+
|
46
|
+
SMSGH is the premier messaging company in Ghana. Find out more about them at http://smsgh.com
|
22
47
|
|
23
48
|
## Contributing
|
24
49
|
|
data/lib/smsgh_sms.rb
CHANGED
@@ -5,17 +5,21 @@ module SmsghSms
|
|
5
5
|
API_URL = "http://api.smsgh.com/v2/messages/send?"
|
6
6
|
@@api_username = nil
|
7
7
|
@@api_password = nil
|
8
|
-
@@api_senderid = "
|
8
|
+
@@api_senderid = "SMSGHAPI"
|
9
9
|
|
10
10
|
# Expects :msg, :to and an optional :from param
|
11
11
|
# The :from param defaults to @@api_senderid when its omitted
|
12
|
-
|
13
12
|
def self.push(options={})
|
14
|
-
|
13
|
+
|
14
|
+
sender_id = options[:from].nil? ? @@api_senderid : options[:from]
|
15
|
+
api_base = "#{API_URL}&username=#{@@api_username}&password=#{@@api_password}&from=#{sender_id}"
|
16
|
+
|
15
17
|
url = "#{api_base}&text=#{CGI.escape(options[:msg])}&to=#{options[:to]}"
|
16
18
|
raise ArgumentError, ':msg and :to params expected' if options[:msg].nil? || options[:to].nil?
|
19
|
+
|
17
20
|
response = CurbFu.get(url)
|
18
|
-
{:status => response.status, :
|
21
|
+
{:status => response.status, :notice => response.body}
|
22
|
+
|
19
23
|
end
|
20
24
|
|
21
25
|
def self.api_url(url=''); @@api_base + url; end
|
@@ -25,4 +29,5 @@ module SmsghSms
|
|
25
29
|
def self.api_password; @@api_password; end
|
26
30
|
def self.api_senderid=(api_senderid); @@api_senderid = api_senderid; end
|
27
31
|
def self.api_senderid; @@api_senderid; end
|
32
|
+
|
28
33
|
end
|
data/lib/smsgh_sms/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smsgh_sms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 0.0.3
|
10
|
+
version: 0.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Alfred Rowe
|