globalsms 0.4.0 → 0.4.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
2
  SHA1:
3
- metadata.gz: 9e616d4e78940b24811200b28634529951b3fa3a
4
- data.tar.gz: 4e1bcf400397c449b2d72d3e03d8c78b5efdcba7
3
+ metadata.gz: 1b2ecb625334243a77a8ea3074f618b83d2509b6
4
+ data.tar.gz: b76cb62d5d21238c4739cbe91674e8906bf05b04
5
5
  SHA512:
6
- metadata.gz: 8a7615613b0398f9833d0e627b292a329ea5ed2683930348716d6a558e728dbf0f4a4d04ba78c06da9fc2efd05d83db8c7087fdfb0d6efdaff627a63fbee98e4
7
- data.tar.gz: 06aefe8d3a34363c2d348e498935abea02bacb43a60e2e576abcf97c1a718eb41577058d643bdf5d70c4f5ae9557225355d4d9e792642f3ffe1e2d2c2d2301de
6
+ metadata.gz: 6b54f250e92b912ef88e38fd086c91c86a51fead292fb9aad78fa2b08ed41d93243253e07758ba9110a823c2cdd8e6b7dd6d3074e40ee957ffc94b7b7448b24c
7
+ data.tar.gz: b1ff0e77fb81d486ac58ff01a5b2b2e646b2424b734d61f0c8dc62047f3dc384202501228b08397273fbf87d1152ee1a34105fc8a314aa3cb6d44fcabe250b8c
data/README.md CHANGED
@@ -33,25 +33,39 @@ Mesaj göndermek için tanımlanmış fonksiyonlara argüman olarak **hash** ver
33
33
 
34
34
  Kullanıcının gireceği değerler:
35
35
 
36
- originator: "DENEME"
37
36
  numbers: "5493666154"
38
37
  text: "Mesaj Metni"
39
38
 
39
+ Nesne üretme:
40
+
41
+ SMS gönderme işlemi yapmak üzere GlobalSMS:SMS sınıfından bir nesne üretirken argüman olarak **hash** verilir. Örneğin,
42
+
43
+ ```ruby
44
+ init_args = {
45
+ api_key: "api-key"
46
+ api_secret: "api-secret"
47
+ originator: "USTAD",
48
+ turkish_character: "1"
49
+ }
50
+
51
+ sms = GlobalSMS::SMS.new(init_args)
52
+ ```
53
+
40
54
  #### Bir mesaj gönderme
41
55
 
42
56
  ```ruby
43
57
  require 'globalsms'
44
58
 
45
- sms = GlobalSMS::SMS.new('api-key', 'api-secret')
59
+ sms = GlobalSMS::SMS.new(init_args)
46
60
 
47
- argv = {
61
+ args = {
48
62
  originator: "DENEME",
49
63
  numbers: "5493666154",
50
64
  text: "Mesaj Metni",
51
65
  turkish_character: "1"
52
66
  }
53
67
 
54
- sms.single_send(argv)
68
+ sms.single_send(args)
55
69
 
56
70
  # {
57
71
  # "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" => ""
@@ -65,16 +79,16 @@ NOT: Tek mesaj gönderme yöntemiyle aynıdır. Sadece `numbers` değerine dizi
65
79
  ```ruby
66
80
  require 'globalsms'
67
81
 
68
- sms = GlobalSMS::SMS.new('api-key', 'api-secret')
82
+ sms = GlobalSMS::SMS.new(init_args)
69
83
 
70
- argv = {
84
+ args = {
71
85
  originator: "DENEME",
72
86
  numbers: ["5493666154", "5493666155", "5493666156", "5493666157"],
73
87
  text: "Mesaj Metni",
74
88
  turkish_character: "1"
75
89
  }
76
90
 
77
- sms.single_send(argv)
91
+ sms.single_send(args)
78
92
 
79
93
  # {
80
94
  # "result" => true, "message_id" => "239922", "numbers" => ["5493666154", "5493666155", "5493666156", "5493666157"
@@ -88,9 +102,9 @@ sms.single_send(argv)
88
102
  ```ruby
89
103
  require 'globalsms'
90
104
 
91
- sms = GlobalSMS::SMS.new('api-key', 'api-secret')
105
+ sms = GlobalSMS::SMS.new(init_args)
92
106
 
93
- argv = [
107
+ args = [
94
108
  { originator: "DENEME",
95
109
  numbers: "5493666154",
96
110
  text: "Mesaj Metni",
@@ -116,7 +130,7 @@ argv = [
116
130
  }
117
131
  ]
118
132
 
119
- sms.multi_send(argv)
133
+ sms.multi_send(args)
120
134
 
121
135
  # {
122
136
  # "result" => true, "results" => [{
@@ -135,12 +149,26 @@ sms.multi_send(argv)
135
149
 
136
150
  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.
137
151
 
152
+
153
+ Nesne üretme:
154
+
155
+ Rapor görüntüleme işlemi yapmak üzere GlobalSMS:REPORT sınıfından bir nesne üretirken argüman olarak **hash** verilir. Örneğin,
156
+
157
+ ```ruby
158
+ init_args = {
159
+ api_key: "api-key"
160
+ api_secret: "api-secret"
161
+ }
162
+
163
+ sms = GlobalSMS::REPORT.new(init_args)
164
+ ```
165
+
138
166
  #### Bir mesaja ait raporları görüntüleme
139
167
 
140
168
  ```ruby
141
169
  require 'globalsms'
142
170
 
143
- sms = GlobalSMS::REPORT.new('api-key', 'api-secret')
171
+ sms = GlobalSMS::REPORT.new(init_args)
144
172
 
145
173
  sms.message(239916)
146
174
 
@@ -160,7 +188,7 @@ Argüman verilmezse, ön tanımlı olarak en son yollanan (1) mesaja ait raporu
160
188
  ```ruby
161
189
  require 'globalsms'
162
190
 
163
- sms = GlobalSMS::REPORT.new('api-key', 'api-secret')
191
+ sms = GlobalSMS::REPORT.new(init_args)
164
192
 
165
193
  sms.last_n(10)
166
194
 
@@ -208,16 +236,16 @@ Kullanıcının gireceği değerler:
208
236
  ```ruby
209
237
  require 'globalsms'
210
238
 
211
- sms = GlobalSMS::REPORT.new('api-key','api-secret')
239
+ sms = GlobalSMS::REPORT.new(init_args)
212
240
 
213
- argv = {
241
+ args = {
214
242
  start_date: "2015-05-06",
215
243
  end_date: "2015-05-06",
216
244
  start_time: "20:21:20",
217
245
  end_time: "20:22:00"
218
246
  }
219
247
 
220
- sms.between(argv)
248
+ sms.between(args)
221
249
 
222
250
  # {
223
251
  # "result" => true, "data" => [{
@@ -230,6 +258,19 @@ sms.between(argv)
230
258
 
231
259
  ### Bilgi Alma
232
260
 
261
+ Nesne üretme:
262
+
263
+ Bilgi alma işlemi yapmak üzere GlobalSMS:INFO sınıfından bir nesne üretirken argüman olarak **hash** verilir. Örneğin,
264
+
265
+ ```ruby
266
+ init_args = {
267
+ api_key: "api-key"
268
+ api_secret: "api-secret"
269
+ }
270
+
271
+ sms = GlobalSMS::INFO.new(init_args)
272
+ ```
273
+
233
274
  #### Gönderici adlarını görüntüleme
234
275
 
235
276
  Bu fonksiyon argüman almaz.
@@ -237,7 +278,7 @@ Bu fonksiyon argüman almaz.
237
278
  ```ruby
238
279
  require 'globalsms'
239
280
 
240
- sms = GlobalSMS::INFO.new('api-key', 'api-secret')
281
+ sms = GlobalSMS::INFO.new(init_args)
241
282
 
242
283
  sms.originator_list
243
284
 
@@ -253,7 +294,7 @@ sms.originator_list
253
294
  ```ruby
254
295
  require 'globalsms'
255
296
 
256
- sms = GlobalSMS::INFO.new('api-key', 'api-secret')
297
+ sms = GlobalSMS::INFO.new(init_args)
257
298
 
258
299
  sms.user_info
259
300
 
@@ -1,8 +1,8 @@
1
1
  module GlobalSMS
2
2
  class INFO
3
- def initialize(api_key, api_secret)
4
- @api_key = api_key
5
- @api_secret = api_secret
3
+ def initialize(args)
4
+ @api_key = args[:api_key]
5
+ @api_secret = args[:api_secret]
6
6
  end
7
7
 
8
8
  def originator_list
@@ -1,8 +1,8 @@
1
1
  module GlobalSMS
2
2
  class REPORT
3
- def initialize(api_key, api_secret)
4
- @api_key = api_key
5
- @api_secret = api_secret
3
+ def initialize(args)
4
+ @api_key = args[:api_key]
5
+ @api_secret = args[:api_secret]
6
6
  end
7
7
 
8
8
  def message(message_id)
@@ -1,12 +1,19 @@
1
1
  module GlobalSMS
2
2
  class SMS
3
- def initialize(api_key, api_secret)
4
- @api_key = api_key
5
- @api_secret = api_secret
3
+ TIME = 'now'
4
+ TURKISH_CHARACTER = "0"
5
+ SELECTED = [:time, :turkish_character, :originator]
6
+
7
+ attr_reader :api_key, :api_secret, :time, :turkish_character, :originator
8
+
9
+ def initialize(args)
10
+ @api_key = args[:api_key]
11
+ @api_secret = args[:api_secret]
6
12
  @default_args = {
7
- time: 'now',
8
- turkish_character: '0'
13
+ time: TIME,
14
+ turkish_character: TURKISH_CHARACTER
9
15
  }
16
+ @default_args.merge!(args.select { |key, value| SELECTED.include?(key) })
10
17
  end
11
18
 
12
19
  def single_send(message)
@@ -1,3 +1,3 @@
1
1
  module GlobalSMS
2
- VERSION = '0.4.0'
2
+ VERSION = '0.4.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: globalsms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Salih Özdemir
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-08-14 00:00:00.000000000 Z
11
+ date: 2015-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler