ileti_merkezi 0.1.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 9d8ca4c9c2baa6448dae75a695a6dcb83bdb3021
4
- data.tar.gz: ead6b427e956c5a9d7ebd9a5eb58b7f8e91dfdf9
2
+ SHA256:
3
+ metadata.gz: 199862ba23238dbf0e675ad562642542b1f778d991ece10e23c57d94ca49b688
4
+ data.tar.gz: 2a3dc8e18a1961efd15f217daca6703500deaff7d67478c78fef9e673d64cea8
5
5
  SHA512:
6
- metadata.gz: 96ce7a9542d776e8b720e1e12ce87aff6229257c76287c48d28e8d05accb66ef37c058915c8e72edc6229948bef6a15765c436299514e25117c37fa5d26460b3
7
- data.tar.gz: '009658482f1f196506f82e82895e45e58b5b6baf95ac344b00475947ee4fe6aff690c3ac404c3af305647db74102701a63d19997dbd92eab9fde8393ca0a05cc'
6
+ metadata.gz: cfbb03efcbb593a003071ece93967f51faea3716f474948481e660db741158392714069f3fa7bdd83f52617cec670bf8cb98f29e3ab65b4f4131c6f36e974708
7
+ data.tar.gz: cbbb0791a9de8e10fc9cad395923d94baf4e93c9f92f01c38866eb7df1cd942afa52476d873f6ff0b3f462040e53cfe9a89d9fa08dfbcb467441efde74d46eb2
data/README.md CHANGED
@@ -1,7 +1,9 @@
1
1
  [![CircleCI](https://circleci.com/gh/isubas/ileti_merkezi.svg?style=svg)](https://circleci.com/gh/isubas/ileti_merkezi)
2
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)
3
+ [![Codacy Badge](https://api.codacy.com/project/badge/Coverage/cecce51ce4d94f3ca1dcc1e99bdcbce6)](https://www.codacy.com/app/isubas/ileti_merkezi?utm_source=github.com&utm_medium=referral&utm_content=isubas/ileti_merkezi&utm_campaign=Badge_Coverage)
4
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
+ [![Build Status](https://travis-ci.org/isubas/ileti_merkezi.svg?branch=master)](https://travis-ci.org/isubas/ileti_merkezi)
6
+ [![Known Vulnerabilities](https://snyk.io/test/github/isubas/ileti_merkezi/badge.svg?targetFile=Gemfile.lock)](https://snyk.io/test/github/isubas/ileti_merkezi?targetFile=Gemfile.lock)
5
7
 
6
8
  # IletiMerkezi
7
9
  iletimerkezi.com API'lerini kullanarak toplu sms gönderme ve raporlama
@@ -9,17 +11,17 @@ işlemlerini yapabilmek için hazırlanan Ruby istemcisidir.
9
11
 
10
12
  ## Kurulum
11
13
 
12
- Add this line to your application's Gemfile:
14
+ Bu satırı Gemfile dosyasına ekleyin.
13
15
 
14
16
  ```ruby
15
17
  gem 'ileti_merkezi'
16
18
  ```
17
19
 
18
- And then execute:
20
+ Ardından aşağıdaki komutu çalıştırın:
19
21
 
20
22
  $ bundle
21
23
 
22
- Or install it yourself as:
24
+ Veya kendiniz aşağıdaki komut ile sisteme kurabilirsiniz:
23
25
 
24
26
  $ gem install ileti_merkezi
25
27
 
@@ -27,11 +29,11 @@ Or install it yourself as:
27
29
 
28
30
  ### Yapılandırma
29
31
 
30
- Rails uygulamanızda `config/initializers/ileti_merkezi_configure.rb` dosyası oluştururak
32
+ Rails uygulamanızda `config/initializers/ileti_merkezi_configure.rb` dosyası oluştururak
31
33
  aşağıdaki kodları içerisine yapıştırınız.
32
34
 
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
+ Eğer kimlik doğrulama işlemini kullanıcı adı ve parola üzerinden yapmak istiyorsanız username ve password bilgilerini,
36
+ token tabanlı yapmak istiyorsanız public_key ve secret_key bilgilerini doldurmanız gerekmektedir.
35
37
 
36
38
  Bu dört alanda doldurulmuş ise sistem token tabanlı doğrulama yapacaktır.
37
39
 
@@ -48,7 +50,7 @@ IletiMerkezi.configure do |config|
48
50
  verify_mode: OpenSSL::SSL::VERIFY_PEER,
49
51
  read_timeout: 30, # default 30
50
52
  open_timeout: 30 # default 30
51
- }
53
+ }
52
54
  # Kimlik Doğrulama: username ve password
53
55
  config.username = 'username'
54
56
  config.password = 'password'
@@ -58,7 +60,7 @@ IletiMerkezi.configure do |config|
58
60
  end
59
61
  ```
60
62
 
61
- Veya
63
+ Veya
62
64
 
63
65
  - Ortam değişkeleri ile yapılandırabilirsiniz. bknz: .env
64
66
 
@@ -81,15 +83,15 @@ IM_SENDER = 'SENDER'
81
83
  ```ruby
82
84
 
83
85
  args = {
84
- send_datetime: '15/01/2017 12:00' # Opsiyonel
85
- sender: 'TEST' # Opsiyonel
86
- phones: ['0555 555 00 01', '0555 555 00 02']
86
+ send_datetime: '15/01/2017 12:00', # Opsiyonel
87
+ sender: 'TEST', # Opsiyonel
88
+ phones: ['0555 555 00 01', '0555 555 00 02'],
87
89
  text: 'Test Mesajı'
88
90
  }
89
91
 
90
92
  # return IletiMerkezi::Response
91
93
  response = IletiMerkezi.send(args)
92
- # veya
94
+ # veya
93
95
  sms = IletiMerkezi::Sms.new(args)
94
96
  response = sms.send
95
97
 
@@ -99,7 +101,7 @@ IM_SENDER = 'SENDER'
99
101
  response.error? # return true or false
100
102
  response.to_h
101
103
  # return hash
102
- {
104
+ {
103
105
  :status => {
104
106
  :code => "200",
105
107
  :message => "İşlem başarılı"
@@ -110,12 +112,12 @@ IM_SENDER = 'SENDER'
110
112
  }
111
113
  ```
112
114
 
113
- #### Çoklu Mesaj - Çoklu Alıcı
115
+ #### Çoklu Mesaj - Çoklu Alıcı
114
116
 
115
117
  ```ruby
116
118
  args = {
117
- send_datetime: '15/01/2017 12:00' # Opsiyonel
118
- sender: 'TEST' # Opsiyonel
119
+ send_datetime: '15/01/2017 12:00', # Opsiyonel
120
+ sender: 'TEST', # Opsiyonel
119
121
  messages: [
120
122
  {
121
123
  text: 'Test Mesajı Bir',
@@ -140,7 +142,7 @@ IM_SENDER = 'SENDER'
140
142
  response.error? # return true or false
141
143
  response.to_h
142
144
  # return hash
143
- {
145
+ {
144
146
  :status => {
145
147
  :code => "200",
146
148
  :message => "İşlem başarılı"
@@ -158,7 +160,7 @@ IM_SENDER = 'SENDER'
158
160
  ```ruby
159
161
  # return IletiMerkezi::Response
160
162
  response = IletiMerkezi.cancel(order_id)
161
- # or
163
+ # veya
162
164
  cancel = IletiMerkezi::Cancel.new(order_id)
163
165
  response = cancel.confirm
164
166
 
@@ -166,7 +168,7 @@ IM_SENDER = 'SENDER'
166
168
  response.body # http raw body
167
169
  response.message # return status message
168
170
  response.error? # return true or false
169
- response.to_h
171
+ response.to_h
170
172
  # return hash
171
173
  {
172
174
  :status => {
@@ -189,12 +191,12 @@ IM_SENDER = 'SENDER'
189
191
  response.error? # return true or false
190
192
  response.to_h
191
193
  # return
192
- {
194
+ {
193
195
  :status => {
194
196
  :code => "200",
195
197
  :message => "İşlem başarılı"
196
198
  },
197
- :balance => {
199
+ :balance => {
198
200
  :amount => "1",
199
201
  :sms => "238760"
200
202
  }
@@ -204,8 +206,8 @@ IM_SENDER = 'SENDER'
204
206
  ### SMS Sipariş Raporlama
205
207
 
206
208
  #### Ek Bilgi:
207
-
208
- - **page**: zorunlu değildir. Bir siparişteki alıcı sayısı row_count(1000)'den fazla
209
+
210
+ - **page**: zorunlu değildir. Bir siparişteki alıcı sayısı row_count(1000)'den fazla
209
211
  ise page parametresi kullanılarak diğer rapor sayfaları için istek yapılabilir.
210
212
  - **row_count**: Bir sayfada göntülenecek rapor sayısı
211
213
 
@@ -255,7 +257,7 @@ IM_SENDER = 'SENDER'
255
257
 
256
258
  ### Hesap Bilgileri
257
259
 
258
- **Not:** Kullanıcı adı ve paralo bilgilerinin yapılandırmada doldurulmuş olması gerekmektedir.
260
+ **Not:** Kullanıcı adı ve paralo bilgilerinin yapılandırmada doldurulmuş olması gerekmektedir.
259
261
 
260
262
  ```ruby
261
263
  IletiMerkezi.info
@@ -263,17 +265,17 @@ IM_SENDER = 'SENDER'
263
265
 
264
266
  ### Hesabınıza Tanımlı Başlık Bilgileri
265
267
 
266
- **Not:** Kullanıcı adı ve paralo bilgilerinin yapılandırmada doldurulmuş olması gerekmektedir.
268
+ **Not:** Kullanıcı adı ve paralo bilgilerinin yapılandırmada doldurulmuş olması gerekmektedir.
267
269
 
268
- ```
270
+ ```ruby
269
271
  IletiMerkezi.senders
270
272
  ```
271
273
 
272
274
  ## Contributing
273
275
 
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
276
+ Bug reports and pull requests are welcome on GitHub at https://github.com/isubas/ileti_merkezi.
277
+ This project is intended to be a safe, welcoming space for collaboration,
278
+ and contributors are expected to adhere to the
277
279
  [Contributor Covenant](http://contributor-covenant.org) code of conduct.
278
280
 
279
281
  ## License
@@ -282,6 +284,6 @@ The gem is available as open source under the terms of the [MIT License](https:/
282
284
 
283
285
  ## Code of Conduct
284
286
 
285
- Everyone interacting in the IletiMerkezi project’s codebases, issue trackers,
286
- chat rooms and mailing lists is expected to follow the
287
+ Everyone interacting in the IletiMerkezi project’s codebases, issue trackers,
288
+ chat rooms and mailing lists is expected to follow the
287
289
  [code of conduct](https://github.com/isubas/ileti_merkezi/blob/master/CODE_OF_CONDUCT.md).
data/lib/ileti_merkezi.rb CHANGED
@@ -6,16 +6,10 @@ require 'ox'
6
6
  files = %w[
7
7
  version
8
8
  error
9
- configuration
10
- account
11
- authentication
12
- balance
13
- cancel
9
+ utils
10
+ actions
14
11
  message
15
- request
16
- report
17
12
  response
18
- sms
19
13
  status
20
14
  ]
21
15
 
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ %w[
4
+ account
5
+ balance
6
+ cancel
7
+ report
8
+ sms
9
+ ].each { |file| require_relative "./actions/#{file}" }
@@ -0,0 +1,44 @@
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
+ include XmlBuilder
12
+
13
+ def info
14
+ request(
15
+ '&obj1=getUserInfo',
16
+ hash_to_xml(userInfo: user_info)
17
+ )
18
+ end
19
+
20
+ def senders
21
+ request(
22
+ '&obj1=getSmsHeader',
23
+ hash_to_xml(smsApi: { userInfo: user_info.merge(smsType: 2) })
24
+ )
25
+ end
26
+
27
+ private
28
+
29
+ def user_info
30
+ config = IletiMerkezi.configuration
31
+ {
32
+ userName: config.username,
33
+ userPassword: config.password
34
+ }
35
+ end
36
+
37
+ def request(query, body)
38
+ request = Request.new(body: body)
39
+ request.uri = URI.parse(PATH + query)
40
+ request.call
41
+ end
42
+ end
43
+ end
44
+ end
@@ -3,6 +3,8 @@
3
3
  module IletiMerkezi
4
4
  # Cancel
5
5
  class Cancel
6
+ include XmlBuilder
7
+
6
8
  PATH = '/cancel-order'.freeze
7
9
 
8
10
  attr_reader :order_id
@@ -12,14 +14,11 @@ module IletiMerkezi
12
14
  end
13
15
 
14
16
  def confirm
15
- request = Request.new(content: content, path: PATH)
17
+ request = Request.new(
18
+ path: PATH,
19
+ payload: hash_to_xml(id: order_id)
20
+ )
16
21
  request.call
17
22
  end
18
-
19
- private
20
-
21
- def content
22
- "<id>#{order_id}</id>"
23
- end
24
23
  end
25
24
  end
@@ -3,6 +3,7 @@
3
3
  module IletiMerkezi
4
4
  # Report
5
5
  class Report
6
+ include XmlBuilder
6
7
  PATH = '/get-report'.freeze
7
8
 
8
9
  attr_reader :order_id, :page, :row_count
@@ -14,18 +15,15 @@ module IletiMerkezi
14
15
  end
15
16
 
16
17
  def query
17
- request = Request.new(content: content, path: PATH)
18
+ request = Request.new(
19
+ path: PATH,
20
+ payload: hash_to_xml(
21
+ id: order_id,
22
+ page: page,
23
+ row_count: row_count
24
+ )
25
+ )
18
26
  request.call
19
27
  end
20
-
21
- private
22
-
23
- def content
24
- <<-XML.gsub(/^[ ]+/, '').strip
25
- <id>#{order_id}</id>
26
- <page>#{page}</page>
27
- <rowCount>#{row_count}</rowCount>
28
- XML
29
- end
30
28
  end
31
29
  end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module IletiMerkezi
4
+ # Sms
5
+ class Sms
6
+ include XmlBuilder
7
+
8
+ attr_reader :messages, :sender, :send_datetime
9
+
10
+ PATH = '/send-sms'.freeze
11
+
12
+ def initialize(params = {})
13
+ @messages = build_messages(params)
14
+ @send_datetime = params.fetch(:send_datetime, Time.now.strftime('%d/%m/%Y %H:%M'))
15
+ @sender = params.fetch(:sender, IletiMerkezi.configuration.sender)
16
+ end
17
+
18
+ def send
19
+ request = Request.new(
20
+ path: PATH,
21
+ payload: hash_to_xml(
22
+ sender: sender,
23
+ sendDateTime: send_datetime,
24
+ message: messages.map(&:to_h)
25
+ )
26
+ )
27
+ request.call
28
+ end
29
+
30
+ private
31
+
32
+ def build_messages(params)
33
+ messages = params.fetch(
34
+ :messages,
35
+ [
36
+ phones: params.fetch(:phones, []),
37
+ text: params.fetch(:text, '')
38
+ ]
39
+ )
40
+ messages.map { |message| Message.new(*message.values_at(:phones, :text)) }
41
+ end
42
+ end
43
+ end
@@ -6,43 +6,23 @@ module IletiMerkezi
6
6
  attr_reader :phones, :text
7
7
 
8
8
  def initialize(phones, text)
9
- @phones = phones.is_a?(Array) ? phones : [phones]
9
+ @phones = [*phones]
10
10
  @text = text.to_s
11
11
  end
12
12
 
13
- def content
14
- raise InvalidMessageError, to_s unless valid?
15
- <<-XML.gsub(/^[ ]+/, '').strip
16
- <message>
17
- <text>#{text}</text>
18
- <receipents>
19
- #{phones.compact.map { |phone| phone_xmlify(phone) }.join("\n")}
20
- </receipents>
21
- </message>
22
- XML
23
- end
13
+ def to_hash
14
+ raise InvalidMessageError, inspect unless valid?
24
15
 
25
- def summary
26
16
  {
27
17
  text: text,
28
- phones: phones,
29
- receipents_count: phones.count,
30
- valid: valid?
18
+ receipents: { number: phones }
31
19
  }
32
20
  end
33
21
 
34
- def to_s
35
- "Text: #{text}, Phones: #{phones}"
36
- end
22
+ alias to_h to_hash
37
23
 
38
24
  def valid?
39
25
  phones.any? && !text.empty?
40
26
  end
41
-
42
- private
43
-
44
- def phone_xmlify(phone)
45
- "<number>#{phone.to_s.tr(' ', '')}</number>" unless phone.to_s.empty?
46
- end
47
27
  end
48
28
  end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ %w[
4
+ xml_builder
5
+ authentication
6
+ configuration
7
+ request
8
+ ].each { |file| require_relative "./utils/#{file}" }
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module IletiMerkezi
4
+ # Authentication
5
+ module Authentication
6
+ include XmlBuilder
7
+
8
+ module_function
9
+
10
+ def to_hash
11
+ send(IletiMerkezi.configuration.auth_method)
12
+ end
13
+
14
+ def auth_basic
15
+ config = IletiMerkezi.configuration
16
+ {
17
+ username: config.username,
18
+ password: config.password
19
+ }
20
+ end
21
+
22
+ def auth_token
23
+ config = IletiMerkezi.configuration
24
+ {
25
+ key: config.public_key,
26
+ hash: config.hmac
27
+ }
28
+ end
29
+ end
30
+ end
@@ -16,7 +16,7 @@ module IletiMerkezi
16
16
  :request_overrides
17
17
 
18
18
  ENDPOINT = 'http://api.iletimerkezi.com/v1'.freeze
19
- SENDER = 'ILETI MRKZI'.freeze
19
+ SENDER = 'APITEST'.freeze
20
20
 
21
21
  def initialize
22
22
  @endpoint = ENV['IM_ENDPOINT'] || ENDPOINT
@@ -4,6 +4,8 @@ module IletiMerkezi
4
4
  # Request
5
5
  # :reek:TooManyInstanceVariables { max_instance_variables: 6 }
6
6
  class Request
7
+ include XmlBuilder
8
+
7
9
  DEFAULT_OPTIONS = {
8
10
  use_ssl: false,
9
11
  verify_mode: OpenSSL::SSL::VERIFY_PEER,
@@ -22,9 +24,9 @@ module IletiMerkezi
22
24
  # :reek:Attribute
23
25
  attr_writer :uri
24
26
 
25
- def initialize(body: nil, content: '', path: '')
27
+ def initialize(body: nil, payload: '', path: '')
26
28
  @config = IletiMerkezi.configuration
27
- @content = content
29
+ @payload = payload
28
30
  @path = path
29
31
  @body = body
30
32
  @uri = URI.parse(@config.endpoint + @path)
@@ -38,24 +40,15 @@ module IletiMerkezi
38
40
 
39
41
  private
40
42
 
41
- attr_reader :config, :uri, :content
42
-
43
- def create_order
44
- <<-XML.gsub(/^[ ]+/, '').strip
45
- <order>
46
- #{content}
47
- </order>
48
- XML
49
- end
43
+ attr_reader :config, :uri, :payload
50
44
 
51
45
  def body
52
- <<-XML.gsub(/^[ ]+/, '').strip
53
- <?xml version="1.0" encoding="UTF-8" ?>
54
- <request>
55
- #{Authentication.content}
56
- #{create_order}
57
- </request>
58
- XML
46
+ hash_to_xml(
47
+ request: {
48
+ authentication: Authentication.to_hash,
49
+ order: payload
50
+ }
51
+ )
59
52
  end
60
53
 
61
54
  def http
@@ -0,0 +1,31 @@
1
+ module IletiMerkezi
2
+ # XmlBuilder
3
+ module XmlBuilder
4
+ XML_TAG = '<%<tag>s>%<content>s</%<tag>s>'.freeze
5
+
6
+ def hash_to_xml(hash)
7
+ hash.each_with_object([]) do |(key, value), tags|
8
+ tags << case value
9
+ when Hash then create_xml_tag(key, hash_to_xml(value))
10
+ when Array then array_to_xml(key, value)
11
+ else
12
+ create_xml_tag(key, value)
13
+ end
14
+ end.flatten.join
15
+ end
16
+
17
+ private
18
+
19
+ def array_to_xml(tag, collection)
20
+ collection.map do |item|
21
+ create_xml_tag(
22
+ tag, (item.is_a?(Hash) ? hash_to_xml(item) : item)
23
+ )
24
+ end
25
+ end
26
+
27
+ def create_xml_tag(tag, content)
28
+ format(XML_TAG, tag: tag, content: content)
29
+ end
30
+ end
31
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IletiMerkezi
4
- VERSION = '0.1.0'.freeze
4
+ VERSION = '1.0.1'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ileti_merkezi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
- - İrfan SUBAŞ
7
+ - isubas
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-06 00:00:00.000000000 Z
11
+ date: 2019-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,84 +30,68 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '5.0'
33
+ version: '5.8'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '5.0'
40
+ version: '5.8'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
47
+ version: '12.3'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '10.0'
54
+ version: '12.3'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: ox
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '2.8'
62
- - - ">="
63
- - !ruby/object:Gem::Version
64
- version: 2.8.2
61
+ version: '2.10'
65
62
  type: :runtime
66
63
  prerelease: false
67
64
  version_requirements: !ruby/object:Gem::Requirement
68
65
  requirements:
69
66
  - - "~>"
70
67
  - !ruby/object:Gem::Version
71
- version: '2.8'
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- version: 2.8.2
75
- description: "\n api.iletimerkezi.com uzerinden toplu sms gonderme,\n raporlama
76
- gibi islemleri yapabilmek icin hazırlanmistir.\n "
68
+ version: '2.10'
69
+ description: "\n api.iletimerkezi.com via bulk sms sending, reporting has been
70
+ prepared to do operations such as.\n "
77
71
  email:
78
72
  - irfan.isubas@gmail.com
79
73
  executables: []
80
74
  extensions: []
81
75
  extra_rdoc_files: []
82
76
  files:
83
- - ".circleci/config.yml"
84
- - ".env"
85
- - ".envrc"
86
- - ".gitignore"
87
- - ".reek"
88
- - ".rubocop.yml"
89
- - CODE_OF_CONDUCT.md
90
- - Gemfile
91
- - Gemfile.lock
92
77
  - LICENSE.txt
93
78
  - README.md
94
- - Rakefile
95
- - bin/console
96
- - bin/setup
97
- - ileti_merkezi.gemspec
98
79
  - lib/ileti_merkezi.rb
99
- - lib/ileti_merkezi/account.rb
100
- - lib/ileti_merkezi/authentication.rb
101
- - lib/ileti_merkezi/balance.rb
102
- - lib/ileti_merkezi/cancel.rb
103
- - lib/ileti_merkezi/configuration.rb
80
+ - lib/ileti_merkezi/actions.rb
81
+ - lib/ileti_merkezi/actions/account.rb
82
+ - lib/ileti_merkezi/actions/balance.rb
83
+ - lib/ileti_merkezi/actions/cancel.rb
84
+ - lib/ileti_merkezi/actions/report.rb
85
+ - lib/ileti_merkezi/actions/sms.rb
104
86
  - lib/ileti_merkezi/error.rb
105
87
  - lib/ileti_merkezi/message.rb
106
- - lib/ileti_merkezi/report.rb
107
- - lib/ileti_merkezi/request.rb
108
88
  - lib/ileti_merkezi/response.rb
109
- - lib/ileti_merkezi/sms.rb
110
89
  - lib/ileti_merkezi/status.rb
90
+ - lib/ileti_merkezi/utils.rb
91
+ - lib/ileti_merkezi/utils/authentication.rb
92
+ - lib/ileti_merkezi/utils/configuration.rb
93
+ - lib/ileti_merkezi/utils/request.rb
94
+ - lib/ileti_merkezi/utils/xml_builder.rb
111
95
  - lib/ileti_merkezi/version.rb
112
96
  homepage: https://github.com/isubas/ileti_merkezi
113
97
  licenses:
@@ -128,9 +112,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
112
  - !ruby/object:Gem::Version
129
113
  version: '0'
130
114
  requirements: []
131
- rubyforge_project:
132
- rubygems_version: 2.5.2.1
115
+ rubygems_version: 3.0.2
133
116
  signing_key:
134
117
  specification_version: 4
135
- summary: api.iletimerkezi.com API Ruby SMS GEM"
118
+ summary: Client for api.iletimerkezi.com
136
119
  test_files: []
data/.circleci/config.yml DELETED
@@ -1,33 +0,0 @@
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 DELETED
@@ -1,4 +0,0 @@
1
- IM_USERNAME='username'
2
- IM_PASSWORD='password'
3
- IM_SENDER='ILETI MRKZI'
4
- TEST_PHONE='06664443322'
data/.envrc DELETED
@@ -1,2 +0,0 @@
1
- export PATH="$PWD"/bin:"$PATH"
2
- export RUBYLIB="$PWD"/lib
data/.gitignore DELETED
@@ -1,8 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
data/.reek DELETED
@@ -1,17 +0,0 @@
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 DELETED
@@ -1,13 +0,0 @@
1
- AllCops:
2
- Exclude:
3
- - 'iletimerkezisms.gemspec'
4
- - 'test/**/**'
5
-
6
- Style/Documentation:
7
- Exclude:
8
- - 'spec/**/*'
9
- - 'test/**/*'
10
- - 'lib/iletimerkezisms.rb'
11
-
12
- Metrics/LineLength:
13
- Max: 85
data/CODE_OF_CONDUCT.md DELETED
@@ -1,74 +0,0 @@
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 DELETED
@@ -1,18 +0,0 @@
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 DELETED
@@ -1,73 +0,0 @@
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/Rakefile DELETED
@@ -1,10 +0,0 @@
1
- require 'bundler/gem_tasks'
2
- require 'rake/testtask'
3
-
4
- Rake::TestTask.new(:test) do |t|
5
- t.libs << 'test'
6
- t.libs << 'lib'
7
- t.test_files = FileList['test/**/*_test.rb']
8
- end
9
-
10
- task default: :test
data/bin/console DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'bundler/setup'
4
- require 'ileti_merkezi'
5
- require 'dotenv/load'
6
-
7
- require 'pry'
8
- Pry.start
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -1,32 +0,0 @@
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
@@ -1,49 +0,0 @@
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
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module IletiMerkezi
4
- # Authentication
5
- module Authentication
6
- module_function
7
-
8
- def content
9
- send(IletiMerkezi.configuration.auth_method)
10
- end
11
-
12
- def auth_basic
13
- config = IletiMerkezi.configuration
14
- <<-XML.gsub(/^[ ]+/, '').strip
15
- <authentication>
16
- <username>#{config.username}</username>
17
- <password>#{config.password}</password>
18
- </authentication>
19
- XML
20
- end
21
-
22
- def auth_token
23
- config = IletiMerkezi.configuration
24
- <<-XML.gsub(/^[ ]+/, '').strip
25
- <authentication>
26
- <key>#{config.public_key}</key>
27
- <hash>#{config.hmac}</hash>
28
- </authentication>
29
- XML
30
- end
31
- end
32
- end
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module IletiMerkezi
4
- # Sms
5
- class Sms
6
- attr_reader :args, :sender
7
-
8
- PATH = '/send-sms'.freeze
9
-
10
- def initialize(args)
11
- @args = args
12
- @sender = args[:sender] || IletiMerkezi.configuration.sender
13
- end
14
-
15
- def messages
16
- messages = args.fetch(:messages, [args])
17
- messages.map { |msg| Message.new(msg[:phones], msg[:text]) }
18
- end
19
-
20
- def send_datetime
21
- args.fetch(:send_datetime, Time.now.strftime('%d/%m/%Y %H:%M'))
22
- end
23
-
24
- def send
25
- request = Request.new(content: content, path: PATH)
26
- request.call
27
- end
28
-
29
- private
30
-
31
- def content
32
- <<-XML.gsub(/^[ ]+/, '').strip
33
- <sender>#{sender}</sender>
34
- <sendDateTime>#{send_datetime}</sendDateTime>
35
- #{messages.map(&:content).join}
36
- XML
37
- end
38
- end
39
- end