serwersms 0.0.2
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.
- checksums.yaml +7 -0
- data/lib/library/accounts.rb +65 -0
- data/lib/library/blacklist.rb +63 -0
- data/lib/library/contacts.rb +145 -0
- data/lib/library/error.rb +19 -0
- data/lib/library/files.rb +74 -0
- data/lib/library/groups.rb +103 -0
- data/lib/library/messages.rb +352 -0
- data/lib/library/payments.rb +55 -0
- data/lib/library/phones.rb +40 -0
- data/lib/library/premium.rb +58 -0
- data/lib/library/senders.rb +36 -0
- data/lib/library/stats.rb +31 -0
- data/lib/library/subaccounts.rb +87 -0
- data/lib/library/templates.rb +69 -0
- data/lib/serwersms.rb +55 -0
- metadata +60 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: bf059fbf7c113d1e84d76f2d0dba32c6287b46ea
|
|
4
|
+
data.tar.gz: 1b63e6556edae532a343d6c6e3c82ac362c5a93d
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: b110622bc15e98485186f399d7f06dc4bfcb22fcdfeebf8a96e0cef5823641e58d8f64b0612aac57d6c37f28d13b850340500bc36a6fedadfa57a209aa7c6f4f
|
|
7
|
+
data.tar.gz: c76bcbecd54bf5a88c03ab307362b60a5090ccc0e2395342817fc96fe373073764fee35d0c693663d7e77f5f254684711852e40d36c6cf563c22388ac1857f3a
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
class Serwersms::Accounts
|
|
2
|
+
def initialize(obj)
|
|
3
|
+
@serwersms = obj
|
|
4
|
+
end
|
|
5
|
+
'''
|
|
6
|
+
* Register new account
|
|
7
|
+
*
|
|
8
|
+
* param array params
|
|
9
|
+
* option string "phone"
|
|
10
|
+
* option string "email"
|
|
11
|
+
* option string "first_name"
|
|
12
|
+
* option string "last_name"
|
|
13
|
+
* option string "company"
|
|
14
|
+
* return array
|
|
15
|
+
* option bool "success"
|
|
16
|
+
'''
|
|
17
|
+
def add( params = {} )
|
|
18
|
+
@serwersms.call('account/add',params);
|
|
19
|
+
end
|
|
20
|
+
'''
|
|
21
|
+
* Register new account
|
|
22
|
+
* Return limits SMS
|
|
23
|
+
*
|
|
24
|
+
* return array
|
|
25
|
+
* option array "items"
|
|
26
|
+
* option string "type" Type of message
|
|
27
|
+
* option string "chars_limit" The maximum length of message
|
|
28
|
+
* option string "value" Limit messages
|
|
29
|
+
*
|
|
30
|
+
'''
|
|
31
|
+
def limits()
|
|
32
|
+
params = {}
|
|
33
|
+
@serwersms.call('account/limits',params);
|
|
34
|
+
end
|
|
35
|
+
'''
|
|
36
|
+
* Return contact details
|
|
37
|
+
*
|
|
38
|
+
* return array
|
|
39
|
+
* option string "telephone"
|
|
40
|
+
* option string "email"
|
|
41
|
+
* option string "form"
|
|
42
|
+
* option string "faq"
|
|
43
|
+
* option array "quardian_account"
|
|
44
|
+
* option string "name"
|
|
45
|
+
* option string "email"
|
|
46
|
+
* option string "telephone"
|
|
47
|
+
* option string "photo"
|
|
48
|
+
'''
|
|
49
|
+
def help()
|
|
50
|
+
params = {}
|
|
51
|
+
@serwersms.call('account/help',params);
|
|
52
|
+
end
|
|
53
|
+
'''
|
|
54
|
+
* Return messages from the administrator
|
|
55
|
+
*
|
|
56
|
+
* return array
|
|
57
|
+
* option bool "new" Marking unread message
|
|
58
|
+
* option string "message"
|
|
59
|
+
'''
|
|
60
|
+
def messages()
|
|
61
|
+
params = {}
|
|
62
|
+
@serwersms.call('account/messages',params);
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
end
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
class Serwersms::Blacklist
|
|
2
|
+
def initialize(obj)
|
|
3
|
+
@serwersms = obj
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
'''
|
|
7
|
+
* Add phone to the blacklist
|
|
8
|
+
*
|
|
9
|
+
* param string $phone
|
|
10
|
+
* return array
|
|
11
|
+
* option bool "success"
|
|
12
|
+
* option int "id"
|
|
13
|
+
'''
|
|
14
|
+
def add(phone)
|
|
15
|
+
params = {}
|
|
16
|
+
params['phone'] = phone
|
|
17
|
+
@serwersms.call('blacklist/add',params);
|
|
18
|
+
end
|
|
19
|
+
'''
|
|
20
|
+
* List of blacklist phones
|
|
21
|
+
*
|
|
22
|
+
* param string phone
|
|
23
|
+
* param array params
|
|
24
|
+
* option int "page" The number of the displayed page
|
|
25
|
+
* option int "limit" Limit items are displayed on the single page
|
|
26
|
+
* return array
|
|
27
|
+
* option array "paging"
|
|
28
|
+
* option int "page" The number of current page
|
|
29
|
+
* option int "count" The number of all pages
|
|
30
|
+
* option array "items"
|
|
31
|
+
* option string "phone"
|
|
32
|
+
* option string "added" Date of adding phone
|
|
33
|
+
'''
|
|
34
|
+
def index(phone = nil, params = {})
|
|
35
|
+
params['phone'] = phone
|
|
36
|
+
@serwersms.call('blacklist/index',params);
|
|
37
|
+
end
|
|
38
|
+
'''
|
|
39
|
+
* Checking if phone is blacklisted
|
|
40
|
+
*
|
|
41
|
+
* param string phone
|
|
42
|
+
* return array
|
|
43
|
+
* option bool "exists"
|
|
44
|
+
'''
|
|
45
|
+
def check(phone)
|
|
46
|
+
params = {}
|
|
47
|
+
params['phone'] = phone
|
|
48
|
+
@serwersms.call('blacklist/check',params);
|
|
49
|
+
end
|
|
50
|
+
'''
|
|
51
|
+
* Deleting phone from the blacklist
|
|
52
|
+
*
|
|
53
|
+
* param string phone
|
|
54
|
+
* return array
|
|
55
|
+
* option bool "success"
|
|
56
|
+
'''
|
|
57
|
+
def delete(phone)
|
|
58
|
+
params = {}
|
|
59
|
+
params['phone'] = phone
|
|
60
|
+
@serwersms.call('blacklist/delete',params);
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
end
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
class Serwersms::Contacts
|
|
2
|
+
def initialize(obj)
|
|
3
|
+
@serwersms = obj
|
|
4
|
+
end
|
|
5
|
+
'''
|
|
6
|
+
* Add new contact
|
|
7
|
+
*
|
|
8
|
+
* param string group_id
|
|
9
|
+
* param string phone
|
|
10
|
+
* param array params
|
|
11
|
+
* option string "email"
|
|
12
|
+
* option string "first_name"
|
|
13
|
+
* option string "last_name"
|
|
14
|
+
* option string "company"
|
|
15
|
+
* option string "tax_id"
|
|
16
|
+
* option string "address"
|
|
17
|
+
* option string "city"
|
|
18
|
+
* option string "description"
|
|
19
|
+
* return array
|
|
20
|
+
* option bool "success"
|
|
21
|
+
* option int "id"
|
|
22
|
+
'''
|
|
23
|
+
def add(group_id, phone, params = {})
|
|
24
|
+
params['group_id'] = group_id
|
|
25
|
+
params['phone'] = phone
|
|
26
|
+
@serwersms.call('contacts/add',params);
|
|
27
|
+
end
|
|
28
|
+
'''
|
|
29
|
+
* List of contacts
|
|
30
|
+
*
|
|
31
|
+
* param int group_id
|
|
32
|
+
* param string search
|
|
33
|
+
* param array params
|
|
34
|
+
* option int "page" The number of the displayed page
|
|
35
|
+
* option int "limit" Limit items are displayed on the single page
|
|
36
|
+
* option string "sort" Values: first_name|last_name|phone|company|tax_id|email|address|city|description
|
|
37
|
+
* option string "order" Values: asc|desc
|
|
38
|
+
* return array
|
|
39
|
+
* option array "paging"
|
|
40
|
+
* option int "page" The number of current page
|
|
41
|
+
* option int "count" The number of all pages
|
|
42
|
+
* options array "items"
|
|
43
|
+
* option int "id"
|
|
44
|
+
* option string "phone"
|
|
45
|
+
* option string "email"
|
|
46
|
+
* option string "company"
|
|
47
|
+
* option string "first_name"
|
|
48
|
+
* option string "last_name"
|
|
49
|
+
* option string "tax_id"
|
|
50
|
+
* option string "address"
|
|
51
|
+
* option string "city"
|
|
52
|
+
* option string "description"
|
|
53
|
+
* option bool "blacklist"
|
|
54
|
+
* option int "group_id"
|
|
55
|
+
* option string "group_name"
|
|
56
|
+
'''
|
|
57
|
+
def index(group_id = nil, search = nil , params = {})
|
|
58
|
+
params['group_id'] = group_id
|
|
59
|
+
params['search'] = search
|
|
60
|
+
@serwersms.call('contacts/index',params);
|
|
61
|
+
end
|
|
62
|
+
'''
|
|
63
|
+
* View single contact
|
|
64
|
+
*
|
|
65
|
+
* param int id
|
|
66
|
+
* return array
|
|
67
|
+
* option integer "id"
|
|
68
|
+
* option string "phone"
|
|
69
|
+
* option string "email"
|
|
70
|
+
* option string "company"
|
|
71
|
+
* option string "first_name"
|
|
72
|
+
* option string "last_name"
|
|
73
|
+
* option string "tax_id"
|
|
74
|
+
* option string "address"
|
|
75
|
+
* option string "city"
|
|
76
|
+
* option string "description"
|
|
77
|
+
* option bool "blacklist"
|
|
78
|
+
'''
|
|
79
|
+
def view(id)
|
|
80
|
+
params = {}
|
|
81
|
+
params['id'] = id
|
|
82
|
+
@serwersms.call('contacts/view',params);
|
|
83
|
+
end
|
|
84
|
+
'''
|
|
85
|
+
* Editing a contact
|
|
86
|
+
*
|
|
87
|
+
* param int id
|
|
88
|
+
* param int|array group_id
|
|
89
|
+
* param string phone
|
|
90
|
+
* param array params
|
|
91
|
+
* option string "email"
|
|
92
|
+
* option string "first_name"
|
|
93
|
+
* option string "last_name"
|
|
94
|
+
* option string "company"
|
|
95
|
+
* option string "tax_id"
|
|
96
|
+
* option string "address"
|
|
97
|
+
* option string "city"
|
|
98
|
+
* option string "description"
|
|
99
|
+
* return array
|
|
100
|
+
* option bool "success"
|
|
101
|
+
* option int "id"
|
|
102
|
+
'''
|
|
103
|
+
def edit(id, group_id, phone, params = {})
|
|
104
|
+
params['id'] = id
|
|
105
|
+
params['group_id'] = group_id
|
|
106
|
+
params['phone'] = phone
|
|
107
|
+
@serwersms.call('contacts/edit',params);
|
|
108
|
+
end
|
|
109
|
+
'''
|
|
110
|
+
* Deleting a phone from contacts
|
|
111
|
+
*
|
|
112
|
+
* param int id
|
|
113
|
+
* return array
|
|
114
|
+
* option bool "success"
|
|
115
|
+
'''
|
|
116
|
+
def delete(id)
|
|
117
|
+
params = {}
|
|
118
|
+
params['id'] = id
|
|
119
|
+
@serwersms.call('contacts/delete',params);
|
|
120
|
+
end
|
|
121
|
+
'''
|
|
122
|
+
* Import contact list
|
|
123
|
+
*
|
|
124
|
+
* param string group_name
|
|
125
|
+
* param array contact[]
|
|
126
|
+
* option string "phone"
|
|
127
|
+
* option string "email"
|
|
128
|
+
* option string "first_name"
|
|
129
|
+
* option string "last_name"
|
|
130
|
+
* option string "company"
|
|
131
|
+
* return array
|
|
132
|
+
* option bool "success"
|
|
133
|
+
* option int "id"
|
|
134
|
+
* option int "correct" Number of contacts imported correctly
|
|
135
|
+
* option int "failed" Number of errors
|
|
136
|
+
'''
|
|
137
|
+
def import(group_name, contact = {})
|
|
138
|
+
params = {}
|
|
139
|
+
params['group_name'] = group_name
|
|
140
|
+
params['contact'] = contact.to_json
|
|
141
|
+
@serwersms.call('contacts/import',params);
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
require 'json'
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
class Serwersms::Error
|
|
2
|
+
def initialize(obj)
|
|
3
|
+
@serwersms = obj
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
'''
|
|
7
|
+
* Preview error
|
|
8
|
+
*
|
|
9
|
+
* param int code
|
|
10
|
+
* return array
|
|
11
|
+
* option int "code"
|
|
12
|
+
* option string "type"
|
|
13
|
+
* option string "message"
|
|
14
|
+
'''
|
|
15
|
+
def view(code)
|
|
16
|
+
@serwersms.call('error/'+code);
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
end
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
class Serwersms::Files
|
|
2
|
+
def initialize(obj)
|
|
3
|
+
@serwersms = obj
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
'''
|
|
7
|
+
* Add new file
|
|
8
|
+
*
|
|
9
|
+
* param string type - mms|voice
|
|
10
|
+
* param array params
|
|
11
|
+
* option string "url" URL address to file
|
|
12
|
+
* option resource "file" A file handler (only for MMS)
|
|
13
|
+
* return array
|
|
14
|
+
* option bool "success"
|
|
15
|
+
* option string "id"
|
|
16
|
+
'''
|
|
17
|
+
def add(type, params = {})
|
|
18
|
+
params['type'] = type
|
|
19
|
+
@serwersms.call('files/add',params);
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
'''
|
|
23
|
+
* List of files
|
|
24
|
+
*
|
|
25
|
+
* param string type - mms|voice
|
|
26
|
+
* return array
|
|
27
|
+
* option array "items"
|
|
28
|
+
* option string "id"
|
|
29
|
+
* option string "name"
|
|
30
|
+
* option int "size"
|
|
31
|
+
* option string "type" - mms|voice
|
|
32
|
+
* option string "date"
|
|
33
|
+
'''
|
|
34
|
+
def index(type)
|
|
35
|
+
params = {}
|
|
36
|
+
params['type'] = type
|
|
37
|
+
@serwersms.call('files/index',params);
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
'''
|
|
41
|
+
* View file
|
|
42
|
+
*
|
|
43
|
+
* param string id
|
|
44
|
+
* param string type - mms|voice
|
|
45
|
+
* return array
|
|
46
|
+
* option string "id"
|
|
47
|
+
* option string "name"
|
|
48
|
+
* option int "size"
|
|
49
|
+
* option string "type" - mms|voice
|
|
50
|
+
* option string "date"
|
|
51
|
+
'''
|
|
52
|
+
def view(id,type)
|
|
53
|
+
params = {}
|
|
54
|
+
params['id'] = id
|
|
55
|
+
params['type'] = type
|
|
56
|
+
@serwersms.call('files/view',params);
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
'''
|
|
60
|
+
* Deleting a file
|
|
61
|
+
*
|
|
62
|
+
* param string id
|
|
63
|
+
* param string type - mms|voice
|
|
64
|
+
* return array
|
|
65
|
+
* option bool "success"
|
|
66
|
+
'''
|
|
67
|
+
def delete(id,type)
|
|
68
|
+
params = {}
|
|
69
|
+
params['id'] = id
|
|
70
|
+
params['type'] = type
|
|
71
|
+
@serwersms.call('files/delete',params);
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
end
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
class Serwersms::Groups
|
|
2
|
+
def initialize(obj)
|
|
3
|
+
@serwersms = obj
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
'''
|
|
7
|
+
* Add new group
|
|
8
|
+
*
|
|
9
|
+
* param string $name
|
|
10
|
+
* return array
|
|
11
|
+
* option bool "success"
|
|
12
|
+
* option int "id"
|
|
13
|
+
'''
|
|
14
|
+
def add(name)
|
|
15
|
+
params = {}
|
|
16
|
+
params['name'] = name
|
|
17
|
+
@serwersms.call('groups/add',params);
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
'''
|
|
21
|
+
* List of group
|
|
22
|
+
*
|
|
23
|
+
* param string $search Group name
|
|
24
|
+
* param array $params
|
|
25
|
+
* option int "page" The number of the displayed page
|
|
26
|
+
* option int "limit" Limit items are displayed on the single page
|
|
27
|
+
* option string "sort" Values: name
|
|
28
|
+
* option string "order" Values: asc|desc
|
|
29
|
+
* return array
|
|
30
|
+
* option array "paging"
|
|
31
|
+
* option int "page" The number of current page
|
|
32
|
+
* option int "count" The number of all pages
|
|
33
|
+
* option array "items"
|
|
34
|
+
* option int "id"
|
|
35
|
+
* option string "name"
|
|
36
|
+
* option int "count" Number of contacts in the group
|
|
37
|
+
'''
|
|
38
|
+
def index(search = nil,params = {})
|
|
39
|
+
|
|
40
|
+
params['search'] = search
|
|
41
|
+
@serwersms.call('groups/index',params);
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
'''
|
|
45
|
+
* View single group
|
|
46
|
+
*
|
|
47
|
+
* param int $id
|
|
48
|
+
* return array
|
|
49
|
+
* option int "id"
|
|
50
|
+
* option string "name"
|
|
51
|
+
* option int "count" Number of contacts in the group
|
|
52
|
+
'''
|
|
53
|
+
def view(id)
|
|
54
|
+
params = {}
|
|
55
|
+
params['id'] = id
|
|
56
|
+
@serwersms.call('groups/view',params);
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
'''
|
|
60
|
+
* Editing a group
|
|
61
|
+
*
|
|
62
|
+
* param int $id
|
|
63
|
+
* param string $name
|
|
64
|
+
* return array
|
|
65
|
+
* option bool "success"
|
|
66
|
+
* option int "id"
|
|
67
|
+
'''
|
|
68
|
+
def edit(id, name)
|
|
69
|
+
params = {}
|
|
70
|
+
params['id'] = id
|
|
71
|
+
params['name'] = name
|
|
72
|
+
@serwersms.call('groups/edit',params);
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
'''
|
|
76
|
+
* Deleting a group
|
|
77
|
+
*
|
|
78
|
+
* param int $id
|
|
79
|
+
* return array
|
|
80
|
+
* option bool "success"
|
|
81
|
+
'''
|
|
82
|
+
def delete(id)
|
|
83
|
+
params = {}
|
|
84
|
+
params['id'] = id
|
|
85
|
+
@serwersms.call('groups/delete',params);
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
'''
|
|
89
|
+
* Viewing a groups containing phone
|
|
90
|
+
*
|
|
91
|
+
* param string $phone
|
|
92
|
+
* return array
|
|
93
|
+
* option int "id"
|
|
94
|
+
* option int "group_id"
|
|
95
|
+
* option string "group_name"
|
|
96
|
+
'''
|
|
97
|
+
def check(phone)
|
|
98
|
+
params = {}
|
|
99
|
+
params['phone'] = phone
|
|
100
|
+
@serwersms.call('groups/check',params);
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
end
|
|
@@ -0,0 +1,352 @@
|
|
|
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
|
|
@@ -0,0 +1,55 @@
|
|
|
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
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
|
@@ -0,0 +1,87 @@
|
|
|
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
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
class Serwersms::Templates
|
|
2
|
+
def initialize(obj)
|
|
3
|
+
@serwersms = obj
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
'''
|
|
7
|
+
* List of templates
|
|
8
|
+
* param array params
|
|
9
|
+
* option string "sort" Values: name
|
|
10
|
+
* option string "order" Values: asc|desc
|
|
11
|
+
* return array
|
|
12
|
+
* option array "items"
|
|
13
|
+
* option int "id"
|
|
14
|
+
* option string "name"
|
|
15
|
+
* option string "text"
|
|
16
|
+
'''
|
|
17
|
+
def index(params = {} )
|
|
18
|
+
@serwersms.call('templates/index',params);
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
'''
|
|
22
|
+
Adding new template
|
|
23
|
+
*
|
|
24
|
+
* param string name
|
|
25
|
+
* param string text
|
|
26
|
+
* return array
|
|
27
|
+
* option array
|
|
28
|
+
* option bool "success"
|
|
29
|
+
* option int "id"
|
|
30
|
+
'''
|
|
31
|
+
def add(name, text)
|
|
32
|
+
params = {}
|
|
33
|
+
params['name'] = name
|
|
34
|
+
params['text'] = text
|
|
35
|
+
@serwersms.call('templates/add',params);
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
'''
|
|
39
|
+
* Editing a template
|
|
40
|
+
*
|
|
41
|
+
* param int id
|
|
42
|
+
* param string name
|
|
43
|
+
* param string text
|
|
44
|
+
* return array
|
|
45
|
+
* option bool "success"
|
|
46
|
+
* option int "id"
|
|
47
|
+
'''
|
|
48
|
+
def edit(id,name, text)
|
|
49
|
+
params = {}
|
|
50
|
+
params['id'] = id
|
|
51
|
+
params['name'] = name
|
|
52
|
+
params['text'] = text
|
|
53
|
+
@serwersms.call('templates/edit',params);
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
'''
|
|
57
|
+
* Deleting a template
|
|
58
|
+
*
|
|
59
|
+
* param int id
|
|
60
|
+
* return array
|
|
61
|
+
* option bool "success"
|
|
62
|
+
'''
|
|
63
|
+
def delete(id)
|
|
64
|
+
params = {}
|
|
65
|
+
params['id'] = id
|
|
66
|
+
@serwersms.call('templates/delete',params);
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
end
|
data/lib/serwersms.rb
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
class Serwersms
|
|
2
|
+
|
|
3
|
+
@@api_url = 'http://api2.serwersms.pl/'
|
|
4
|
+
@format = 'json';
|
|
5
|
+
attr :messages, true
|
|
6
|
+
attr :files, true
|
|
7
|
+
attr :premium, true
|
|
8
|
+
attr :accounts, true
|
|
9
|
+
attr :senders, true
|
|
10
|
+
attr :groups, true
|
|
11
|
+
attr :contacts, true
|
|
12
|
+
attr :phones, true
|
|
13
|
+
attr :subaccounts, true
|
|
14
|
+
attr :blacklist, true
|
|
15
|
+
attr :payments, true
|
|
16
|
+
attr :stats, true
|
|
17
|
+
attr :templates, true
|
|
18
|
+
attr :error, true
|
|
19
|
+
|
|
20
|
+
def initialize(username, password)
|
|
21
|
+
@username = username
|
|
22
|
+
@password = password
|
|
23
|
+
@messages = Messages.new(self)
|
|
24
|
+
@files = Files.new(self)
|
|
25
|
+
@premium = Premium.new(self)
|
|
26
|
+
@accounts = Accounts.new(self)
|
|
27
|
+
@senders = Senders.new(self)
|
|
28
|
+
@groups = Groups.new(self)
|
|
29
|
+
@contacts = Contacts.new(self)
|
|
30
|
+
@phones = Phones.new(self)
|
|
31
|
+
@subaccounts = Subaccounts.new(self)
|
|
32
|
+
@blacklist = Blacklist.new(self)
|
|
33
|
+
@payments = Payments.new(self)
|
|
34
|
+
@stats = Stats.new(self)
|
|
35
|
+
@templates = Templates.new(self)
|
|
36
|
+
@error = Error.new(self)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def call(url, params = {})
|
|
40
|
+
uri = URI.parse(@@api_url+url)
|
|
41
|
+
https = Net::HTTP.new(uri.host,uri.port)
|
|
42
|
+
req = Net::HTTP::Post.new(uri.path,{'Content-Type' => 'application/json'})
|
|
43
|
+
params['username'] = @username
|
|
44
|
+
params['password'] = @password
|
|
45
|
+
req.body = params.to_json
|
|
46
|
+
res = https.request(req)
|
|
47
|
+
|
|
48
|
+
return res.body
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
require 'net/http'
|
|
53
|
+
require 'net/https'
|
|
54
|
+
require 'json'
|
|
55
|
+
Dir[File.dirname(__FILE__) + '/library/*.rb'].each {|file| require file }
|
metadata
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: serwersms
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.2
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- SerwerSMS
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2016-01-28 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: ''
|
|
14
|
+
email:
|
|
15
|
+
- biuro@serwersms.pl
|
|
16
|
+
executables: []
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- lib/library/accounts.rb
|
|
21
|
+
- lib/library/blacklist.rb
|
|
22
|
+
- lib/library/contacts.rb
|
|
23
|
+
- lib/library/error.rb
|
|
24
|
+
- lib/library/files.rb
|
|
25
|
+
- lib/library/groups.rb
|
|
26
|
+
- lib/library/messages.rb
|
|
27
|
+
- lib/library/payments.rb
|
|
28
|
+
- lib/library/phones.rb
|
|
29
|
+
- lib/library/premium.rb
|
|
30
|
+
- lib/library/senders.rb
|
|
31
|
+
- lib/library/stats.rb
|
|
32
|
+
- lib/library/subaccounts.rb
|
|
33
|
+
- lib/library/templates.rb
|
|
34
|
+
- lib/serwersms.rb
|
|
35
|
+
homepage: https://github.com/SerwerSMSpl/
|
|
36
|
+
licenses:
|
|
37
|
+
- ''
|
|
38
|
+
metadata: {}
|
|
39
|
+
post_install_message:
|
|
40
|
+
rdoc_options: []
|
|
41
|
+
require_paths:
|
|
42
|
+
- lib
|
|
43
|
+
- lib/library
|
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
45
|
+
requirements:
|
|
46
|
+
- - ">="
|
|
47
|
+
- !ruby/object:Gem::Version
|
|
48
|
+
version: 1.9.2
|
|
49
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '0'
|
|
54
|
+
requirements: []
|
|
55
|
+
rubyforge_project:
|
|
56
|
+
rubygems_version: 2.2.5
|
|
57
|
+
signing_key:
|
|
58
|
+
specification_version: 4
|
|
59
|
+
summary: Ruby client for communication with the API v2 SerwerSMS.pl
|
|
60
|
+
test_files: []
|