ileti_merkezi 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.circleci/config.yml +33 -0
- data/.env +4 -0
- data/.envrc +2 -0
- data/.gitignore +8 -0
- data/.reek +17 -0
- data/.rubocop.yml +13 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +18 -0
- data/Gemfile.lock +73 -0
- data/LICENSE.txt +21 -0
- data/README.md +287 -0
- data/Rakefile +10 -0
- data/bin/console +8 -0
- data/bin/setup +8 -0
- data/ileti_merkezi.gemspec +32 -0
- data/lib/ileti_merkezi/account.rb +49 -0
- data/lib/ileti_merkezi/authentication.rb +32 -0
- data/lib/ileti_merkezi/balance.rb +15 -0
- data/lib/ileti_merkezi/cancel.rb +25 -0
- data/lib/ileti_merkezi/configuration.rb +65 -0
- data/lib/ileti_merkezi/error.rb +6 -0
- data/lib/ileti_merkezi/message.rb +48 -0
- data/lib/ileti_merkezi/report.rb +31 -0
- data/lib/ileti_merkezi/request.rb +77 -0
- data/lib/ileti_merkezi/response.rb +36 -0
- data/lib/ileti_merkezi/sms.rb +39 -0
- data/lib/ileti_merkezi/status.rb +54 -0
- data/lib/ileti_merkezi/version.rb +5 -0
- data/lib/ileti_merkezi.rb +172 -0
- metadata +136 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9d8ca4c9c2baa6448dae75a695a6dcb83bdb3021
|
4
|
+
data.tar.gz: ead6b427e956c5a9d7ebd9a5eb58b7f8e91dfdf9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 96ce7a9542d776e8b720e1e12ce87aff6229257c76287c48d28e8d05accb66ef37c058915c8e72edc6229948bef6a15765c436299514e25117c37fa5d26460b3
|
7
|
+
data.tar.gz: '009658482f1f196506f82e82895e45e58b5b6baf95ac344b00475947ee4fe6aff690c3ac404c3af305647db74102701a63d19997dbd92eab9fde8393ca0a05cc'
|
@@ -0,0 +1,33 @@
|
|
1
|
+
version: 2
|
2
|
+
jobs:
|
3
|
+
build:
|
4
|
+
working_directory: ~/ims
|
5
|
+
docker:
|
6
|
+
- image: circleci/ruby:2.4-node
|
7
|
+
environment:
|
8
|
+
RACK_ENV: test
|
9
|
+
|
10
|
+
steps:
|
11
|
+
- checkout
|
12
|
+
|
13
|
+
- restore_cache:
|
14
|
+
keys:
|
15
|
+
- iletimerkezi-bundle-{{ checksum "Gemfile.lock" }}
|
16
|
+
- iletimerkezi-bundle-
|
17
|
+
|
18
|
+
- run:
|
19
|
+
name: Bundle Install
|
20
|
+
command: bundle check || bundle install
|
21
|
+
|
22
|
+
- save_cache:
|
23
|
+
key: iletimerkezi-bundle-{{ checksum "Gemfile.lock" }}
|
24
|
+
paths:
|
25
|
+
- vendor/bundle
|
26
|
+
|
27
|
+
- run:
|
28
|
+
name: Rubocop Check
|
29
|
+
command: bundle exec rubocop
|
30
|
+
|
31
|
+
- run:
|
32
|
+
name: Test
|
33
|
+
command: bundle exec rake test
|
data/.env
ADDED
data/.envrc
ADDED
data/.gitignore
ADDED
data/.reek
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
exclude_paths:
|
2
|
+
- test
|
3
|
+
|
4
|
+
UtilityFunction:
|
5
|
+
public_methods_only: true
|
6
|
+
|
7
|
+
IrresponsibleModule:
|
8
|
+
enabled: false
|
9
|
+
|
10
|
+
ManualDispatch:
|
11
|
+
exclude:
|
12
|
+
- 'IletiMerkezi::Request#http'
|
13
|
+
|
14
|
+
FeatureEnvy:
|
15
|
+
exclude:
|
16
|
+
- 'Account#info'
|
17
|
+
- 'Account#senders'
|
data/.rubocop.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at irfan.subas@uzem.omu.edu.tr. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
4
|
+
|
5
|
+
gemspec
|
6
|
+
|
7
|
+
group :development, :test do
|
8
|
+
gem 'dotenv'
|
9
|
+
gem 'pry'
|
10
|
+
gem 'rubocop'
|
11
|
+
end
|
12
|
+
|
13
|
+
group :test do
|
14
|
+
gem 'minitest-focus'
|
15
|
+
gem 'minitest-reporters'
|
16
|
+
gem 'vcr'
|
17
|
+
gem 'webmock'
|
18
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
ileti_merkezi (0.1.0)
|
5
|
+
ox (~> 2.8, >= 2.8.2)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
addressable (2.5.2)
|
11
|
+
public_suffix (>= 2.0.2, < 4.0)
|
12
|
+
ansi (1.5.0)
|
13
|
+
ast (2.3.0)
|
14
|
+
builder (3.2.3)
|
15
|
+
coderay (1.1.2)
|
16
|
+
crack (0.4.3)
|
17
|
+
safe_yaml (~> 1.0.0)
|
18
|
+
dotenv (2.2.1)
|
19
|
+
hashdiff (0.3.7)
|
20
|
+
method_source (0.9.0)
|
21
|
+
minitest (5.11.1)
|
22
|
+
minitest-focus (1.1.2)
|
23
|
+
minitest (>= 4, < 6)
|
24
|
+
minitest-reporters (1.1.19)
|
25
|
+
ansi
|
26
|
+
builder
|
27
|
+
minitest (>= 5.0)
|
28
|
+
ruby-progressbar
|
29
|
+
ox (2.8.2)
|
30
|
+
parallel (1.12.1)
|
31
|
+
parser (2.4.0.2)
|
32
|
+
ast (~> 2.3)
|
33
|
+
powerpack (0.1.1)
|
34
|
+
pry (0.11.3)
|
35
|
+
coderay (~> 1.1.0)
|
36
|
+
method_source (~> 0.9.0)
|
37
|
+
public_suffix (3.0.1)
|
38
|
+
rainbow (3.0.0)
|
39
|
+
rake (10.5.0)
|
40
|
+
rubocop (0.52.1)
|
41
|
+
parallel (~> 1.10)
|
42
|
+
parser (>= 2.4.0.2, < 3.0)
|
43
|
+
powerpack (~> 0.1)
|
44
|
+
rainbow (>= 2.2.2, < 4.0)
|
45
|
+
ruby-progressbar (~> 1.7)
|
46
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
47
|
+
ruby-progressbar (1.9.0)
|
48
|
+
safe_yaml (1.0.4)
|
49
|
+
unicode-display_width (1.3.0)
|
50
|
+
vcr (4.0.0)
|
51
|
+
webmock (3.2.1)
|
52
|
+
addressable (>= 2.3.6)
|
53
|
+
crack (>= 0.3.2)
|
54
|
+
hashdiff
|
55
|
+
|
56
|
+
PLATFORMS
|
57
|
+
ruby
|
58
|
+
|
59
|
+
DEPENDENCIES
|
60
|
+
bundler (~> 1.16)
|
61
|
+
dotenv
|
62
|
+
ileti_merkezi!
|
63
|
+
minitest (~> 5.0)
|
64
|
+
minitest-focus
|
65
|
+
minitest-reporters
|
66
|
+
pry
|
67
|
+
rake (~> 10.0)
|
68
|
+
rubocop
|
69
|
+
vcr
|
70
|
+
webmock
|
71
|
+
|
72
|
+
BUNDLED WITH
|
73
|
+
1.16.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 İrfan Subaş
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,287 @@
|
|
1
|
+
[![CircleCI](https://circleci.com/gh/isubas/ileti_merkezi.svg?style=svg)](https://circleci.com/gh/isubas/ileti_merkezi)
|
2
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/b427c95759e1dca1e3dc/maintainability)](https://codeclimate.com/github/isubas/ileti_merkezi/maintainability)
|
3
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/b427c95759e1dca1e3dc/test_coverage)](https://codeclimate.com/github/isubas/ileti_merkezi/test_coverage)
|
4
|
+
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/cecce51ce4d94f3ca1dcc1e99bdcbce6)](https://www.codacy.com/app/isubas/ileti_merkezi?utm_source=github.com&utm_medium=referral&utm_content=isubas/ileti_merkezi&utm_campaign=Badge_Grade)
|
5
|
+
|
6
|
+
# IletiMerkezi
|
7
|
+
iletimerkezi.com API'lerini kullanarak toplu sms gönderme ve raporlama
|
8
|
+
işlemlerini yapabilmek için hazırlanan Ruby istemcisidir.
|
9
|
+
|
10
|
+
## Kurulum
|
11
|
+
|
12
|
+
Add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem 'ileti_merkezi'
|
16
|
+
```
|
17
|
+
|
18
|
+
And then execute:
|
19
|
+
|
20
|
+
$ bundle
|
21
|
+
|
22
|
+
Or install it yourself as:
|
23
|
+
|
24
|
+
$ gem install ileti_merkezi
|
25
|
+
|
26
|
+
## Kullanım
|
27
|
+
|
28
|
+
### Yapılandırma
|
29
|
+
|
30
|
+
Rails uygulamanızda `config/initializers/ileti_merkezi_configure.rb` dosyası oluştururak
|
31
|
+
aşağıdaki kodları içerisine yapıştırınız.
|
32
|
+
|
33
|
+
Eğer kimlik doğrulama işlemini kullanıcı adı ve parola üzerinden yapmak istiyorsanız username ve passord bilgilerini,
|
34
|
+
token tabalı yapmak istiyorsanız public_key ve secret_key bilgilerini doldurmanız gerekmektedir.
|
35
|
+
|
36
|
+
Bu dört alanda doldurulmuş ise sistem token tabanlı doğrulama yapacaktır.
|
37
|
+
|
38
|
+
public ve secret key bilgilerini https://www.iletimerkezi.com/user/preferences adresinden oluşturabilirsiniz.
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
IletiMerkezi.configure do |config|
|
42
|
+
# Default: http://api.iletimerkezi.com/v1'
|
43
|
+
config.endpoint = 'http://api.iletimerkezi.com/v1'
|
44
|
+
config.sender = 'FOO'
|
45
|
+
# opsiyonel
|
46
|
+
config.request_overrides = {
|
47
|
+
use_ssl: true # default false
|
48
|
+
verify_mode: OpenSSL::SSL::VERIFY_PEER,
|
49
|
+
read_timeout: 30, # default 30
|
50
|
+
open_timeout: 30 # default 30
|
51
|
+
}
|
52
|
+
# Kimlik Doğrulama: username ve password
|
53
|
+
config.username = 'username'
|
54
|
+
config.password = 'password'
|
55
|
+
# Kimlik Doğrulama: token tabanlı
|
56
|
+
config.public_key = 'public_key'
|
57
|
+
config.secret_key = 'secret_key'
|
58
|
+
end
|
59
|
+
```
|
60
|
+
|
61
|
+
Veya
|
62
|
+
|
63
|
+
- Ortam değişkeleri ile yapılandırabilirsiniz. bknz: .env
|
64
|
+
|
65
|
+
```ruby
|
66
|
+
IM_ENDPOINT = 'http://api.iletimerkezi.com/v1' # Default: http://api.iletimerkezi.com/v1
|
67
|
+
# Kimlik Doğrulama: username ve password
|
68
|
+
IM_USERNAME = 'username'
|
69
|
+
IM_PASSWORD = 'password'
|
70
|
+
# Kimlik Doğrulama: token tabanlı
|
71
|
+
IM_PUBLIC_KEY = 'public_key'
|
72
|
+
IM_SECRET_KEY = 'secret_key'
|
73
|
+
|
74
|
+
IM_SENDER = 'SENDER'
|
75
|
+
```
|
76
|
+
|
77
|
+
### SMS Gönderme
|
78
|
+
|
79
|
+
#### Tek Mesaj - Çoklu Alıcı
|
80
|
+
|
81
|
+
```ruby
|
82
|
+
|
83
|
+
args = {
|
84
|
+
send_datetime: '15/01/2017 12:00' # Opsiyonel
|
85
|
+
sender: 'TEST' # Opsiyonel
|
86
|
+
phones: ['0555 555 00 01', '0555 555 00 02']
|
87
|
+
text: 'Test Mesajı'
|
88
|
+
}
|
89
|
+
|
90
|
+
# return IletiMerkezi::Response
|
91
|
+
response = IletiMerkezi.send(args)
|
92
|
+
# veya
|
93
|
+
sms = IletiMerkezi::Sms.new(args)
|
94
|
+
response = sms.send
|
95
|
+
|
96
|
+
response.code # return 200
|
97
|
+
response.body # http raw body
|
98
|
+
response.message # return status message
|
99
|
+
response.error? # return true or false
|
100
|
+
response.to_h
|
101
|
+
# return hash
|
102
|
+
{
|
103
|
+
:status => {
|
104
|
+
:code => "200",
|
105
|
+
:message => "İşlem başarılı"
|
106
|
+
},
|
107
|
+
:order => {
|
108
|
+
:id => "order_id"
|
109
|
+
}
|
110
|
+
}
|
111
|
+
```
|
112
|
+
|
113
|
+
#### Çoklu Mesaj - Çoklu Alıcı
|
114
|
+
|
115
|
+
```ruby
|
116
|
+
args = {
|
117
|
+
send_datetime: '15/01/2017 12:00' # Opsiyonel
|
118
|
+
sender: 'TEST' # Opsiyonel
|
119
|
+
messages: [
|
120
|
+
{
|
121
|
+
text: 'Test Mesajı Bir',
|
122
|
+
phones: ['0555 555 00 01', '0555 555 00 02'],
|
123
|
+
},
|
124
|
+
{
|
125
|
+
text: 'Test Mesajı İki',
|
126
|
+
phones: ['0555 555 00 03', '0555 555 00 04'],
|
127
|
+
}
|
128
|
+
]
|
129
|
+
}
|
130
|
+
|
131
|
+
# return IletiMerkezi::Response
|
132
|
+
response = IletiMerkezi.send(args)
|
133
|
+
# veya
|
134
|
+
sms = IletiMerkezi::Sms.new(args)
|
135
|
+
response = sms.send
|
136
|
+
|
137
|
+
response.code # return 200
|
138
|
+
response.body # http raw body
|
139
|
+
response.message # return status message
|
140
|
+
response.error? # return true or false
|
141
|
+
response.to_h
|
142
|
+
# return hash
|
143
|
+
{
|
144
|
+
:status => {
|
145
|
+
:code => "200",
|
146
|
+
:message => "İşlem başarılı"
|
147
|
+
},
|
148
|
+
:order => {
|
149
|
+
:id => "order_id"
|
150
|
+
}
|
151
|
+
}
|
152
|
+
```
|
153
|
+
|
154
|
+
### Zamanlamış SMS Gönderim İptali
|
155
|
+
|
156
|
+
- **Not**: Yalnız gelecek ki bir zamanda gönderilecek sms siparişleri iptal edilebilir.
|
157
|
+
|
158
|
+
```ruby
|
159
|
+
# return IletiMerkezi::Response
|
160
|
+
response = IletiMerkezi.cancel(order_id)
|
161
|
+
# or
|
162
|
+
cancel = IletiMerkezi::Cancel.new(order_id)
|
163
|
+
response = cancel.confirm
|
164
|
+
|
165
|
+
response.code # return 200
|
166
|
+
response.body # http raw body
|
167
|
+
response.message # return status message
|
168
|
+
response.error? # return true or false
|
169
|
+
response.to_h
|
170
|
+
# return hash
|
171
|
+
{
|
172
|
+
:status => {
|
173
|
+
:code => "200",
|
174
|
+
:message => "İşlem başarılı"
|
175
|
+
}
|
176
|
+
}
|
177
|
+
|
178
|
+
```
|
179
|
+
|
180
|
+
#### Bakiye Sorgulama
|
181
|
+
|
182
|
+
```ruby
|
183
|
+
# return IletiMerkezi::Response
|
184
|
+
response = IletiMerkezi.balance
|
185
|
+
|
186
|
+
response.code # return 200
|
187
|
+
response.body # http raw body
|
188
|
+
response.message # return status message
|
189
|
+
response.error? # return true or false
|
190
|
+
response.to_h
|
191
|
+
# return
|
192
|
+
{
|
193
|
+
:status => {
|
194
|
+
:code => "200",
|
195
|
+
:message => "İşlem başarılı"
|
196
|
+
},
|
197
|
+
:balance => {
|
198
|
+
:amount => "1",
|
199
|
+
:sms => "238760"
|
200
|
+
}
|
201
|
+
}
|
202
|
+
```
|
203
|
+
|
204
|
+
### SMS Sipariş Raporlama
|
205
|
+
|
206
|
+
#### Ek Bilgi:
|
207
|
+
|
208
|
+
- **page**: zorunlu değildir. Bir siparişteki alıcı sayısı row_count(1000)'den fazla
|
209
|
+
ise page parametresi kullanılarak diğer rapor sayfaları için istek yapılabilir.
|
210
|
+
- **row_count**: Bir sayfada göntülenecek rapor sayısı
|
211
|
+
|
212
|
+
```ruby
|
213
|
+
# return IletiMerkezi::Response
|
214
|
+
response = IletiMerkezi.report(order_id, page: 1, row_count: 1000) # defaults: (page: 1, row_count: 1000)
|
215
|
+
# veya
|
216
|
+
report = IletiMerkezi::Report.new(order_id, page: 1, row_count: 1000)
|
217
|
+
response = report.query
|
218
|
+
|
219
|
+
response.code # return 200
|
220
|
+
response.body # http raw body
|
221
|
+
response.message # return status message
|
222
|
+
response.error? # return true or false
|
223
|
+
response.to_h
|
224
|
+
# return hash
|
225
|
+
{
|
226
|
+
:status => {
|
227
|
+
:code => "200",
|
228
|
+
:message =>"İşlem başarılı"
|
229
|
+
},
|
230
|
+
:order => {
|
231
|
+
:id => "order_id",
|
232
|
+
:status => "114",
|
233
|
+
:total => "1",
|
234
|
+
:delivered => "1",
|
235
|
+
:undelivered => nil,
|
236
|
+
:waiting => nil,
|
237
|
+
:submitAt => "2018-01-16 15:08:37",
|
238
|
+
:sendAt => "2018-01-16 15:08:00",
|
239
|
+
:sender => "OMU UZEM",
|
240
|
+
:price => "1",
|
241
|
+
:status => "114",
|
242
|
+
:message => [
|
243
|
+
{ :number=>"+9055XXXXXXXX", :status=>"111" },
|
244
|
+
{ :number=>"+9055XXXXXXXX", :status=>"111" }
|
245
|
+
]
|
246
|
+
}
|
247
|
+
}
|
248
|
+
```
|
249
|
+
|
250
|
+
### Servis Durumu
|
251
|
+
|
252
|
+
```ruby
|
253
|
+
IletiMerkezi.status # return true or false
|
254
|
+
```
|
255
|
+
|
256
|
+
### Hesap Bilgileri
|
257
|
+
|
258
|
+
**Not:** Kullanıcı adı ve paralo bilgilerinin yapılandırmada doldurulmuş olması gerekmektedir.
|
259
|
+
|
260
|
+
```ruby
|
261
|
+
IletiMerkezi.info
|
262
|
+
```
|
263
|
+
|
264
|
+
### Hesabınıza Tanımlı Başlık Bilgileri
|
265
|
+
|
266
|
+
**Not:** Kullanıcı adı ve paralo bilgilerinin yapılandırmada doldurulmuş olması gerekmektedir.
|
267
|
+
|
268
|
+
```
|
269
|
+
IletiMerkezi.senders
|
270
|
+
```
|
271
|
+
|
272
|
+
## Contributing
|
273
|
+
|
274
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/isubas/ileti_merkezi.
|
275
|
+
This project is intended to be a safe, welcoming space for collaboration,
|
276
|
+
and contributors are expected to adhere to the
|
277
|
+
[Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
278
|
+
|
279
|
+
## License
|
280
|
+
|
281
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
282
|
+
|
283
|
+
## Code of Conduct
|
284
|
+
|
285
|
+
Everyone interacting in the IletiMerkezi project’s codebases, issue trackers,
|
286
|
+
chat rooms and mailing lists is expected to follow the
|
287
|
+
[code of conduct](https://github.com/isubas/ileti_merkezi/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
data/bin/setup
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path('lib', __dir__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'ileti_merkezi/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'ileti_merkezi'
|
8
|
+
spec.version = IletiMerkezi::VERSION
|
9
|
+
spec.authors = ['İrfan SUBAŞ']
|
10
|
+
spec.email = ['irfan.isubas@gmail.com']
|
11
|
+
|
12
|
+
spec.summary = 'api.iletimerkezi.com API Ruby SMS GEM"'
|
13
|
+
spec.description = '
|
14
|
+
api.iletimerkezi.com uzerinden toplu sms gonderme,
|
15
|
+
raporlama gibi islemleri yapabilmek icin hazırlanmistir.
|
16
|
+
'
|
17
|
+
spec.homepage = 'https://github.com/isubas/ileti_merkezi'
|
18
|
+
spec.license = 'MIT'
|
19
|
+
|
20
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
21
|
+
f.match(%r{^(test|spec|features)/})
|
22
|
+
end
|
23
|
+
spec.bindir = 'exe'
|
24
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
|
+
spec.require_paths = ['lib']
|
26
|
+
|
27
|
+
spec.add_development_dependency 'bundler', '~> 1.16'
|
28
|
+
spec.add_development_dependency 'minitest', '~> 5.0'
|
29
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
30
|
+
|
31
|
+
spec.add_dependency 'ox', '~> 2.8', '>= 2.8.2'
|
32
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module IletiMerkezi
|
4
|
+
# Account
|
5
|
+
class Account
|
6
|
+
PATH =
|
7
|
+
'http://dev.iletimerkezi.com/index.php?function=api&'\
|
8
|
+
'&special_username=Ns_eemsm&special_password=_Arg_ns_mmm'.freeze
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def info
|
12
|
+
request = Request.new(body: body_for_info)
|
13
|
+
request.uri = URI.parse(PATH + '&obj1=getUserInfo')
|
14
|
+
request.call
|
15
|
+
end
|
16
|
+
|
17
|
+
def senders
|
18
|
+
request = Request.new(body: body_for_senders)
|
19
|
+
request.uri = URI.parse(PATH + '&obj1=getSmsHeader')
|
20
|
+
request.call
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def body_for_senders
|
26
|
+
config = IletiMerkezi.configuration
|
27
|
+
<<-XML.gsub(/^[ ]+/, '').strip
|
28
|
+
<smsApi>
|
29
|
+
<userInfo>
|
30
|
+
<userName>#{config.username}</userName>
|
31
|
+
<userPassword>#{config.password}</userPassword>
|
32
|
+
<smsType>2</smsType>
|
33
|
+
</userInfo>
|
34
|
+
</smsApi>
|
35
|
+
XML
|
36
|
+
end
|
37
|
+
|
38
|
+
def body_for_info
|
39
|
+
config = IletiMerkezi.configuration
|
40
|
+
<<-XML.gsub(/^[ ]+/, '').strip
|
41
|
+
<userInfo>
|
42
|
+
<userName>#{config.username}</userName>
|
43
|
+
<userPassword>#{config.password}</userPassword>
|
44
|
+
</userInfo>
|
45
|
+
XML
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|