sinch_sms 1.1 → 1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sinch_sms.rb +11 -9
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8769457e5deced63700bd4c87bdbb09f7a083fa0
4
- data.tar.gz: 0c6a5611dee42a1f857af1dce9778f148ef1822c
3
+ metadata.gz: 7120041fd731da04fc0a99f1ffba2404ebc9f71f
4
+ data.tar.gz: 2d4955c592e411b1f4ab9fdf7bb45d23a742658b
5
5
  SHA512:
6
- metadata.gz: fd0c15cb7063861f53aa68a16404d3a2ae573b58200553096cf489a822426a18fad2ccccaad30439409013707441dd78db24216fa3219b7a38a612be82e4f3ac
7
- data.tar.gz: 8ad5fee67e956b5ab304a2aac0095f816040c76a75eb5ce8f15319fed6739ecab7ad9784571454dfee322af4f52ee6c46141c51208a81ec02ff237daee77a725
6
+ metadata.gz: ff0ad320f2ff8b53b5d6ff28eb33b59da05cd399329f712e4f4a827430004c372f18fd0a6f774dfc3a250bb1b942bdfb3d19010eb3d5a787a6dbf536c7886aa5
7
+ data.tar.gz: 692b847ba1a8f7fc40c649a472cc104776f6197e066f063bd4983107864a8231052cb8369654ebfd16a7081a1a37d7f89df6300755e67f9828cf9eec4f50fa3f
data/lib/sinch_sms.rb CHANGED
@@ -8,7 +8,7 @@ class SinchSms
8
8
  req = Net::HTTP::Post.new("/v1/sms/" + to)
9
9
  http.use_ssl = true
10
10
  req.basic_auth "application:" + key, secret
11
- req["Content-Type"] = "text/json"
11
+ req["Content-Type"] = "application/json"
12
12
 
13
13
  if (from)
14
14
  req.body = {"Message" => message, "From" => from}.to_json
@@ -16,14 +16,16 @@ class SinchSms
16
16
  req.body = {"Message" => message}.to_json
17
17
  end
18
18
 
19
- response = http.request(req)
20
- if response.body["MessageId"]
21
- puts "Message successfully sent!\n"
22
- return true
23
- else
24
- puts "Error sending message!\n" + response.body
25
- return false
26
- end
19
+ return http.request(req).body
20
+ end
21
+
22
+ def self.status(key, secret, id)
23
+ http = Net::HTTP.new("messagingApi.sinch.com",443)
24
+ req = Net::HTTP::Get.new("/v1/message/status/" + id)
25
+ http.use_ssl = true
26
+ req.basic_auth "application:" + key, secret
27
+ req["Content-Type"] = "application/json"
27
28
 
29
+ return http.request(req).body
28
30
  end
29
31
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinch_sms
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.1'
4
+ version: '1.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan Hamel