serwersms 0.0.3 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +5 -5
  2. data/lib/serwersms/client_credentials.rb +13 -0
  3. data/lib/serwersms/client_factory.rb +76 -0
  4. data/lib/serwersms/client_token.rb +13 -0
  5. data/lib/serwersms/error.rb +10 -0
  6. data/lib/serwersms/http/api_client.rb +63 -0
  7. data/lib/serwersms/http/http_credentials.rb +22 -0
  8. data/lib/serwersms/http/http_token.rb +23 -0
  9. data/lib/serwersms/resources/accounts.rb +59 -0
  10. data/lib/serwersms/resources/blacklist.rb +55 -0
  11. data/lib/serwersms/resources/contacts.rb +134 -0
  12. data/lib/serwersms/resources/error.rb +20 -0
  13. data/lib/serwersms/resources/files.rb +61 -0
  14. data/lib/serwersms/resources/groups.rb +83 -0
  15. data/lib/serwersms/resources/messages.rb +228 -0
  16. data/lib/serwersms/resources/phones.rb +33 -0
  17. data/lib/serwersms/resources/premium.rb +48 -0
  18. data/lib/serwersms/resources/senders.rb +33 -0
  19. data/lib/serwersms/resources/stats.rb +31 -0
  20. data/lib/serwersms/resources/subaccounts.rb +72 -0
  21. data/lib/serwersms/resources/templates.rb +55 -0
  22. data/lib/serwersms/resources_mixin.rb +55 -0
  23. data/lib/serwersms.rb +21 -58
  24. metadata +28 -27
  25. data/lib/library/accounts.rb +0 -65
  26. data/lib/library/blacklist.rb +0 -63
  27. data/lib/library/contacts.rb +0 -145
  28. data/lib/library/error.rb +0 -19
  29. data/lib/library/files.rb +0 -74
  30. data/lib/library/groups.rb +0 -103
  31. data/lib/library/messages.rb +0 -352
  32. data/lib/library/payments.rb +0 -55
  33. data/lib/library/phones.rb +0 -40
  34. data/lib/library/premium.rb +0 -58
  35. data/lib/library/senders.rb +0 -36
  36. data/lib/library/stats.rb +0 -31
  37. data/lib/library/subaccounts.rb +0 -87
  38. data/lib/library/templates.rb +0 -69
@@ -1,352 +0,0 @@
1
- class Serwersms::Messages
2
- def initialize(obj)
3
- @serwersms = obj
4
- end
5
- '''
6
- * Sending messages
7
- *
8
- * param string phone
9
- * param string text Message
10
- * param string sender Sender name only for FULL SMS
11
- * param array params
12
- * option bool "details" Show details of messages
13
- * option bool "utf" Change encoding to UTF-8 (Only for FULL SMS)
14
- * option bool "flash"
15
- * option bool "speed" Priority canal only for FULL SMS
16
- * option bool "test" Test mode
17
- * option bool "vcard" vCard message
18
- * option string "wap_push" WAP Push URL address
19
- * option string "date" Set the date of sending
20
- * option int "group_id" Sending to the group instead of a phone number
21
- * option int "contact_id" Sending to phone from contacts
22
- * option string "unique_id" Own identifiers of messages
23
- * return array
24
- * option bool "success"
25
- * option int "queued" Number of queued messages
26
- * option int "unsent" Number of unsent messages
27
- * option array "items"
28
- * option string "id"
29
- * option string "phone"
30
- * option string "status" - queued|unsent
31
- * option string "queued" Date of enqueued
32
- * option int "parts" Number of parts a message
33
- * option int "error_code"
34
- * option string "error_message"
35
- * option string "text"
36
- '''
37
- def sendSms(phone, text, sender = nil, params = {})
38
- params['phone'] = phone
39
- params['text'] = text
40
- params['sender'] = sender
41
- @serwersms.call('messages/send_sms',params);
42
- end
43
- '''
44
- * Sending personalized messages
45
- *
46
- * param array messages
47
- * option string "phone"
48
- * option string "text"
49
- * param string sender Sender name only for FULL SMS
50
- * param array params
51
- * option bool "details" Show details of messages
52
- * option bool "utf" Change encoding to UTF-8 (only for FULL SMS)
53
- * option bool "flash"
54
- * option bool "speed" Priority canal only for FULL SMS
55
- * option bool "test" Test mode
56
- * option string "date" Set the date of sending
57
- * option int|array "group_id" Sending to the group instead of a phone number
58
- * option string "text" Message if is set group_id
59
- * option string|array "uniqe_id" Own identifiers of messages
60
- * option bool "voice" Send VMS
61
- * return array
62
- * option bool "success"
63
- * option int "queued" Number of queued messages
64
- * option int "unsent" Number of unsent messages
65
- * option array "items"
66
- * option string "id"
67
- * option string "phone"
68
- * option string "status" - queued|unsent
69
- * option string "queued" Date of enqueued
70
- * option int "parts" Number of parts a message
71
- * option int "error_code"
72
- * option string "error_message"
73
- * option string "text"
74
- '''
75
- def sendPersonalized(messages, sender = nil, params = {})
76
- params['messages'] = messages
77
- params['sender'] = sender
78
- @serwersms.call('messages/send_personalized',params);
79
- end
80
- '''
81
- * Sending Voice message
82
- *
83
- * param string phone
84
- * param array params
85
- * option string "text" If send of text to voice
86
- * option string "file_id" ID from wav files
87
- * option string "date" Set the date of sending
88
- * option bool "test" Test mode
89
- * option int|array "group_id" Sending to the group instead of a phone number
90
- * option int|array "contact_id" Sending to phone from contacts
91
- * return array
92
- * option bool "success"
93
- * option int "queued" Number of queued messages
94
- * option int "unsent" Number of unsent messages
95
- * option array "items"
96
- * option string "id"
97
- * option string "phone"
98
- * option string "status" - queued|unsent
99
- * option string "queued" Date of enqueued
100
- * option int "parts" Number of parts a message
101
- * option int "error_code"
102
- * option string "error_message"
103
- * option string "text"
104
- '''
105
- def sendVoice(phone, params = {})
106
- params['phone'] = phone
107
- @serwersms.call('messages/send_voice',params);
108
- end
109
- '''
110
- * Sending MMS
111
- *
112
- * param string|array phone
113
- * param string title Title of message (max 40 chars)
114
- * param array params
115
- * option string "file_id"
116
- * option string|array "file" File in base64 encoding
117
- * option string "date" Set the date of sending
118
- * option bool "test" Test mode
119
- * option int|array "group_id" Sending to the group instead of a phone number
120
- * return array
121
- * option bool "success"
122
- * option int "queued" Number of queued messages
123
- * option int "unsent" Number of unsent messages
124
- * option array "items"
125
- * option string "id"
126
- * option string "phone"
127
- * option string "status" - queued|unsent
128
- * option string "queued" Date of enqueued
129
- * option int "parts" Number of parts a message
130
- * option int "error_code"
131
- * option string "error_message"
132
- * option string "text"
133
- '''
134
- def sendMms(phone,title, params = {})
135
- params['phone'] = phone
136
- params['title'] = title
137
- @serwersms.call('messages/send_mms',params);
138
- end
139
- '''
140
- * View single message
141
- *
142
- * param string id
143
- * param array params
144
- * option string "unique_id"
145
- * option bool "show_contact" Show details of the recipient from the contacts
146
- * return array
147
- * option string "id"
148
- * option string "phone"
149
- * option string "status"
150
- * - delivered: The message is sent and delivered
151
- * - undelivered: The message is sent but not delivered
152
- * - sent: The message is sent and waiting for report
153
- * - unsent: The message wasnt sent
154
- * - in_progress: The message is queued for sending
155
- * - saved: The message was saved in schedule
156
- * option string "queued" Date of enqueued
157
- * option string "sent" Date of sending
158
- * option string "delivered" Date of deliver
159
- * option string "sender"
160
- * option string "type" - eco|full|mms|voice
161
- * option string "text"
162
- * option string "reason"
163
- * - message_expired
164
- * - unsupported_number
165
- * - message_rejected
166
- * - missed_call
167
- * - wrong_number
168
- * - limit_exhausted
169
- * - lock_send
170
- * - wrong_message
171
- * - operator_error
172
- * - wrong_sender_name
173
- * - number_is_blacklisted
174
- * - sending_to_foreign_networks_is_locked
175
- * - no_permission_to_send_messages
176
- * - other_error
177
- * option array "contact"
178
- * option string "first_name"
179
- * option string "last_name"
180
- * option string "company"
181
- * option string "phone"
182
- * option string "email"
183
- * option string "tax_id"
184
- * option string "city"
185
- * option string "address"
186
- * option string "description"
187
- '''
188
- def view(id, params = {})
189
- params['id'] = id
190
- @serwersms.call('messages/view',params);
191
- end
192
- '''
193
- * Checking messages reports
194
- *
195
- * param array params
196
- * option string|array "id" ID message
197
- * option string|array "unique_id" ID message
198
- * option string|array "phone"
199
- * option string "date_from" The scope of the initial
200
- * option string "date_to" The scope of the final
201
- * option string "status" delivered|undelivered|pending|sent|unsent
202
- * option string "type" eco|full|mms|voice
203
- * option int "stat_id" Id package messages
204
- * option bool "show_contact" Show details of the recipient from the contacts
205
- * option int "page" The number of the displayed page
206
- * option int "limit" Limit items are displayed on the single page
207
- * option string "order" asc|desc
208
- * return array
209
- * option array "paging"
210
- * option int "page" The number of current page
211
- * option int "count" The number of all pages
212
- * option array items
213
- * option string "id"
214
- * option string "phone"
215
- * option string "status"
216
- * - delivered: The message is sent and delivered
217
- * - undelivered: The message is sent but not delivered
218
- * - sent: The message is sent and waiting for report
219
- * - unsent: The message wasnt sent
220
- * - in_progress: The message is queued for sending
221
- * - saved: The message was saved in the scheduler
222
- * option string "queued" Date of enqueued
223
- * option string "sent" Date of sending
224
- * option string "delivered" Date of deliver
225
- * option string "sender"
226
- * option string "type" - eco|full|mms|voice
227
- * option string "text"
228
- * option string "reason"
229
- * - message_expired
230
- * - unsupported_number
231
- * - message_rejected
232
- * - missed_call
233
- * - wrong_number
234
- * - limit_exhausted
235
- * - lock_send
236
- * - wrong_message
237
- * - operator_error
238
- * - wrong_sender_name
239
- * - number_is_blacklisted
240
- * - sending_to_foreign_networks_is_locked
241
- * - no_permission_to_send_messages
242
- * - other_error
243
- * option array "contact"
244
- * option string "first_name"
245
- * option string "last_name"
246
- * option string "company"
247
- * option string "phone"
248
- * option string "email"
249
- * option string "tax_id"
250
- * option string "city"
251
- * option string "address"
252
- * option string "description"
253
- '''
254
- def reports(params = {})
255
- @serwersms.call('messages/reports',params);
256
- end
257
- '''
258
- * Deleting message from the scheduler
259
- *
260
- * param string id
261
- * param string unique_id
262
- * return array
263
- * option bool "success"
264
- '''
265
- def delete(id, unique_id = nil )
266
- params = {}
267
- params['id'] = id
268
- params['unique_id'] = unique_id
269
- @serwersms.call('messages/delete',params);
270
- end
271
- '''
272
- * List of received messages
273
- *
274
- * param string type
275
- * - eco SMS ECO replies
276
- * - nd Incoming messages to ND number
277
- * - ndi Incoming messages to ND number
278
- * - mms Incoming MMS
279
- * param array params
280
- * option string "ndi" Filtering by NDI
281
- * option string "phone" Filtering by phone
282
- * option string "date_from" The scope of the initial
283
- * option string "date_to" The scope of the final
284
- * option bool "read" Mark as read
285
- * option int "page" The number of the displayed page
286
- * option int "limit" Limit items are displayed on the single page
287
- * option string "order" asc|desc
288
- * return array
289
- * option array "paging"
290
- * option int "page" The number of current page
291
- * option int "count" The number of all pages
292
- * option array "items"
293
- * option int "id"
294
- * option string "type" eco|nd|ndi|mms
295
- * option string "phone"
296
- * option string "recived" Date of received message
297
- * option string "message_id" ID of outgoing message (only for ECO SMS)
298
- * option bool "blacklist" Is the phone is blacklisted?
299
- * option string "text" Message
300
- * option string "to_number" Number of the recipient (for MMS)
301
- * option string "title" Title of message (for MMS)
302
- * option array "attachments" (for MMS)
303
- * option int "id"
304
- * option string "name"
305
- * option string "content_type"
306
- * option string "data" File
307
- * option array "contact"
308
- * option string "first_name"
309
- * option string "last_name"
310
- * option string "company"
311
- * option string "phone"
312
- * option string "email"
313
- * option string "tax_id"
314
- * option string "city"
315
- * option string "address"
316
- * option string "description"
317
- '''
318
- def recived(type, params = {} )
319
- params['type'] = type
320
- @serwersms.call('messages/recived',params);
321
- end
322
- '''
323
- * Sending a message to an ND/SC
324
- *
325
- * param string phone Sender phone number
326
- * param string text Message
327
- * return array
328
- * option bool "success"
329
- '''
330
- def sendNd(phone, text )
331
- params = {}
332
- params['phone'] = phone
333
- params['text'] = text
334
- @serwersms.call('messages/send_nd',params);
335
- end
336
- '''
337
- * Sending a message to an NDI/SCI
338
- *
339
- * param string phone Sender phone number
340
- * param string text Message
341
- * param string ndi_number Recipient phone number
342
- * return array
343
- * option bool "success"
344
- '''
345
- def sendNdi(phone, text, ndi_number )
346
- params = {}
347
- params['phone'] = phone
348
- params['text'] = text
349
- params['ndi_number'] = ndi_number
350
- @serwersms.call('messages/send_ndi',params);
351
- end
352
- end
@@ -1,55 +0,0 @@
1
- class Serwersms::Payments
2
- def initialize(obj)
3
- @serwersms = obj
4
- end
5
-
6
- '''
7
- * List of payments
8
- *
9
- * return array
10
- * option array "items"
11
- * option int "id"
12
- * option string "number"
13
- * option string "state" paid|not_paid
14
- * option float "paid"
15
- * option float "total"
16
- * option string "payment_to"
17
- * option string "url"
18
- '''
19
- def index()
20
- params = {}
21
- @serwersms.call('payments/index',params);
22
- end
23
-
24
- '''
25
- * View single payment
26
- *
27
- * param int id
28
- * return array
29
- * option int "id"
30
- * option string "number"
31
- * option string "state" paid|not_paid
32
- * option float "paid"
33
- * option float "total"
34
- * option string "payment_to"
35
- * option string "url"
36
- '''
37
- def view(id)
38
- params = {}
39
- params['id'] = id
40
- @serwersms.call('payments/view',params);
41
- end
42
-
43
- '''
44
- * Download invoice as PDF
45
- *
46
- * param int id
47
- * return resource
48
- '''
49
- def invoice(id)
50
- params = {}
51
- params['id'] = id
52
- @serwersms.call('payments/invoice',params);
53
- end
54
-
55
- end
@@ -1,40 +0,0 @@
1
- class Serwersms::Phones
2
- def initialize(obj)
3
- @serwersms = obj
4
- end
5
-
6
- '''
7
- * Checking phone in to HLR
8
- *
9
- * param string $phone
10
- * param string $id Query ID returned if the processing takes longer than 60 seconds
11
- * return array
12
- * option string "phone"
13
- * option string "status"
14
- * option int "imsi"
15
- * option string "network"
16
- * option bool "ported"
17
- * option string "network_ported"
18
- '''
19
- def check(phone, id = nil)
20
- params = {}
21
- params['id'] = id
22
- params['phone'] = phone
23
- @serwersms.call('phones/check',params);
24
- end
25
-
26
- '''
27
- * Validating phone number
28
- *
29
- * param string $phone
30
- * return array
31
- * option bool "correct"
32
- '''
33
- def test(phone)
34
- params = {}
35
- params['phone'] = phone
36
- @serwersms.call('phones/test',params);
37
- end
38
-
39
-
40
- end
@@ -1,58 +0,0 @@
1
- class Serwersms::Premium
2
- def initialize(obj)
3
- @serwersms = obj
4
- end
5
-
6
- '''
7
- * List of received SMS Premium
8
- *
9
- * return array
10
- * option array "items"
11
- * option int "id"
12
- * option string "to_number" Premium number
13
- * option string "from_number" Sender phone number
14
- * option string "date"
15
- * option int "limit" Limitation the number of responses
16
- * option string "text" Message
17
- '''
18
- def index()
19
- params = {}
20
- @serwersms.call('premium/index',params);
21
- end
22
-
23
- '''
24
- * Sending replies for received SMS Premium
25
- *
26
- * param string phone
27
- * param string text Message
28
- * param string gate Premium number
29
- * param int $id ID received SMS Premium
30
- * return array
31
- * option bool "success"
32
- '''
33
- def send(phone, text, gate, id)
34
- params = {}
35
- params['text'] = text
36
- params['phone'] = phone
37
- params['gate'] = gate
38
- params['id'] = id
39
- @serwersms.call('premium/send',params);
40
- end
41
-
42
- '''
43
- * View quiz results
44
- *
45
- * param int id
46
- * return array
47
- * option int "id"
48
- * option string "name"
49
- * option array "items"
50
- * option int "id"
51
- * option int "count" Number of response
52
- '''
53
- def quiz(id)
54
- params = {}
55
- params['id'] = id
56
- @serwersms.call('quiz/view',params);
57
- end
58
- end
@@ -1,36 +0,0 @@
1
- class Serwersms::Senders
2
- def initialize(obj)
3
- @serwersms = obj
4
- end
5
-
6
- '''
7
- * Creating new Sender name
8
- *
9
- * param string name
10
- * return array
11
- * option bool "success"
12
- '''
13
- def add(name)
14
- params = {}
15
- params['name'] = name
16
- @serwersms.call('senders/add',params);
17
- end
18
-
19
- '''
20
- * Senders list
21
- *
22
- * param array params
23
- * option bool "predefined"
24
- * option string "sort" Values: name
25
- * option string "order" Values: asc|desc
26
- * return array
27
- * option array "items"
28
- * option string "name"
29
- * option string "agreement" delivered|required|not_required
30
- * option string "status" pending_authorization|authorized|rejected|deactivated
31
- '''
32
- def index(params = {})
33
- @serwersms.call('senders/index',params);
34
- end
35
-
36
- end
data/lib/library/stats.rb DELETED
@@ -1,31 +0,0 @@
1
- class Serwersms::Stats
2
- def initialize(obj)
3
- @serwersms = obj
4
- end
5
-
6
- '''
7
- * Statistics an sending
8
- *
9
- * param array params
10
- * option string "type" eco|full|voice|mms
11
- * option string "begin" Start date
12
- * option string "end" End date
13
- * return array
14
- * option array "items"
15
- * option int "id"
16
- * option string "name"
17
- * option int "delivered"
18
- * option int "pending"
19
- * option int "undelivered"
20
- * option int "unsent"
21
- * option string "begin"
22
- * option string "end"
23
- * option string "text"
24
- * option string "type" eco|full|voice|mms
25
- '''
26
- def index(params = {} )
27
-
28
- @serwersms.call('stats/index',params);
29
- end
30
-
31
- end
@@ -1,87 +0,0 @@
1
- class Serwersms::Subaccounts
2
- def initialize(obj)
3
- @serwersms = obj
4
- end
5
-
6
- '''
7
- * Creating new subaccount
8
- *
9
- * param string $subaccount_username
10
- * param string $subaccount_password
11
- * param int $subaccount_id Subaccount ID, which is template of powers
12
- * param array $params
13
- * option string "name"
14
- * option string "phone"
15
- * option string "email"
16
- * return type
17
- '''
18
- def add(subaccount_username, subaccount_password, subaccount_id, params = {})
19
-
20
- params['subaccount_username'] = subaccount_username
21
- params['subaccount_password'] = subaccount_password
22
- params['subaccount_id'] = subaccount_id
23
- @serwersms.call('subaccounts/add',params);
24
- end
25
-
26
- '''
27
- * List of subaccounts
28
- *
29
- * return array
30
- * option array "items"
31
- * option int "id"
32
- * option string "username"
33
- '''
34
- def index()
35
- params = {}
36
- @serwersms.call('subaccounts/index',params);
37
- end
38
-
39
- '''
40
- * View details of subaccount
41
- *
42
- * param int $id
43
- * return array
44
- * option int "id"
45
- * option string "username"
46
- * option string "name"
47
- * option string "phone"
48
- * option string "email"
49
- '''
50
- def view(id)
51
- params = {}
52
- params['id'] = id
53
- @serwersms.call('subaccounts/view',params);
54
- end
55
-
56
- '''
57
- * Setting the limit on subaccount
58
- *
59
- * param int $id
60
- * param string $type Message type: eco|full|voice|mms|hlr
61
- * param int $value
62
- * return array
63
- * option bool "success"
64
- * option int "id"
65
- '''
66
- def limit(id, type, value)
67
- params = {}
68
- params['id'] = id
69
- params['type'] = type
70
- params['value'] = value
71
- @serwersms.call('subaccounts/limit',params);
72
- end
73
-
74
- '''
75
- * Deleting a subaccount
76
- *
77
- * param int $id
78
- * return array
79
- * option bool "success"
80
- '''
81
- def delete(id)
82
- params = {}
83
- params['id'] = id
84
- @serwersms.call('subaccounts/delete',params);
85
- end
86
-
87
- end