globalsms 0.1.0 → 0.2.0

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
2
  SHA1:
3
- metadata.gz: 965ee0c1a76fd349875697884d2c23bd95b7ce00
4
- data.tar.gz: 8ffef3c34aa4e95274a7e6975e2a055239cc9eca
3
+ metadata.gz: 59546feba07774eae1bb373e792e6e1980e72e15
4
+ data.tar.gz: 3a590d99e1fcec0f4ef5706b373ad93c81006402
5
5
  SHA512:
6
- metadata.gz: 2357e8c07e6a9add79fc8f6f9b98070e75d36332b4b7b321a655fd02a27da6ebab999a9460f85bf2a59b4c17cc6c4b862ca720ac638541f785c8dfd3a8d1db90
7
- data.tar.gz: 272cc9da5851379cba6cc50cbf024480827260d30fc4b2d771dad5a36ac3d7857399e0879fe09cbec1d68f2caf1720a875500a6ac38d5ecda00d1394ee05131c
6
+ metadata.gz: 8560016b8b7a9b68bcdd635ecfc7077df752d0bfba71ee42612c41105052999fbeaeb196a01340cb707a8b0bdda099e3eda3833ec5798563686c124960a75b4e
7
+ data.tar.gz: 7b4a613abf94586ba4eb145b01f53a33d46b487ab4800792dfa950dae0a6590b6da76d6eb31c426f2160de5dcbd8b7f5ef7cb483821d3e87ecd23d501bd5d534
data/README.md CHANGED
@@ -4,34 +4,277 @@ Ruby geliştiricileri için GlobalHaberlesme.com API lerini kullanan Ruby Gem'id
4
4
 
5
5
  ## Kurulum
6
6
 
7
- Add this line to your application's Gemfile:
7
+ Uygulama içerisinde kullanmak için aşağıdaki satırı Gemfile'a ekleyin:
8
8
 
9
9
  ```ruby
10
10
  gem 'globalsms'
11
11
  ```
12
12
 
13
- And then execute:
13
+ Sonra kurulmasını sağlayın:
14
14
 
15
15
  $ bundle
16
16
 
17
- Or install it yourself as:
17
+ Ya da kendiniz kurun:
18
18
 
19
19
  $ gem install globalsms
20
20
 
21
- ## Kullanım
21
+ ## Örnek Kullanım
22
22
 
23
- TODO
23
+ ### SMS Gönderme
24
24
 
25
- ## Development
25
+ Mesaj göndermek için tanımlanmış fonksiyonlara argüman olarak **hash** verilir. Fonksiyon geriye **hash** döner.
26
26
 
27
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
27
+ Ön tanımlı değerler:
28
28
 
29
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
29
+ turkish_character: "1"
30
+ time: "now"
30
31
 
31
- ## Contributing
32
+ Kullanıcının gireceği değerler:
32
33
 
33
- 1. Fork it ( https://github.com/salihozd/globalsms/fork )
34
- 2. Create your feature branch (`git checkout -b my-new-feature`)
35
- 3. Commit your changes (`git commit -am 'Add some feature'`)
36
- 4. Push to the branch (`git push origin my-new-feature`)
37
- 5. Create a new Pull Request
34
+ originator: "DENEME"
35
+ numbers: "5493666154"
36
+ text: "Mesaj Metni"
37
+
38
+ #### Tek mesaj gönderen örnek kod:
39
+
40
+ ```ruby
41
+ require 'globalsms'
42
+
43
+ sms = GlobalSMS::SMS.new('api-key', 'api-secret')
44
+
45
+ argv = {
46
+ originator: "DENEME",
47
+ numbers: "5493666154",
48
+ text: "Mesaj Metni",
49
+ turkish_character: "1"
50
+ }
51
+
52
+ sms.single_send(argv)
53
+
54
+ # {
55
+ # "result" => true, "message_id" => "239916", "numbers" => ["5493666154"], "total_numbers_count" => 1, "turkcell_numbers_count" => 0, "vodafone_numbers_count" => 1, "avea_numbers_count" => 0, "total_credit" => 1, "0" => ""
56
+ # }
57
+ ```
58
+
59
+ #### Aynı mesajı birden fazla numaraya gönderen örnek kod:
60
+
61
+ NOT: Bu yöntem ile mesaj gönderilirken birden fazla numaraya gönderilen aynı mesajlar, tek bir `message_id` üretir.
62
+
63
+ ```ruby
64
+ require 'globalsms'
65
+
66
+ sms = GlobalSMS::SMS.new('api-key', 'api-secret')
67
+
68
+ argv = {
69
+ originator: "DENEME",
70
+ numbers: ["5493666154", "5493666155", "5493666156", "5493666157"],
71
+ text: "Mesaj Metni",
72
+ turkish_character: "1"
73
+ }
74
+
75
+ sms.bulk_send(argv)
76
+
77
+ # {
78
+ # "result" => true, "message_id" => "239922", "numbers" => ["5493666154", "5493666155", "5493666156", "5493666157"
79
+ # "..."
80
+ # ], "total_numbers_count" => 4, "turkcell_numbers_count" => 0, "vodafone_numbers_count" => 4, "avea_numbers_count" => 0, "total_credit" => 4, "0" => ""
81
+ # }
82
+ ```
83
+
84
+ #### Tek bir çağrıda birden fazla numaraya farklı mesajlar gönderen örnek kod:
85
+
86
+ ```ruby
87
+ require 'globalsms'
88
+
89
+ sms = GlobalSMS::SMS.new('api-key', 'api-secret')
90
+
91
+ argv = [
92
+ { originator: "DENEME",
93
+ numbers: "5493666154",
94
+ text: "Mesaj Metni",
95
+ turkish_character: "1"
96
+ },
97
+
98
+ { originator: "DENEME",
99
+ numbers: "5493666155",
100
+ text: "Bir Başka Mesaj Metni",
101
+ turkish_character: "1"
102
+ },
103
+
104
+ { originator: "DENEME",
105
+ numbers: "5493666156",
106
+ text: "Ve Bir Başka Mesaj Metni",
107
+ turkish_character: "1"
108
+ },
109
+
110
+ { originator: "DENEME",
111
+ numbers: "5493666157",
112
+ text: "Ve De Bir Başka Mesaj Metni",
113
+ turkish_character: "1"
114
+ }
115
+ ]
116
+
117
+ sms.multi_send(argv)
118
+
119
+ # {
120
+ # "result" => true, "results" => [{
121
+ # "result" => true, "message_id" => "239928", "numbers" => ["5493666154"], "total_numbers_count" => 1, "turkcell_numbers_count" => 0, "vodafone_numbers_count" => 1, "avea_numbers_count" => 0, "total_credit" => 1, "0" => ""
122
+ # }, {
123
+ # "result" => true, "message_id" => "239929", "numbers" => ["5493666155"], "total_numbers_count" => 1, "turkcell_numbers_count" => 0, "vodafone_numbers_count" => 1, "avea_numbers_count" => 0, "total_credit" => 1, "0" => ""
124
+ # }, {
125
+ # "result" => true, "message_id" => "239930", "numbers" => ["5493666156"], "total_numbers_count" => 1, "turkcell_numbers_count" => 0, "vodafone_numbers_count" => 1, "avea_numbers_count" => 0, "total_credit" => 1, "0" => ""
126
+ # }, {
127
+ # "result" => true, "message_id" => "239931", "numbers" => ["5493666157"], "total_numbers_count" => 1, "turkcell_numbers_count" => 0, "vodafone_numbers_count" => 1, "avea_numbers_count" => 0, "total_credit" => 1, "0" => ""
128
+ # }]
129
+ # }
130
+ ```
131
+
132
+ ### Rapor Alma
133
+
134
+ Gönderilmiş mesajlara ait raporları almak için fonksiyonlara argüman olarak tek bir çağrı için `message_id`, birden fazla çağrı için `message_id` leri içeren bir array verilir. Fonksiyon geriye **hash** döndürür.
135
+
136
+ #### Tek mesaja ait raporları döndüren örnek kod:
137
+
138
+ ```ruby
139
+ require 'globalsms'
140
+
141
+ sms = GlobalSMS::REPORT.new('api-key', 'api-secret')
142
+
143
+ sms.single_report(239916)
144
+
145
+ # {
146
+ # "result" => true, "data" => [{
147
+ # "id" => "34163245", "created_datetime" => "2015-05-05 14:54:32", "gsm_no" => "5493666154", "gsm_operator" => "2", "sent_status" => "2", "sent_datetime" => "2015-05-05 14:54:37", "out_status" => "255", "out_datetime" => "2015-05-05 14:54:37", "report_message" => "COMMAND_ERROR", "name" => nil
148
+ # }], "totals" => {
149
+ # "total_number" => "1", "message_id" => "239916", "total_sent" => "1", "num_reached" => "0", "num_not_reached" => "0", "num_waiting_for_time" => "0", "paid_coin" => "1"
150
+ # }
151
+ # }
152
+ ```
153
+
154
+ #### Birden fazla mesaja ait raporları döndüren örnek kod:
155
+
156
+ ```ruby
157
+ require 'globalsms'
158
+
159
+ sms = GlobalSMS::REPORT.new('api-key', 'api-secret')
160
+
161
+ arr = ["239928", "239929", "239930", "239931"]
162
+
163
+ sms.bulk_report(arr)
164
+
165
+ # {
166
+ # "239928" => {
167
+ # "result" => true, "data" => [{
168
+ # "id" => "34163260", "created_datetime" => "2015-05-05 15:00:52", "gsm_no" => "5493666154", "gsm_operator" => "2", "sent_status" => "2", "sent_datetime" => "2015-05-05 15:00:53", "out_status" => "255", "out_datetime" => "2015-05-05 15:00:53", "report_message" => "COMMAND_ERROR", "name" => nil
169
+ # }], "totals" => {
170
+ # "total_number" => "1", "message_id" => "239928", "total_sent" => "1", "num_reached" => "0", "num_not_reached" => "0", "num_waiting_for_time" => "0", "paid_coin" => "1"
171
+ # }
172
+ # }, "239929" => {
173
+ # "result" => true, "data" => [{
174
+ # "id" => "34163261", "created_datetime" => "2015-05-05 15:00:52", "gsm_no" => "5493666155", "gsm_operator" => "2", "sent_status" => "2", "sent_datetime" => "2015-05-05 15:00:53", "out_status" => "255", "out_datetime" => "2015-05-05 15:00:53", "report_message" => "COMMAND_ERROR", "name" => nil
175
+ # }], "totals" => {
176
+ # "total_number" => "1", "message_id" => "239929", "total_sent" => "1", "num_reached" => "0", "num_not_reached" => "0", "num_waiting_for_time" => "0", "paid_coin" => "1"
177
+ # }
178
+ # }, "239930" => {
179
+ # "result" => true, "data" => [{
180
+ # "id" => "34163262", "created_datetime" => "2015-05-05 15:00:52", "gsm_no" => "5493666156", "gsm_operator" => "2", "sent_status" => "2", "sent_datetime" => "2015-05-05 15:00:53", "out_status" => "255", "out_datetime" => "2015-05-05 15:00:53", "report_message" => "COMMAND_ERROR", "name" => nil
181
+ # }], "totals" => {
182
+ # "total_number" => "1", "message_id" => "239930", "total_sent" => "1", "num_reached" => "0", "num_not_reached" => "0", "num_waiting_for_time" => "0", "paid_coin" => "1"
183
+ # }
184
+ # }, "239931" => {
185
+ # "result" => true, "data" => [{
186
+ # "id" => "34163263", "created_datetime" => "2015-05-05 15:00:52", "gsm_no" => "5493666157", "gsm_operator" => "2", "sent_status" => "2", "sent_datetime" => "2015-05-05 15:00:53", "out_status" => "255", "out_datetime" => "2015-05-05 15:00:53", "report_message" => "COMMAND_ERROR", "name" => nil
187
+ # }], "totals" => {
188
+ # "total_number" => "1", "message_id" => "239931", "total_sent" => "1", "num_reached" => "0", "num_not_reached" => "0", "num_waiting_for_time" => "0", "paid_coin" => "1"
189
+ # }
190
+ # }
191
+ # }
192
+ ```
193
+
194
+ #### Son x mesaja ait raporları döndüren örnek kod:
195
+
196
+ Argüman verilmezse, ön tanımlı olarak en son yollanan (1) mesaja ait raporu döndürür.
197
+
198
+ ```ruby
199
+ require 'globalsms'
200
+
201
+ sms = GlobalSMS::REPORT.new('api-key', 'api-secret')
202
+
203
+ sms.report_last(10)
204
+
205
+ # {
206
+ # "result" => true, "data" => [{
207
+ # "id" => "239931", "created_datetime" => "2015-05-05 15:00:52", "originator" => "DENEME", "originator_id" => "1616", "total_num" => "1", "pieces" => "1", "total_sent" => "1", "num_reached" => "0", "num_not_reached" => "0", "num_waiting_for_time" => "0", "text" => "Ve De Bir Başka Mesaj Metni", "time_to_send" => "2015-05-05 15:00:52"
208
+ # }, {
209
+ # "id" => "239930", "created_datetime" => "2015-05-05 15:00:52", "originator" => "DENEME", "originator_id" => "1616", "total_num" => "1", "pieces" => "1", "total_sent" => "1", "num_reached" => "0", "num_not_reached" => "0", "num_waiting_for_time" => "0", "text" => "Ve Bir Başka Mesaj Metni", "time_to_send" => "2015-05-05 15:00:52"
210
+ # }, {
211
+ # "id" => "239929", "created_datetime" => "2015-05-05 15:00:52", "originator" => "DENEME", "originator_id" => "1616", "total_num" => "1", "pieces" => "1", "total_sent" => "1", "num_reached" => "0", "num_not_reached" => "0", "num_waiting_for_time" => "0", "text" => "Bir Başka Mesaj Metni", "time_to_send" => "2015-05-05 15:00:52"
212
+ # }, {
213
+ # "id" => "239928", "created_datetime" => "2015-05-05 15:00:52", "originator" => "DENEME", "originator_id" => "1616", "total_num" => "1", "pieces" => "1", "total_sent" => "1", "num_reached" => "0", "num_not_reached" => "0", "num_waiting_for_time" => "0", "text" => "Mesaj Metni", "time_to_send" => "2015-05-05 15:00:52"
214
+ # }, {
215
+ # "id" => "239926", "created_datetime" => "2015-05-05 14:59:06", "originator" => "DENEME", "originator_id" => "1616", "total_num" => "1", "pieces" => "1", "total_sent" => "1", "num_reached" => "0", "num_not_reached" => "0", "num_waiting_for_time" => "0", "text" => "Ve De Bir Başka Mesaj Metni", "time_to_send" => "2015-05-05 14:59:06"
216
+ # }, {
217
+ # "id" => "239925", "created_datetime" => "2015-05-05 14:59:06", "originator" => "DENEME", "originator_id" => "1616", "total_num" => "1", "pieces" => "1", "total_sent" => "1", "num_reached" => "0", "num_not_reached" => "0", "num_waiting_for_time" => "0", "text" => "Ve Bir Başka Mesaj Metni", "time_to_send" => "2015-05-05 14:59:06"
218
+ # }, {
219
+ # "id" => "239924", "created_datetime" => "2015-05-05 14:59:06", "originator" => "DENEME", "originator_id" => "1616", "total_num" => "1", "pieces" => "1", "total_sent" => "1", "num_reached" => "0", "num_not_reached" => "0", "num_waiting_for_time" => "0", "text" => "Bir Başka Mesaj Metni", "time_to_send" => "2015-05-05 14:59:06"
220
+ # }, {
221
+ # "id" => "239923", "created_datetime" => "2015-05-05 14:59:06", "originator" => "DENEME", "originator_id" => "1616", "total_num" => "1", "pieces" => "1", "total_sent" => "1", "num_reached" => "0", "num_not_reached" => "0", "num_waiting_for_time" => "0", "text" => "Mesaj Metni", "time_to_send" => "2015-05-05 14:59:06"
222
+ # }, {
223
+ # "id" => "239922", "created_datetime" => "2015-05-05 14:57:10", "originator" => "DENEME", "originator_id" => "1616", "total_num" => "4", "pieces" => "1", "total_sent" => "4", "num_reached" => "0", "num_not_reached" => "0", "num_waiting_for_time" => "0", "text" => "Mesaj Metni", "time_to_send" => "2015-05-05 14:57:10"
224
+ # }, {
225
+ # "id" => "239916", "created_datetime" => "2015-05-05 14:54:32", "originator" => "DENEME", "originator_id" => "1616", "total_num" => "1", "pieces" => "1", "total_sent" => "1", "num_reached" => "0", "num_not_reached" => "0", "num_waiting_for_time" => "0", "text" => "Mesaj Metni", "time_to_send" => "2015-05-05 14:54:32"
226
+ # }], "totals" => {
227
+ # "total_message" => "33", "total_reached" => "21", "total_sms" => "42"
228
+ # }
229
+ # }
230
+ ```
231
+
232
+ #### Belirli tarihler arasında gönderilmiş mesajlara ait raporları döndüren örnek kod:
233
+
234
+ TODO: Geliştirme aşamasındadır.
235
+
236
+ #### Orinigator (gönderici adı) listeleyen örnek kod:
237
+
238
+ Bu fonksiyon argüman almaz.
239
+
240
+ ```ruby
241
+ require 'globalsms'
242
+
243
+ sms = GlobalSMS::REPORT.new('api-key', 'api-secret')
244
+
245
+ sms.originator_list
246
+
247
+ # {
248
+ # "result" => true, "data" => [{
249
+ # "originator_id" => "1616", "title" => "DENEME", "created_datetime" => "2015-04-27 20:25:39", "updated_datetime" => "2015-04-27 20:25:44", "approved_datetime" => "2015-04-27 20:25:44", "description" => "", "status" => "1"
250
+ # }]
251
+ # }
252
+ ```
253
+
254
+ #### Kullanıcı detaylarını ve kalan kredi bilgisini döndüren örnek kod:
255
+
256
+ ```ruby
257
+ require 'globalsms'
258
+
259
+ sms = GlobalSMS::REPORT.new('api-key', 'api-secret')
260
+
261
+ sms.user_info
262
+
263
+ # {
264
+ # "result" => true, "data" => {
265
+ # "firstname" => "Salih", "lastname" => "Özdemir", "username" => "salihozd", "email" => "me@salihozdemir.net", "image" => nil, "credit" => "8"
266
+ # }
267
+ # }
268
+ ```
269
+
270
+ ## Geliştirme
271
+
272
+ Bu Gem, GlobalHaberlesme.com dan bağımsız bir geliştirici tarafından oluşturulmuştur.
273
+
274
+ ## Katkıda Bulunma
275
+
276
+ Geliştirme öneri ve katkılarınızı bekliyorum.
277
+
278
+ ## Lisans
279
+
280
+ Bu Gem, MIT Lisansı ile korunur.
data/globalsms.gemspec CHANGED
@@ -5,7 +5,7 @@ require 'globalsms/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "globalsms"
8
- spec.version = Globalsms::VERSION
8
+ spec.version = GlobalSMS::VERSION
9
9
  spec.authors = ["Salih Özdemir"]
10
10
  spec.email = ["me@salihozdemir.net"]
11
11
 
@@ -14,6 +14,8 @@ Gem::Specification.new do |spec|
14
14
  spec.homepage = "https://github.com/salihozd/globalsms/"
15
15
  spec.license = "MIT"
16
16
 
17
+ spec.required_ruby_version = '~> 2.0'
18
+
17
19
  # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
18
20
  # delete this section to allow pushing this gem to any host.
19
21
  # if spec.respond_to?(:metadata)
@@ -27,6 +29,8 @@ Gem::Specification.new do |spec|
27
29
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
30
  spec.require_paths = ["lib"]
29
31
 
32
+
33
+
30
34
  spec.add_development_dependency "bundler", "~> 1.9"
31
35
  spec.add_development_dependency "rake", "~> 10.0"
32
36
  spec.add_runtime_dependency "httpclient"
@@ -1,3 +1,2 @@
1
1
  module GlobalSMS
2
- @api_base_url = "http://api.globalhaberlesme.com"
3
2
  end
@@ -39,7 +39,7 @@ module GlobalSMS
39
39
  c = HTTPClient.new
40
40
  return JSON.parse(c.get(uri).body)
41
41
  end
42
-
42
+
43
43
  def user_info
44
44
  uri = "#{@api_base_url}/user/info?key=#{@api_key}&secret=#{@api_secret}"
45
45
  c = HTTPClient.new
data/lib/globalsms/sms.rb CHANGED
@@ -5,7 +5,7 @@ require 'json'
5
5
  module GlobalSMS
6
6
  class SMS
7
7
  def initialize(api_key, api_secret)
8
- @api_base_url = "http://api.globalhaberlesme.com"
8
+ @api_base_url = "http://api.globalhaberlesme.com" #TODO: DEFAULTS a çıkart
9
9
  @api_key = api_key
10
10
  @api_secret = api_secret
11
11
  end
@@ -1,3 +1,3 @@
1
- module Globalsms
2
- VERSION = "0.1.0"
1
+ module GlobalSMS
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: globalsms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Salih Özdemir
@@ -98,9 +98,9 @@ require_paths:
98
98
  - lib
99
99
  required_ruby_version: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: '2.0'
104
104
  required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  requirements:
106
106
  - - ">="