serwersms 0.0.4 → 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 -57
  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
metadata CHANGED
@@ -1,60 +1,61 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serwersms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - SerwerSMS
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2016-09-21 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies: []
13
- description: ''
14
12
  email:
15
13
  - biuro@serwersms.pl
16
14
  executables: []
17
15
  extensions: []
18
16
  extra_rdoc_files: []
19
17
  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
18
  - lib/serwersms.rb
35
- homepage: https://github.com/SerwerSMSpl/
19
+ - lib/serwersms/client_credentials.rb
20
+ - lib/serwersms/client_factory.rb
21
+ - lib/serwersms/client_token.rb
22
+ - lib/serwersms/error.rb
23
+ - lib/serwersms/http/api_client.rb
24
+ - lib/serwersms/http/http_credentials.rb
25
+ - lib/serwersms/http/http_token.rb
26
+ - lib/serwersms/resources/accounts.rb
27
+ - lib/serwersms/resources/blacklist.rb
28
+ - lib/serwersms/resources/contacts.rb
29
+ - lib/serwersms/resources/error.rb
30
+ - lib/serwersms/resources/files.rb
31
+ - lib/serwersms/resources/groups.rb
32
+ - lib/serwersms/resources/messages.rb
33
+ - lib/serwersms/resources/phones.rb
34
+ - lib/serwersms/resources/premium.rb
35
+ - lib/serwersms/resources/senders.rb
36
+ - lib/serwersms/resources/stats.rb
37
+ - lib/serwersms/resources/subaccounts.rb
38
+ - lib/serwersms/resources/templates.rb
39
+ - lib/serwersms/resources_mixin.rb
40
+ homepage: https://github.com/SerwerSMSpl/serwersms-ruby-api
36
41
  licenses:
37
- - ''
42
+ - Apache-2.0
38
43
  metadata: {}
39
- post_install_message:
40
44
  rdoc_options: []
41
45
  require_paths:
42
46
  - lib
43
- - lib/library
44
47
  required_ruby_version: !ruby/object:Gem::Requirement
45
48
  requirements:
46
49
  - - ">="
47
50
  - !ruby/object:Gem::Version
48
- version: 1.9.2
51
+ version: '4.0'
49
52
  required_rubygems_version: !ruby/object:Gem::Requirement
50
53
  requirements:
51
54
  - - ">="
52
55
  - !ruby/object:Gem::Version
53
56
  version: '0'
54
57
  requirements: []
55
- rubyforge_project:
56
- rubygems_version: 2.5.2
57
- signing_key:
58
+ rubygems_version: 4.0.10
58
59
  specification_version: 4
59
- summary: Ruby client for communication with the API v2 SerwerSMS.pl
60
+ summary: Klient Ruby do komunikacji zdalnej z API v2 SerwerSMS.pl
60
61
  test_files: []
@@ -1,65 +0,0 @@
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
@@ -1,63 +0,0 @@
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
@@ -1,145 +0,0 @@
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'
data/lib/library/error.rb DELETED
@@ -1,19 +0,0 @@
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
data/lib/library/files.rb DELETED
@@ -1,74 +0,0 @@
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
@@ -1,103 +0,0 @@
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