kannel_client 0.0.2
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/lib/kannel_client.rb +66 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 23122d929b962f1f2b5bb7cc0e15f00241861f2b
|
4
|
+
data.tar.gz: adea8127b1f96947aae36a095049ea0eeb3176b3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 61a68bca4570502ad64cbc2fc200dc9e72492c45f37a7bb649a48c2d7c3d63ed403ab059a6bab73e1e1da05b491ecbdb1131f8175ab25b8cb8ede6f15dae398c
|
7
|
+
data.tar.gz: b7b7776eac4ffa2db8bec76ebf82aedc036ea70de0ec1e4dc6b9a93aad49356e65cce8fe688c8ae3bea17fa3dc0f912efebec2b30d6b6869310989a8d284d5f8
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'uri'
|
3
|
+
require 'net/http'
|
4
|
+
|
5
|
+
class KannelClient
|
6
|
+
attr_accessor :username,:password,:url,:dlr_callback_url,:dlr_mask,:smsc,:coding,:charset,:validity
|
7
|
+
|
8
|
+
def initialize(attributes={})
|
9
|
+
self.username = attributes[:username]
|
10
|
+
self.password = attributes[:password]
|
11
|
+
self.url = attributes[:url]
|
12
|
+
self.dlr_callback_url = attributes[:dlr_callback_url]
|
13
|
+
self.dlr_mask = attributes[:dlr_mask]
|
14
|
+
self.smsc = attributes[:smsc]
|
15
|
+
self.coding = attributes[:coding]
|
16
|
+
self.charset = attributes[:charset]
|
17
|
+
self.validity = attributes[:validity]
|
18
|
+
end
|
19
|
+
|
20
|
+
def send_sms(from,to,text)
|
21
|
+
uri = URI(self.url)
|
22
|
+
params = {
|
23
|
+
smsc: self.smsc,
|
24
|
+
username: self.username,
|
25
|
+
password: self.password,
|
26
|
+
from: from,
|
27
|
+
to: to,
|
28
|
+
text: text,
|
29
|
+
coding: self.coding,
|
30
|
+
charset: self.charset,
|
31
|
+
validity: self.validity
|
32
|
+
}
|
33
|
+
uri.query = URI.encode_www_form(params)
|
34
|
+
response = Net::HTTP.get_response(uri)
|
35
|
+
|
36
|
+
return response
|
37
|
+
end
|
38
|
+
|
39
|
+
def send_quiet_sms(from,to,text)
|
40
|
+
uri = URI(self.url)
|
41
|
+
params = {
|
42
|
+
smsc: self.smsc,
|
43
|
+
username: self.username,
|
44
|
+
password: self.password,
|
45
|
+
from: from,
|
46
|
+
to: to,
|
47
|
+
text: text,
|
48
|
+
coding: 2,
|
49
|
+
mclass: 0,
|
50
|
+
pid: 64,
|
51
|
+
charset: self.charset,
|
52
|
+
validity: self.validity
|
53
|
+
}
|
54
|
+
uri.query = URI.encode_www_form(params)
|
55
|
+
response = Net::HTTP.get_response(uri)
|
56
|
+
|
57
|
+
return response
|
58
|
+
end
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
def check_response(response)
|
63
|
+
return 'ok'
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kannel_client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- etspring
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-01-09 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Simple client for Kannel via HTTP.
|
14
|
+
email: etspring@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/kannel_client.rb
|
20
|
+
homepage: http://rubygems.org/gems/kannel_client
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.9.3
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.4.3
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: Simple client for Kannel via HTTP.
|
44
|
+
test_files: []
|