smsgh_sms 1.0.2 → 1.0.3
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.
- checksums.yaml +7 -0
- data/README.md +7 -0
- data/lib/smsgh_sms.rb +20 -6
- data/lib/smsgh_sms/version.rb +1 -1
- data/smsgh_sms.gemspec +1 -1
- metadata +35 -56
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: de0bd7772c3cb216476527d8ecb26e7d1602d0d4
|
4
|
+
data.tar.gz: 423e63eeee3350d14aab78004d6492897e69f904
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3c40ad59b1c446619fce1d92a9236bad3130fa772a291d1dce6a5c3511d8610dd051d5e571622104a560057f33c7eb82dd03738fa5dc69af2530306913575426
|
7
|
+
data.tar.gz: 78688f8be287b21eb699b36819ba7306692506d774e6d0c369f5d7ae476a6cafe64e07c65c83dd8207561f901339040a197ba223a3ce440352d51fab0be2e8ca
|
data/README.md
CHANGED
@@ -20,8 +20,15 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
Setup your SMSGH API username and password
|
22
22
|
|
23
|
+
If you are using the old API (V2) then
|
24
|
+
|
23
25
|
SmsghSms.api_username = "YOUR_USERNAME"
|
24
26
|
SmsghSms.api_password = "YOUR_PASSWORD"
|
27
|
+
|
28
|
+
If you are using the new API (V3) then
|
29
|
+
|
30
|
+
SmsghSms.api_client_id = "YOUR_CLIENT_ID"
|
31
|
+
SmsghSms.api_client_secret = "YOUR_CLIENT_SECRET"
|
25
32
|
|
26
33
|
Optionally set global Sender ID
|
27
34
|
|
data/lib/smsgh_sms.rb
CHANGED
@@ -3,9 +3,10 @@ require 'cgi'
|
|
3
3
|
require 'curb-fu'
|
4
4
|
|
5
5
|
module SmsghSms
|
6
|
-
API_URL = "http://api.smsgh.com/v2/messages/send?"
|
7
6
|
@@api_username = nil
|
8
7
|
@@api_password = nil
|
8
|
+
@@api_client_id = nil
|
9
|
+
@@api_client_secret = nil
|
9
10
|
@@api_senderid = "SMSGHAPI"
|
10
11
|
|
11
12
|
# Expects :msg, :to and an optional :from param
|
@@ -13,12 +14,18 @@ module SmsghSms
|
|
13
14
|
def self.push(options={})
|
14
15
|
|
15
16
|
sender_id = options[:from].nil? ? @@api_senderid : options[:from]
|
16
|
-
|
17
|
-
|
18
|
-
url = "#{api_base}&text=#{CGI.escape(options[:msg])}&to=#{options[:to]}"
|
17
|
+
response = nil
|
18
|
+
|
19
19
|
raise ArgumentError, ':msg and :to params expected' if options[:msg].nil? || options[:to].nil?
|
20
|
+
|
21
|
+
if @@api_username != nil && @@api_password != nil
|
22
|
+
response = CurbFu.get({:host => 'api.smsgh.com', :path => '/v2/messages/send'}, { :from => sender_id, :to => options[:to], :text => options[:msg], :username => @@api_username, :password => @@api_password })
|
23
|
+
end
|
24
|
+
|
25
|
+
if @@api_client_id != nil && @@api_client_secret != nil
|
26
|
+
response = CurbFu.get({:host => 'api.smsgh.com', :path => '/v3/messages/send', :protocol => 'https'}, { :From => sender_id, :To => options[:to], :Content => options[:msg], :ClientId => @@api_client_id, :ClientSecret => @@api_client_secret })
|
27
|
+
end
|
20
28
|
|
21
|
-
response = CurbFu.get(url)
|
22
29
|
{:status => response.status, :notice => response.body}
|
23
30
|
|
24
31
|
end
|
@@ -28,7 +35,14 @@ module SmsghSms
|
|
28
35
|
def self.api_username; @@api_username; end
|
29
36
|
def self.api_password=(api_password); @@api_password = api_password; end
|
30
37
|
def self.api_password; @@api_password; end
|
38
|
+
def self.api_client_id=(api_client_id); @@api_client_id = api_client_id; end
|
39
|
+
def self.api_client_id; @@api_client_id; end
|
40
|
+
def self.api_client_secret=(api_client_secret); @@api_client_secret = api_client_secret; end
|
41
|
+
def self.api_password; @@api_client_secret; end
|
31
42
|
def self.api_senderid=(api_senderid); @@api_senderid = api_senderid; end
|
32
43
|
def self.api_senderid; @@api_senderid; end
|
33
44
|
|
34
|
-
end
|
45
|
+
endd); @@api_senderid = api_senderid; end
|
46
|
+
def self.api_senderid; @@api_senderid; end
|
47
|
+
|
48
|
+
end
|
data/lib/smsgh_sms/version.rb
CHANGED
data/smsgh_sms.gemspec
CHANGED
metadata
CHANGED
@@ -1,47 +1,38 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: smsgh_sms
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
- 2
|
10
|
-
version: 1.0.2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.3
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Alfred Rowe
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2015-06-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
21
14
|
name: curb-fu
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 3
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
version: "0"
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
32
20
|
type: :runtime
|
33
|
-
|
34
|
-
|
35
|
-
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: This is a ruby wrapper that abstracts the SMSGH's SMS API. This gem has
|
28
|
+
extra garnishing to make smsing via Ruby more tasteful and less painful.'
|
29
|
+
email:
|
36
30
|
- alfred@ncodedevlabs.com
|
37
31
|
executables: []
|
38
|
-
|
39
32
|
extensions: []
|
40
|
-
|
41
33
|
extra_rdoc_files: []
|
42
|
-
|
43
|
-
|
44
|
-
- .gitignore
|
34
|
+
files:
|
35
|
+
- ".gitignore"
|
45
36
|
- Gemfile
|
46
37
|
- LICENSE
|
47
38
|
- README.md
|
@@ -51,37 +42,25 @@ files:
|
|
51
42
|
- smsgh_sms.gemspec
|
52
43
|
homepage: https://github.com/nukturnal/smsgh_sms
|
53
44
|
licenses: []
|
54
|
-
|
45
|
+
metadata: {}
|
55
46
|
post_install_message:
|
56
47
|
rdoc_options: []
|
57
|
-
|
58
|
-
require_paths:
|
48
|
+
require_paths:
|
59
49
|
- lib
|
60
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
61
|
-
|
62
|
-
requirements:
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
63
52
|
- - ">="
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
version: "0"
|
69
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
-
none: false
|
71
|
-
requirements:
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
72
57
|
- - ">="
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
|
75
|
-
segments:
|
76
|
-
- 0
|
77
|
-
version: "0"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
78
60
|
requirements: []
|
79
|
-
|
80
61
|
rubyforge_project:
|
81
|
-
rubygems_version:
|
62
|
+
rubygems_version: 2.4.8
|
82
63
|
signing_key:
|
83
|
-
specification_version:
|
64
|
+
specification_version: 4
|
84
65
|
summary: Send SMS via SMSGH's API
|
85
66
|
test_files: []
|
86
|
-
|
87
|
-
has_rdoc:
|