iletimerkezisms 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/iletimerkezisms.rb +43 -0
- data/lib/iletimerkezisms/report.rb +52 -0
- data/lib/iletimerkezisms/request.rb +23 -0
- data/lib/iletimerkezisms/sms.rb +100 -0
- metadata +90 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: baf78905223a49ba069684947da9beef86322d09
|
4
|
+
data.tar.gz: bcbc504cb51821f3ebd76bd0e38c8908fd791ca8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1048871e45b4377b41f2d15fe1d870b74392c35021d2b92438e90e8c1a93ef0f8eaec17924859a7d6442da85697b57004348875e37defe67d5abc842ae7a96ed
|
7
|
+
data.tar.gz: af6c012c411b971ae0788740a9dfeadcb573252649118cdda9907e875eef4d945f9eaee267fe8178791343eb7caabe6e326f6d8c76a47d1d6fb5a4cc519f1752
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require File.expand_path('../iletimerkezisms/sms', __FILE__)
|
4
|
+
require File.expand_path('../iletimerkezisms/report', __FILE__)
|
5
|
+
require File.expand_path('../iletimerkezisms/request', __FILE__)
|
6
|
+
|
7
|
+
module IletimerkeziSMS
|
8
|
+
# argv: {sender: "ILETI MRKZI", message: "Lorem Ipsum ...",
|
9
|
+
# numbers: ["905xxxxxxxxx"," +90 5xx xxx xx xx", "5xxxxxxxxx"]
|
10
|
+
# }
|
11
|
+
def self.send(username, password, argv)
|
12
|
+
sms = SMS.new(username, password)
|
13
|
+
sms.send(argv)
|
14
|
+
end
|
15
|
+
|
16
|
+
# argv: {sender: "ILETI MRKZI",
|
17
|
+
# messages: [
|
18
|
+
# {text: "Message_one", numbers: ["905xxxxxxxxx"," +90 5xx xxx xx xx", "5xxxxxxxxx"]},
|
19
|
+
# {text: "Message_two", numbers: ["905xxxxxxxxx"," +90 5xx xxx xx xx"]},
|
20
|
+
# {text: "Message_there", numbers: ["905xxxxxxxxx"]}
|
21
|
+
# ]
|
22
|
+
# }
|
23
|
+
def self.multi_send(username, password, argv)
|
24
|
+
sms = SMS.new(username, password)
|
25
|
+
sms.multi_send(argv)
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.cancel(username, password, order_id)
|
29
|
+
sms = SMS.new(username, password)
|
30
|
+
sms.cancel(order_id)
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.balance(username, password)
|
34
|
+
sms = REPORT.new(username, password)
|
35
|
+
sms.balance
|
36
|
+
end
|
37
|
+
|
38
|
+
# argv:
|
39
|
+
def self.report(username, password, argv)
|
40
|
+
sms = REPORT.new(username, password)
|
41
|
+
sms.report(argv)
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require "iletimerkezisms/request"
|
4
|
+
require 'nokogiri'
|
5
|
+
|
6
|
+
module IletimerkeziSMS
|
7
|
+
class REPORT
|
8
|
+
def initialize(username, password)
|
9
|
+
@username = username
|
10
|
+
@password = password
|
11
|
+
end
|
12
|
+
|
13
|
+
def report(argv)
|
14
|
+
argv = {
|
15
|
+
page: 1,
|
16
|
+
rowCount: 1000
|
17
|
+
}.merge(argv)
|
18
|
+
|
19
|
+
path = "get-report"
|
20
|
+
|
21
|
+
xml_build = Nokogiri::XML::Builder.new do |xml|
|
22
|
+
xml.request {
|
23
|
+
xml.authentication {
|
24
|
+
xml.username @username
|
25
|
+
xml.password @password
|
26
|
+
}
|
27
|
+
xml.order{
|
28
|
+
xml.id_ argv[:id]
|
29
|
+
xml.page argv[:page]
|
30
|
+
xml.rowCount argv[:rowCount]
|
31
|
+
}
|
32
|
+
}
|
33
|
+
end
|
34
|
+
r = REQUEST.new(path,xml_build.to_xml)
|
35
|
+
return r.request
|
36
|
+
end
|
37
|
+
|
38
|
+
def balance
|
39
|
+
path = "get-balance"
|
40
|
+
xml_build = Nokogiri::XML::Builder.new do |xml|
|
41
|
+
xml.request {
|
42
|
+
xml.authentication {
|
43
|
+
xml.username @username
|
44
|
+
xml.password @password
|
45
|
+
}
|
46
|
+
}
|
47
|
+
end
|
48
|
+
r = REQUEST.new(path,xml_build.to_xml)
|
49
|
+
return r.request
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rest-client'
|
4
|
+
require 'crack/xml'
|
5
|
+
|
6
|
+
module IletimerkeziSMS
|
7
|
+
class REQUEST
|
8
|
+
def initialize(path, params)
|
9
|
+
@params = params
|
10
|
+
@api_base_url = "http://api.iletimerkezi.com/v1/#{path}"
|
11
|
+
end
|
12
|
+
|
13
|
+
def request
|
14
|
+
begin
|
15
|
+
resource = RestClient::Resource.new(@api_base_url, timeout: 30, open_timeout: 30)
|
16
|
+
response = resource.post @params, content_type: :xml, accept: :xml
|
17
|
+
rescue RestClient::ExceptionWithResponse => err
|
18
|
+
response = err.response
|
19
|
+
end
|
20
|
+
return Crack::XML.parse(response.body)["response"]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'nokogiri'
|
4
|
+
require "iletimerkezisms/request"
|
5
|
+
|
6
|
+
module IletimerkeziSMS
|
7
|
+
class SMS
|
8
|
+
def initialize(username, password)
|
9
|
+
@username = username
|
10
|
+
@password = password
|
11
|
+
end
|
12
|
+
|
13
|
+
# Usage: sms = IletimerkeziSMS::SMS.new("5545967632","5173539")
|
14
|
+
# sms.send({sender: "ILETI MRKZI", message: "Lorem Ipsum ...",
|
15
|
+
# numbers: ["905xxxxxxxxx"," +90 5xx xxx xx xx", "5xxxxxxxxx"]})
|
16
|
+
# Description: Single Message => Multi Number
|
17
|
+
def send(argv)
|
18
|
+
path = "send-sms"
|
19
|
+
xml_build = Nokogiri::XML::Builder.new do |xlm|
|
20
|
+
xlm.request {
|
21
|
+
xlm.authentication {
|
22
|
+
xlm.username @username
|
23
|
+
xlm.password @password
|
24
|
+
}
|
25
|
+
xlm.order {
|
26
|
+
xlm.sender argv[:sender]
|
27
|
+
xlm.sendDateTime Time.now.strftime("%d/%m/%Y %H:%M")
|
28
|
+
xlm.message {
|
29
|
+
xlm.text_ argv[:message]
|
30
|
+
xlm.receipents{
|
31
|
+
argv[:numbers].each do |n|
|
32
|
+
xlm.number n
|
33
|
+
end
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
37
|
+
}
|
38
|
+
end
|
39
|
+
r = REQUEST.new(path,xml_build.to_xml)
|
40
|
+
return r.request
|
41
|
+
end
|
42
|
+
|
43
|
+
# Usage: sms = IletimerkeziSMS::SMS.new("5545967632","5173539")
|
44
|
+
# sms.send({sender: "ILETI MRKZI",
|
45
|
+
# messages: [
|
46
|
+
# {text: "Message_one", numbers: ["905xxxxxxxxx"," +90 5xx xxx xx xx", "5xxxxxxxxx"]},
|
47
|
+
# {text: "Message_two", numbers: ["905xxxxxxxxx"," +90 5xx xxx xx xx"]},
|
48
|
+
# {text: "Message_there", numbers: ["905xxxxxxxxx"]}
|
49
|
+
# ]
|
50
|
+
# })
|
51
|
+
# Description: Multi Message => Multi Number (Birden fazla farklı mesajı birden fazla farklı kişiye göndermeye yarar.)
|
52
|
+
def multi_send(argv)
|
53
|
+
path = "send-sms"
|
54
|
+
xml_build = Nokogiri::XML::Builder.new do |xlm|
|
55
|
+
xlm.request {
|
56
|
+
xlm.authentication {
|
57
|
+
xlm.username @username
|
58
|
+
xlm.password @password
|
59
|
+
}
|
60
|
+
xlm.order {
|
61
|
+
xlm.sender argv[:sender]
|
62
|
+
xlm.sendDateTime Time.now.strftime("%d/%m/%Y %H:%M")
|
63
|
+
argv[:messages].each do |message|
|
64
|
+
xlm.message {
|
65
|
+
xlm.text_ message[:text]
|
66
|
+
xlm.receipents{
|
67
|
+
message[:numbers].each do |n|
|
68
|
+
xlm.number n
|
69
|
+
end
|
70
|
+
}
|
71
|
+
}
|
72
|
+
end
|
73
|
+
}
|
74
|
+
}
|
75
|
+
end
|
76
|
+
r = REQUEST.new(path,xml_build.to_xml)
|
77
|
+
return r.request
|
78
|
+
end
|
79
|
+
|
80
|
+
# Usage: sms = IletimerkeziSMS::SMS.new("5545967632","5173539")
|
81
|
+
# sms.cancel("4152")
|
82
|
+
# Description: Gönderilen sms paketini iptal etmeye yarar.
|
83
|
+
def cancel(order_id)
|
84
|
+
path = "cancel-order"
|
85
|
+
xml_build = Nokogiri::XML::Builder.new do |xlm|
|
86
|
+
xlm.request {
|
87
|
+
xlm.authentication {
|
88
|
+
xlm.username @username
|
89
|
+
xlm.password @password
|
90
|
+
}
|
91
|
+
xlm.order {
|
92
|
+
xlm.id_ order_id.to_s
|
93
|
+
}
|
94
|
+
}
|
95
|
+
end
|
96
|
+
r = REQUEST.new(path,xml_build.to_xml)
|
97
|
+
return r.request
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
metadata
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: iletimerkezisms
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Irfan SUBAS
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-07-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: nokogiri
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rest-client
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: crack
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: api.iletimerkezi.com uzerinden toplu sms gonderme, raporlama gibi islemleri
|
56
|
+
yapabilmek icin hazırlanmistir
|
57
|
+
email: irfansubas08@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- lib/iletimerkezisms.rb
|
63
|
+
- lib/iletimerkezisms/report.rb
|
64
|
+
- lib/iletimerkezisms/request.rb
|
65
|
+
- lib/iletimerkezisms/sms.rb
|
66
|
+
homepage: https://github.com/irfansubas/iletimerkezisms
|
67
|
+
licenses:
|
68
|
+
- MIT
|
69
|
+
metadata: {}
|
70
|
+
post_install_message:
|
71
|
+
rdoc_options: []
|
72
|
+
require_paths:
|
73
|
+
- lib
|
74
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
requirements: []
|
85
|
+
rubyforge_project:
|
86
|
+
rubygems_version: 2.4.5
|
87
|
+
signing_key:
|
88
|
+
specification_version: 4
|
89
|
+
summary: api.iletimerkezi.com API Ruby SMS GEM
|
90
|
+
test_files: []
|