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 +4 -4
- data/README.md +257 -14
- data/globalsms.gemspec +5 -1
- data/lib/globalsms/defaults.rb +0 -1
- data/lib/globalsms/report.rb +1 -1
- data/lib/globalsms/sms.rb +1 -1
- data/lib/globalsms/version.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59546feba07774eae1bb373e792e6e1980e72e15
|
4
|
+
data.tar.gz: 3a590d99e1fcec0f4ef5706b373ad93c81006402
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
13
|
+
Sonra kurulmasını sağlayın:
|
14
14
|
|
15
15
|
$ bundle
|
16
16
|
|
17
|
-
|
17
|
+
Ya da kendiniz kurun:
|
18
18
|
|
19
19
|
$ gem install globalsms
|
20
20
|
|
21
|
-
## Kullanım
|
21
|
+
## Örnek Kullanım
|
22
22
|
|
23
|
-
|
23
|
+
### SMS Gönderme
|
24
24
|
|
25
|
-
|
25
|
+
Mesaj göndermek için tanımlanmış fonksiyonlara argüman olarak **hash** verilir. Fonksiyon geriye **hash** döner.
|
26
26
|
|
27
|
-
|
27
|
+
Ön tanımlı değerler:
|
28
28
|
|
29
|
-
|
29
|
+
turkish_character: "1"
|
30
|
+
time: "now"
|
30
31
|
|
31
|
-
|
32
|
+
Kullanıcının gireceği değerler:
|
32
33
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
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 =
|
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"
|
data/lib/globalsms/defaults.rb
CHANGED
data/lib/globalsms/report.rb
CHANGED
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
|
data/lib/globalsms/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
module
|
2
|
-
VERSION = "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.
|
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
|
- - ">="
|