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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 07f4d377903576016a482c4e3ef4d8324f9be504
4
- data.tar.gz: f2002aaad7c3890f892e7351cb79589289001c9b
3
+ metadata.gz: 79487bcea3af3ea4a4d0d710790fef482065f329
4
+ data.tar.gz: 0fefbed55a8b6cb2ff994c0012e7e8b00926faa1
5
5
  SHA512:
6
- metadata.gz: e0d8773873d9ab6a690df0861ba237558f08f485957af9b73ad757c7cb2e0344ebe1323baff2d96f92012a4ee8c8c94bcb6c9cce31da2f18e0eea07b7aacf703
7
- data.tar.gz: 5fe73131a62775c045822a7fbf2ed824f527888b66258c93a107425e5a25389f64e03170ad8afaed10f01ed5579b63ced93565560529b7898e355d6a0080029d
6
+ metadata.gz: 8576c1aa1f8e6201abfb927f3fbef69e599ce8db7d6ec3921d3f25843f46cde8ad1f898f2fa80229d540fd8ca8376496603c5e911c52ab17a31ff5d802f10eca
7
+ data.tar.gz: a638a1f6bb25855e4bc7af1dc557ac51525290906252462a0f58930132b3b7b431f9a5c2f89c838ea2f2920626ca93e948f00f7f643f797617e5ae3df3c475dc
@@ -1,5 +1,36 @@
1
- sudo: false
2
1
  language: ruby
3
- rvm:
4
- - 2.2.2
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
@@ -0,0 +1,5 @@
1
+ require 'sms_gateway_to'
2
+
3
+ producttoken = "producttoken"
4
+ client = SmsGatewayTo::Client.new(producttoken)
5
+ puts client.send_message!("From", "+999999", "message")
@@ -9,7 +9,28 @@ module SmsGatewayTo
9
9
  end
10
10
 
11
11
  def send_message(from, to, message)
12
- self.class.get("/gateway.ashx", { query: {producttoken: @product_token, from: from, to: to, body: message}})
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)
@@ -1,3 +1,3 @@
1
1
  module SmsGatewayTo
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
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.0
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-07-02 00:00:00.000000000 Z
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