sms_gateway_to 0.2.0 → 0.2.1
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 +4 -4
- data/.travis.yml +34 -3
- data/README.md +9 -1
- data/examples/ruby.rb +5 -0
- data/lib/sms_gateway_to/client.rb +22 -1
- data/lib/sms_gateway_to/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79487bcea3af3ea4a4d0d710790fef482065f329
|
4
|
+
data.tar.gz: 0fefbed55a8b6cb2ff994c0012e7e8b00926faa1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8576c1aa1f8e6201abfb927f3fbef69e599ce8db7d6ec3921d3f25843f46cde8ad1f898f2fa80229d540fd8ca8376496603c5e911c52ab17a31ff5d802f10eca
|
7
|
+
data.tar.gz: a638a1f6bb25855e4bc7af1dc557ac51525290906252462a0f58930132b3b7b431f9a5c2f89c838ea2f2920626ca93e948f00f7f643f797617e5ae3df3c475dc
|
data/.travis.yml
CHANGED
@@ -1,5 +1,36 @@
|
|
1
|
-
sudo: false
|
2
1
|
language: ruby
|
3
|
-
|
4
|
-
|
2
|
+
sudo: false
|
3
|
+
script: bundle exec rspec
|
4
|
+
cache: bundler
|
5
|
+
branches:
|
6
|
+
except:
|
7
|
+
- "/\\Av\\d+\\Z/"
|
8
|
+
matrix:
|
9
|
+
fast_finish: true
|
10
|
+
include:
|
11
|
+
- rvm: 1.9.3
|
12
|
+
gemfile: Gemfile
|
13
|
+
- rvm: 2.0.0
|
14
|
+
gemfile: Gemfile
|
15
|
+
- rvm: 2.1.0
|
16
|
+
gemfile: Gemfile
|
17
|
+
- rvm: 2.1.1
|
18
|
+
gemfile: Gemfile
|
19
|
+
- rvm: 2.1.1
|
20
|
+
gemfile: gemfiles/Gemfile-edge
|
21
|
+
- rvm: 2.2.0
|
22
|
+
gemfile: Gemfile
|
23
|
+
- rvm: 2.2.0
|
24
|
+
gemfile: gemfiles/Gemfile-edge
|
25
|
+
- rvm: 2.3.0
|
26
|
+
gemfile: Gemfile
|
27
|
+
- rvm: 2.3.0
|
28
|
+
gemfile: gemfiles/Gemfile-edge
|
29
|
+
- rvm: jruby-19mode
|
30
|
+
gemfile: Gemfile
|
31
|
+
- rvm: jruby-head
|
32
|
+
gemfile: Gemfile
|
33
|
+
allow_failures:
|
34
|
+
- rvm: jruby-head
|
35
|
+
|
5
36
|
before_install: gem install bundler -v 1.12.4
|
data/README.md
CHANGED
@@ -33,6 +33,14 @@ To use the gem as a standalone library
|
|
33
33
|
# message - The text message you want to send
|
34
34
|
|
35
35
|
client.send_message(from, to, message)
|
36
|
+
|
37
|
+
# Same as above but will raise error based on the backend response
|
38
|
+
|
39
|
+
begin
|
40
|
+
client.send_message!(from, to, message)
|
41
|
+
rescue SmsGatewayTo::StandardError, SmsGatewayTo::ParameterError
|
42
|
+
# Do something
|
43
|
+
end
|
36
44
|
```
|
37
45
|
|
38
46
|
If you are using it with rails
|
@@ -41,7 +49,7 @@ If you are using it with rails
|
|
41
49
|
1. Create a smsgateway.yaml file in the config folder of the rails app
|
42
50
|
|
43
51
|
```ruby
|
44
|
-
Sample smsgateway.yaml file
|
52
|
+
# Sample smsgateway.yaml file
|
45
53
|
|
46
54
|
development:
|
47
55
|
token: dev-token
|
data/examples/ruby.rb
ADDED
@@ -9,7 +9,28 @@ module SmsGatewayTo
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def send_message(from, to, message)
|
12
|
-
self.class.
|
12
|
+
self.class.post("/json/gateway.ashx",
|
13
|
+
{
|
14
|
+
body: {
|
15
|
+
messages: {
|
16
|
+
authentication: {
|
17
|
+
producttoken: @product_token
|
18
|
+
},
|
19
|
+
msg: [{
|
20
|
+
from: from,
|
21
|
+
to: [{
|
22
|
+
number: to
|
23
|
+
}],
|
24
|
+
body: {
|
25
|
+
type: "AUTO",
|
26
|
+
content: message
|
27
|
+
}
|
28
|
+
}]
|
29
|
+
}
|
30
|
+
}.to_json,
|
31
|
+
headers: { 'Content-Type' => 'application/json' }
|
32
|
+
}
|
33
|
+
)
|
13
34
|
end
|
14
35
|
|
15
36
|
def send_message!(from, to, message)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sms_gateway_to
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Suraj Shirvankar
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -97,6 +97,7 @@ files:
|
|
97
97
|
- Rakefile
|
98
98
|
- bin/console
|
99
99
|
- bin/setup
|
100
|
+
- examples/ruby.rb
|
100
101
|
- lib/sms_gateway_to.rb
|
101
102
|
- lib/sms_gateway_to/client.rb
|
102
103
|
- lib/sms_gateway_to/config.rb
|