iletimerkezisms 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/iletimerkezisms.rb +44 -9
- data/lib/iletimerkezisms/report.rb +46 -2
- data/lib/iletimerkezisms/sms.rb +85 -3
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 896b36243ef7d407b3ac0a384f1717e09f34afaa
|
4
|
+
data.tar.gz: 7a8d6e41b888cf44ac578df72876fe9d0499c9ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19007b1ccc4f0f7d8b82f31a236ce805abb776315b0df380514103f1e3ded8615752f0b62c2114b70765811fceda243db7de3107f43fbe37ea60996fabb0e7ce
|
7
|
+
data.tar.gz: 0cab9438c038e41f4b3499e5aa517f9961ebe6a9ef1da63d7f3f3258402a306872866b3cbae58127ea39d6c77fe44c4752dd3b0bb287cdd134fcfee395b8e81c
|
data/lib/iletimerkezisms.rb
CHANGED
@@ -5,12 +5,23 @@ require File.expand_path('../iletimerkezisms/report', __FILE__)
|
|
5
5
|
require File.expand_path('../iletimerkezisms/request', __FILE__)
|
6
6
|
|
7
7
|
module IletimerkeziSMS
|
8
|
-
# argv: {sender: "ILETI MRKZI", message: "Lorem Ipsum ...",
|
8
|
+
# argv: {api_gateway: true, sender: "ILETI MRKZI", message: "Lorem Ipsum ...",
|
9
9
|
# numbers: ["905xxxxxxxxx"," +90 5xx xxx xx xx", "5xxxxxxxxx"]
|
10
10
|
# }
|
11
|
-
|
11
|
+
# Varsayılan api_gateway false.
|
12
|
+
# ap_gateway true ise kpublic, ksecret ile authentication; false ise username, password
|
13
|
+
def self.send(username, password, argv = {})
|
14
|
+
argv = {
|
15
|
+
api_gateway: false
|
16
|
+
}.merge(argv)
|
17
|
+
|
12
18
|
sms = SMS.new(username, password)
|
13
|
-
|
19
|
+
|
20
|
+
if argv[:api_gateway]
|
21
|
+
sms.send_via_gateway(argv)
|
22
|
+
else
|
23
|
+
sms.send_via_http(argv)
|
24
|
+
end
|
14
25
|
end
|
15
26
|
|
16
27
|
# argv: {sender: "ILETI MRKZI",
|
@@ -21,23 +32,47 @@ module IletimerkeziSMS
|
|
21
32
|
# ]
|
22
33
|
# }
|
23
34
|
def self.multi_send(username, password, argv)
|
35
|
+
argv = {
|
36
|
+
api_gateway: false
|
37
|
+
}.merge(argv)
|
38
|
+
|
24
39
|
sms = SMS.new(username, password)
|
25
|
-
|
40
|
+
|
41
|
+
if argv[:api_gateway]
|
42
|
+
sms.multi_send_via_gateway(argv)
|
43
|
+
else
|
44
|
+
sms.multi_send_via_http(argv)
|
45
|
+
end
|
26
46
|
end
|
27
47
|
|
28
|
-
def self.cancel(username, password, order_id)
|
48
|
+
def self.cancel(username, password, order_id, api_gateway = false)
|
29
49
|
sms = SMS.new(username, password)
|
30
|
-
|
50
|
+
if api_gateway
|
51
|
+
sms.cancel_via_gateway(order_id)
|
52
|
+
else
|
53
|
+
sms.cancel_via_http(order_id)
|
54
|
+
end
|
31
55
|
end
|
32
56
|
|
33
|
-
def self.balance(username, password)
|
57
|
+
def self.balance(username, password, api_gateway = false)
|
34
58
|
sms = REPORT.new(username, password)
|
35
|
-
|
59
|
+
if api_gateway
|
60
|
+
sms.balance_via_gateway
|
61
|
+
else
|
62
|
+
sms.balance_via_http
|
63
|
+
end
|
36
64
|
end
|
37
65
|
|
38
66
|
# argv:
|
39
67
|
def self.report(username, password, argv)
|
68
|
+
argv = {
|
69
|
+
api_gateway: false
|
70
|
+
}.merge(argv)
|
40
71
|
sms = REPORT.new(username, password)
|
41
|
-
|
72
|
+
if argv[:api_gateway]
|
73
|
+
sms.report_via_gateway(argv)
|
74
|
+
else
|
75
|
+
sms.report_via_http(argv)
|
76
|
+
end
|
42
77
|
end
|
43
78
|
end
|
@@ -10,7 +10,7 @@ module IletimerkeziSMS
|
|
10
10
|
@password = password
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
13
|
+
def report_via_http(argv)
|
14
14
|
argv = {
|
15
15
|
page: 1,
|
16
16
|
rowCount: 1000
|
@@ -35,7 +35,35 @@ module IletimerkeziSMS
|
|
35
35
|
return r.request
|
36
36
|
end
|
37
37
|
|
38
|
-
def
|
38
|
+
def report_via_gateway(argv)
|
39
|
+
argv = {
|
40
|
+
page: 1,
|
41
|
+
rowCount: 1000
|
42
|
+
}.merge(argv)
|
43
|
+
|
44
|
+
path = "get-report"
|
45
|
+
|
46
|
+
digest = OpenSSL::Digest.new('sha256')
|
47
|
+
hcmac = OpenSSL::HMAC.hexdigest(digest, @password, @username)
|
48
|
+
|
49
|
+
xml_build = Nokogiri::XML::Builder.new do |xml|
|
50
|
+
xml.request {
|
51
|
+
xml.authentication {
|
52
|
+
xlm.key @username
|
53
|
+
xlm.hash_ hcmac
|
54
|
+
}
|
55
|
+
xml.order{
|
56
|
+
xml.id_ argv[:id]
|
57
|
+
xml.page argv[:page]
|
58
|
+
xml.rowCount argv[:rowCount]
|
59
|
+
}
|
60
|
+
}
|
61
|
+
end
|
62
|
+
r = REQUEST.new(path,xml_build.to_xml)
|
63
|
+
return r.request
|
64
|
+
end
|
65
|
+
|
66
|
+
def balance_via_http
|
39
67
|
path = "get-balance"
|
40
68
|
xml_build = Nokogiri::XML::Builder.new do |xml|
|
41
69
|
xml.request {
|
@@ -48,5 +76,21 @@ module IletimerkeziSMS
|
|
48
76
|
r = REQUEST.new(path,xml_build.to_xml)
|
49
77
|
return r.request
|
50
78
|
end
|
79
|
+
|
80
|
+
def balance_via_gateway
|
81
|
+
digest = OpenSSL::Digest.new('sha256')
|
82
|
+
hcmac = OpenSSL::HMAC.hexdigest(digest, @password, @username)
|
83
|
+
path = "get-balance"
|
84
|
+
xml_build = Nokogiri::XML::Builder.new do |xlm|
|
85
|
+
xlm.request {
|
86
|
+
xlm.authentication {
|
87
|
+
xlm.key @username
|
88
|
+
xlm.hash_ hcmac
|
89
|
+
}
|
90
|
+
}
|
91
|
+
end
|
92
|
+
r = REQUEST.new(path,xml_build.to_xml)
|
93
|
+
return r.request
|
94
|
+
end
|
51
95
|
end
|
52
96
|
end
|
data/lib/iletimerkezisms/sms.rb
CHANGED
@@ -14,7 +14,7 @@ module IletimerkeziSMS
|
|
14
14
|
# sms.send({sender: "ILETI MRKZI", message: "Lorem Ipsum ...",
|
15
15
|
# numbers: ["905xxxxxxxxx"," +90 5xx xxx xx xx", "5xxxxxxxxx"]})
|
16
16
|
# Description: Single Message => Multi Number
|
17
|
-
def
|
17
|
+
def send_via_http(argv)
|
18
18
|
path = "send-sms"
|
19
19
|
argv = {sendDateTime: Time.now.strftime("%d/%m/%Y %H:%M")}.merge(argv)
|
20
20
|
xml_build = Nokogiri::XML::Builder.new do |xlm|
|
@@ -41,6 +41,39 @@ module IletimerkeziSMS
|
|
41
41
|
return r.request
|
42
42
|
end
|
43
43
|
|
44
|
+
# Usage: sms = IletimerkeziSMS::SMS.new("keypublic","keysecret")
|
45
|
+
# sms.send({sender: "ILETI MRKZI", message: "Lorem Ipsum ...",
|
46
|
+
# numbers: ["905xxxxxxxxx"," +90 5xx xxx xx xx", "5xxxxxxxxx"]})
|
47
|
+
# Description: Single Message => Multi Number
|
48
|
+
|
49
|
+
def send_via_gateway(argv)
|
50
|
+
digest = OpenSSL::Digest.new('sha256')
|
51
|
+
hcmac = OpenSSL::HMAC.hexdigest(digest, @password, @username)
|
52
|
+
path = "send-sms"
|
53
|
+
xml_build = Nokogiri::XML::Builder.new do |xlm|
|
54
|
+
xlm.request {
|
55
|
+
xlm.authentication {
|
56
|
+
xlm.key @username
|
57
|
+
xlm.hash_ hcmac
|
58
|
+
}
|
59
|
+
xlm.order {
|
60
|
+
xlm.sender argv[:sender]
|
61
|
+
xlm.sendDateTime Time.now.strftime("%d/%m/%Y %H:%M")
|
62
|
+
xlm.message {
|
63
|
+
xlm.text_ argv[:message]
|
64
|
+
xlm.receipents{
|
65
|
+
argv[:numbers].each do |n|
|
66
|
+
xlm.number n
|
67
|
+
end
|
68
|
+
}
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}
|
72
|
+
end
|
73
|
+
r = REQUEST.new(path,xml_build.to_xml)
|
74
|
+
return r.request
|
75
|
+
end
|
76
|
+
|
44
77
|
# Usage: sms = IletimerkeziSMS::SMS.new("5545967632","5173539")
|
45
78
|
# sms.send({sender: "ILETI MRKZI",
|
46
79
|
# messages: [
|
@@ -50,7 +83,7 @@ module IletimerkeziSMS
|
|
50
83
|
# ]
|
51
84
|
# })
|
52
85
|
# Description: Multi Message => Multi Number (Birden fazla farklı mesajı birden fazla farklı kişiye göndermeye yarar.)
|
53
|
-
def
|
86
|
+
def multi_send_via_http(argv)
|
54
87
|
path = "send-sms"
|
55
88
|
argv = {sendDateTime: Time.now.strftime("%d/%m/%Y %H:%M")}.merge(argv)
|
56
89
|
xml_build = Nokogiri::XML::Builder.new do |xlm|
|
@@ -78,11 +111,41 @@ module IletimerkeziSMS
|
|
78
111
|
r = REQUEST.new(path,xml_build.to_xml)
|
79
112
|
return r.request
|
80
113
|
end
|
114
|
+
|
115
|
+
def multi_send_via_gateway(argv)
|
116
|
+
digest = OpenSSL::Digest.new('sha256')
|
117
|
+
hcmac = OpenSSL::HMAC.hexdigest(digest, @password, @username)
|
118
|
+
path = "send-sms"
|
119
|
+
xml_build = Nokogiri::XML::Builder.new do |xlm|
|
120
|
+
xlm.request {
|
121
|
+
xlm.authentication {
|
122
|
+
xlm.key @username
|
123
|
+
xlm.hash_ hcmac
|
124
|
+
}
|
125
|
+
xlm.order {
|
126
|
+
xlm.sender argv[:sender]
|
127
|
+
xlm.sendDateTime argv[:sendDateTime]
|
128
|
+
argv[:messages].each do |message|
|
129
|
+
xlm.message {
|
130
|
+
xlm.text_ message[:text]
|
131
|
+
xlm.receipents{
|
132
|
+
message[:numbers].each do |n|
|
133
|
+
xlm.number n
|
134
|
+
end
|
135
|
+
}
|
136
|
+
}
|
137
|
+
end
|
138
|
+
}
|
139
|
+
}
|
140
|
+
end
|
141
|
+
r = REQUEST.new(path,xml_build.to_xml)
|
142
|
+
return r.request
|
143
|
+
end
|
81
144
|
|
82
145
|
# Usage: sms = IletimerkeziSMS::SMS.new("5545967632","5173539")
|
83
146
|
# sms.cancel("4152")
|
84
147
|
# Description: Gönderilen sms paketini iptal etmeye yarar.
|
85
|
-
def
|
148
|
+
def cancel_via_http(order_id)
|
86
149
|
path = "cancel-order"
|
87
150
|
xml_build = Nokogiri::XML::Builder.new do |xlm|
|
88
151
|
xlm.request {
|
@@ -98,5 +161,24 @@ module IletimerkeziSMS
|
|
98
161
|
r = REQUEST.new(path,xml_build.to_xml)
|
99
162
|
return r.request
|
100
163
|
end
|
164
|
+
|
165
|
+
def cancel_via_gateway(order_id)
|
166
|
+
digest = OpenSSL::Digest.new('sha256')
|
167
|
+
hcmac = OpenSSL::HMAC.hexdigest(digest, @password, @username)
|
168
|
+
path = "send-sms"
|
169
|
+
xml_build = Nokogiri::XML::Builder.new do |xlm|
|
170
|
+
xlm.request {
|
171
|
+
xlm.authentication {
|
172
|
+
xlm.key @username
|
173
|
+
xlm.hash_ hcmac
|
174
|
+
}
|
175
|
+
xlm.order {
|
176
|
+
xlm.id_ order_id.to_s
|
177
|
+
}
|
178
|
+
}
|
179
|
+
end
|
180
|
+
r = REQUEST.new(path,xml_build.to_xml)
|
181
|
+
return r.request
|
182
|
+
end
|
101
183
|
end
|
102
184
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iletimerkezisms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Irfan SUBAS
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -16,20 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.8.1
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 1.
|
22
|
+
version: 1.8.1
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 1.
|
29
|
+
version: 1.8.1
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 1.
|
32
|
+
version: 1.8.1
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: rest-client
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
101
|
version: '0'
|
102
102
|
requirements: []
|
103
103
|
rubyforge_project:
|
104
|
-
rubygems_version: 2.2.
|
104
|
+
rubygems_version: 2.5.2.1
|
105
105
|
signing_key:
|
106
106
|
specification_version: 4
|
107
107
|
summary: api.iletimerkezi.com API Ruby SMS GEM
|