onlyoffice_api 0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/onlyoffice_api.rb +65 -0
- data/lib/teamlab/config.rb +39 -0
- data/lib/teamlab/modules/calendar.rb +111 -0
- data/lib/teamlab/modules/community.rb +20 -0
- data/lib/teamlab/modules/community/community_blogs.rb +54 -0
- data/lib/teamlab/modules/community/community_bookmarks.rb +60 -0
- data/lib/teamlab/modules/community/community_events.rb +50 -0
- data/lib/teamlab/modules/community/community_forums.rb +70 -0
- data/lib/teamlab/modules/community/community_wiki.rb +66 -0
- data/lib/teamlab/modules/crm.rb +32 -0
- data/lib/teamlab/modules/crm/crm_cases.rb +72 -0
- data/lib/teamlab/modules/crm/crm_common.rb +42 -0
- data/lib/teamlab/modules/crm/crm_contacts.rb +243 -0
- data/lib/teamlab/modules/crm/crm_files.rb +44 -0
- data/lib/teamlab/modules/crm/crm_history.rb +42 -0
- data/lib/teamlab/modules/crm/crm_invoices.rb +123 -0
- data/lib/teamlab/modules/crm/crm_opportunities.rb +93 -0
- data/lib/teamlab/modules/crm/crm_organisation.rb +14 -0
- data/lib/teamlab/modules/crm/crm_tags.rb +54 -0
- data/lib/teamlab/modules/crm/crm_tasks.rb +62 -0
- data/lib/teamlab/modules/crm/crm_user_fields.rb +34 -0
- data/lib/teamlab/modules/feed.rb +23 -0
- data/lib/teamlab/modules/files.rb +256 -0
- data/lib/teamlab/modules/group.rb +53 -0
- data/lib/teamlab/modules/group/group_helper.rb +15 -0
- data/lib/teamlab/modules/mail.rb +32 -0
- data/lib/teamlab/modules/mail/mail_accounts.rb +55 -0
- data/lib/teamlab/modules/mail/mail_alerts.rb +14 -0
- data/lib/teamlab/modules/mail/mail_contacts.rb +14 -0
- data/lib/teamlab/modules/mail/mail_conversations.rb +54 -0
- data/lib/teamlab/modules/mail/mail_folders.rb +18 -0
- data/lib/teamlab/modules/mail/mail_helpcenter.rb +10 -0
- data/lib/teamlab/modules/mail/mail_images.rb +18 -0
- data/lib/teamlab/modules/mail/mail_messages.rb +74 -0
- data/lib/teamlab/modules/mail/mail_settings.rb +17 -0
- data/lib/teamlab/modules/mail/mail_signature.rb +14 -0
- data/lib/teamlab/modules/mail/mail_tags.rb +30 -0
- data/lib/teamlab/modules/people.rb +104 -0
- data/lib/teamlab/modules/people/people_reassign.rb +26 -0
- data/lib/teamlab/modules/portals.rb +17 -0
- data/lib/teamlab/modules/project.rb +37 -0
- data/lib/teamlab/modules/projects/projects_comments.rb +34 -0
- data/lib/teamlab/modules/projects/projects_contacts.rb +18 -0
- data/lib/teamlab/modules/projects/projects_discussions.rb +46 -0
- data/lib/teamlab/modules/projects/projects_files.rb +34 -0
- data/lib/teamlab/modules/projects/projects_milestones.rb +46 -0
- data/lib/teamlab/modules/projects/projects_projects.rb +82 -0
- data/lib/teamlab/modules/projects/projects_reports.rb +18 -0
- data/lib/teamlab/modules/projects/projects_settings.rb +11 -0
- data/lib/teamlab/modules/projects/projects_tags.rb +18 -0
- data/lib/teamlab/modules/projects/projects_tasks.rb +94 -0
- data/lib/teamlab/modules/projects/projects_team.rb +30 -0
- data/lib/teamlab/modules/projects/projects_templates.rb +26 -0
- data/lib/teamlab/modules/projects/projects_time.rb +34 -0
- data/lib/teamlab/modules/settings.rb +100 -0
- data/lib/teamlab/name.rb +5 -0
- data/lib/teamlab/request.rb +79 -0
- data/lib/teamlab/response.rb +41 -0
- data/lib/teamlab/version.rb +5 -0
- metadata +140 -0
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Teamlab
|
4
|
+
class Feed
|
5
|
+
def initialize
|
6
|
+
@request = Teamlab::Request.new('feed')
|
7
|
+
end
|
8
|
+
|
9
|
+
# TODO: find out how it should work api.onlyoffice.com missing documentation
|
10
|
+
def filter_feed(filters)
|
11
|
+
@request.get(['filter'], filters)
|
12
|
+
end
|
13
|
+
|
14
|
+
def new_feeds_count
|
15
|
+
@request.get(['newfeedscount'])
|
16
|
+
end
|
17
|
+
|
18
|
+
# TODO: find out how it should work api.onlyoffice.com missing documentation
|
19
|
+
def read_feed
|
20
|
+
@request.put(['read'])
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,256 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Teamlab
|
4
|
+
class Files
|
5
|
+
def initialize
|
6
|
+
@request = Teamlab::Request.new('files')
|
7
|
+
end
|
8
|
+
|
9
|
+
# region File Creation
|
10
|
+
|
11
|
+
def create_txt_in_my_docs(title, content)
|
12
|
+
@request.post(%w[@my text], title: title.to_s, content: content.to_s)
|
13
|
+
end
|
14
|
+
|
15
|
+
def create_html_in_my_docs(title, content)
|
16
|
+
@request.post(%w[@my html], title: title.to_s, content: content.to_s)
|
17
|
+
end
|
18
|
+
|
19
|
+
def create_txt_in_common_docs(title, content)
|
20
|
+
@request.post(%w[@common text], title: title.to_s, content: content.to_s)
|
21
|
+
end
|
22
|
+
|
23
|
+
def create_html_in_common_docs(title, content)
|
24
|
+
@request.post(%w[@common html], title: title.to_s, content: content.to_s)
|
25
|
+
end
|
26
|
+
|
27
|
+
def create_txt(folder_id, title, content)
|
28
|
+
@request.post([folder_id.to_s, 'text'], title: title.to_s, content: content.to_s)
|
29
|
+
end
|
30
|
+
|
31
|
+
def create_html(folder_id, title, content)
|
32
|
+
@request.post([folder_id.to_s, 'html'], title: title.to_s, content: content.to_s)
|
33
|
+
end
|
34
|
+
|
35
|
+
def create_file(folder_id, title)
|
36
|
+
@request.post([folder_id.to_s, 'file'], title: title.to_s)
|
37
|
+
end
|
38
|
+
|
39
|
+
# endregion
|
40
|
+
|
41
|
+
# region File operations
|
42
|
+
|
43
|
+
def get_file_operations_list
|
44
|
+
@request.get(%w[fileops])
|
45
|
+
end
|
46
|
+
|
47
|
+
def check_conflict(options = {})
|
48
|
+
@request.get(%w[fileops move], options)
|
49
|
+
end
|
50
|
+
|
51
|
+
def check_conversion_status(fileid)
|
52
|
+
@request.get(['file', fileid.to_s, 'checkconversion'])
|
53
|
+
end
|
54
|
+
|
55
|
+
def move_to_folder(dest_folder_id, options = {})
|
56
|
+
@request.put(%w[fileops move], { destFolderId: dest_folder_id }.merge(options))
|
57
|
+
end
|
58
|
+
alias move_files move_to_folder
|
59
|
+
|
60
|
+
def copy_to_folder(dest_folder_id, options = {})
|
61
|
+
@request.put(%w[fileops copy], { destFolderId: dest_folder_id }.merge(options))
|
62
|
+
end
|
63
|
+
|
64
|
+
def delete(options = {})
|
65
|
+
@request.put(%w[fileops delete], options)
|
66
|
+
end
|
67
|
+
|
68
|
+
def finish_all
|
69
|
+
@request.put(%w[fileops terminate])
|
70
|
+
end
|
71
|
+
|
72
|
+
def mark_as_read
|
73
|
+
@request.put(%w[fileops markasread])
|
74
|
+
end
|
75
|
+
|
76
|
+
def clear_recycle_bin
|
77
|
+
@request.put(%w[fileops emptytrash])
|
78
|
+
end
|
79
|
+
|
80
|
+
def finish_operations(options = {})
|
81
|
+
@request.put(%w[fileops bulkdownload], options)
|
82
|
+
end
|
83
|
+
|
84
|
+
def start_conversion(file_id, start)
|
85
|
+
@request.put(['file', file_id.to_s, 'checkconversion'], start: start)
|
86
|
+
end
|
87
|
+
|
88
|
+
# endregion
|
89
|
+
|
90
|
+
# region Files
|
91
|
+
|
92
|
+
def get_file_info(file_id)
|
93
|
+
@request.get(['file', file_id.to_s])
|
94
|
+
end
|
95
|
+
|
96
|
+
def get_file_history(file_id)
|
97
|
+
@request.get(['file', file_id.to_s, 'history'])
|
98
|
+
end
|
99
|
+
|
100
|
+
def update_file_history(file_id, version, continue_version = false)
|
101
|
+
@request.put(['file', file_id.to_s, 'history'], version: version, continueVersion: continue_version)
|
102
|
+
end
|
103
|
+
|
104
|
+
def update_file_info(file_id, title, last_version)
|
105
|
+
@request.put(['file', file_id.to_s], title: title, lastVersion: last_version)
|
106
|
+
end
|
107
|
+
|
108
|
+
def delete_file(file_id)
|
109
|
+
@request.delete(['file', file_id.to_s])
|
110
|
+
end
|
111
|
+
|
112
|
+
# endregion
|
113
|
+
|
114
|
+
# region Folders
|
115
|
+
|
116
|
+
def get_my_docs(params = {})
|
117
|
+
@request.get(['@my'], params)
|
118
|
+
end
|
119
|
+
alias get_my_files get_my_docs
|
120
|
+
|
121
|
+
def get_shared_docs(params = {})
|
122
|
+
@request.get(['@share'], params)
|
123
|
+
end
|
124
|
+
|
125
|
+
def get_trash(params = {})
|
126
|
+
@request.get(['@trash'], params)
|
127
|
+
end
|
128
|
+
|
129
|
+
def get_common_docs(params = {})
|
130
|
+
@request.get(['@common'], params)
|
131
|
+
end
|
132
|
+
|
133
|
+
def get_projects_folder(params = {})
|
134
|
+
@request.get(['@projects'], params)
|
135
|
+
end
|
136
|
+
|
137
|
+
def get_folder(folder_id, options = {})
|
138
|
+
@request.get([folder_id.to_s], options)
|
139
|
+
end
|
140
|
+
|
141
|
+
def get_folder_info(folder_id)
|
142
|
+
@request.get(['folder', folder_id.to_s])
|
143
|
+
end
|
144
|
+
|
145
|
+
def get_folder_path(folder_id)
|
146
|
+
@request.get(['folder', folder_id.to_s, 'path'])
|
147
|
+
end
|
148
|
+
|
149
|
+
def new_folder(folder_id, title)
|
150
|
+
@request.post(['folder', folder_id.to_s], title: title)
|
151
|
+
end
|
152
|
+
|
153
|
+
def rename_folder(folder_id, title)
|
154
|
+
@request.put(['folder', folder_id.to_s], title: title)
|
155
|
+
end
|
156
|
+
|
157
|
+
def delete_folder(folder_id)
|
158
|
+
@request.delete(['folder', folder_id.to_s])
|
159
|
+
end
|
160
|
+
|
161
|
+
# endregion
|
162
|
+
|
163
|
+
# region Sharing
|
164
|
+
|
165
|
+
def get_file_sharing(file_id)
|
166
|
+
@request.get(['file', file_id.to_s, 'share'])
|
167
|
+
end
|
168
|
+
|
169
|
+
def get_folder_sharing(folder_id)
|
170
|
+
@request.get(['folder', folder_id.to_s, 'share'])
|
171
|
+
end
|
172
|
+
|
173
|
+
def share_file(file_id, user_id, access_type, options = {})
|
174
|
+
@request.put(['file', file_id.to_s, 'share'], { share: { shareTo: user_id, Access: access_type } }.merge(options))
|
175
|
+
end
|
176
|
+
|
177
|
+
def share_folder(folder_id, user_id, access_type, options = {})
|
178
|
+
@request.put(['folder', folder_id.to_s, 'share'], { share: { shareTo: user_id, Access: access_type } }.merge(options))
|
179
|
+
end
|
180
|
+
|
181
|
+
def removes_sharing_rights(options = {})
|
182
|
+
@request.delete(['share'], options)
|
183
|
+
end
|
184
|
+
|
185
|
+
# endregion
|
186
|
+
|
187
|
+
# region Third-Party Integration
|
188
|
+
|
189
|
+
def get_third_party
|
190
|
+
@request.get(%w[thirdparty])
|
191
|
+
end
|
192
|
+
|
193
|
+
def save_third_party(options = {})
|
194
|
+
@request.post(%w[thirdparty], options)
|
195
|
+
end
|
196
|
+
|
197
|
+
def remove_third_party_account(provider_id)
|
198
|
+
@request.delete(['thirdparty', provider_id.to_s])
|
199
|
+
end
|
200
|
+
|
201
|
+
# endregion
|
202
|
+
|
203
|
+
# region Uploads
|
204
|
+
|
205
|
+
def upload_to_my_docs(file)
|
206
|
+
@request.post(%w[@my upload], somefile: File.new(file))
|
207
|
+
end
|
208
|
+
|
209
|
+
# @param create_new_if_exists [Boolean] create new file if same name file already exists
|
210
|
+
def insert_to_my_docs(file, title: File.basename(file), keep_convert_status: false, create_new_if_exists: nil)
|
211
|
+
@request.post(%w[@my insert],
|
212
|
+
file: File.new(file),
|
213
|
+
title: title,
|
214
|
+
keepConvertStatus: keep_convert_status,
|
215
|
+
createNewIfExist: create_new_if_exists)
|
216
|
+
end
|
217
|
+
|
218
|
+
def upload_to_common_docs(file)
|
219
|
+
@request.post(%w[@common upload], somefile: File.new(file))
|
220
|
+
end
|
221
|
+
|
222
|
+
def insert_to_common_docs(file, title: File.basename(file), keep_convert_status: false)
|
223
|
+
@request.post(%w[@common insert], file: File.new(file), title: title, keepConvertStatus: keep_convert_status)
|
224
|
+
end
|
225
|
+
|
226
|
+
def upload_to_folder(folder_id, file)
|
227
|
+
@request.post([folder_id.to_s, 'upload'], somefile: File.new(file))
|
228
|
+
end
|
229
|
+
|
230
|
+
def insert_file(folder_id, file, title: File.basename(file), keep_convert_status: false)
|
231
|
+
@request.post([folder_id.to_s, 'insert'], file: File.new(file), title: title, keepConvertStatus: keep_convert_status)
|
232
|
+
end
|
233
|
+
|
234
|
+
def chunked_upload(folder_id, filename, file_size)
|
235
|
+
@request.post([folder_id.to_s, 'upload', 'create_session'], fileName: filename, fileSize: file_size)
|
236
|
+
end
|
237
|
+
|
238
|
+
# endregion
|
239
|
+
|
240
|
+
def search(query)
|
241
|
+
@request.get(['@search', query.to_s])
|
242
|
+
end
|
243
|
+
|
244
|
+
def generate_shared_link(file_id, share)
|
245
|
+
@request.put([file_id.to_s, 'sharedlink'], share: share)
|
246
|
+
end
|
247
|
+
|
248
|
+
def document_server_info
|
249
|
+
@request.get(%w[docservice])
|
250
|
+
end
|
251
|
+
|
252
|
+
def check_overwrite(set_value = true)
|
253
|
+
@request.put(%w[updateifexist], set: set_value)
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'group/group_helper'
|
4
|
+
|
5
|
+
module Teamlab
|
6
|
+
class Group
|
7
|
+
include GroupHelper
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
@request = Teamlab::Request.new('group')
|
11
|
+
end
|
12
|
+
|
13
|
+
def get_groups
|
14
|
+
@request.get
|
15
|
+
end
|
16
|
+
|
17
|
+
def get_group(group_id)
|
18
|
+
@request.get([group_id.to_s])
|
19
|
+
end
|
20
|
+
|
21
|
+
def add_group(manager, name, members = [])
|
22
|
+
@request.post('', groupManager: manager, groupName: name, members: members)
|
23
|
+
end
|
24
|
+
|
25
|
+
def replace_members(group_id, members)
|
26
|
+
@request.post([group_id.to_s, 'members'], members: members)
|
27
|
+
end
|
28
|
+
|
29
|
+
def update_group(group_id, options = {})
|
30
|
+
@request.put([group_id.to_s], options)
|
31
|
+
end
|
32
|
+
|
33
|
+
def add_group_users(group_id, members = [])
|
34
|
+
@request.put([group_id.to_s, 'members'], members: members)
|
35
|
+
end
|
36
|
+
|
37
|
+
def set_group_manager(group_id, user_id)
|
38
|
+
@request.put([group_id.to_s, 'manager'], userid: user_id)
|
39
|
+
end
|
40
|
+
|
41
|
+
def move_group_members(group_id, new_group_id)
|
42
|
+
@request.put([group_id.to_s, 'members', new_group_id.to_s])
|
43
|
+
end
|
44
|
+
|
45
|
+
def delete_group(group_id)
|
46
|
+
@request.delete([group_id.to_s])
|
47
|
+
end
|
48
|
+
|
49
|
+
def remove_group_members(group_id, members = [])
|
50
|
+
@request.delete([group_id.to_s, 'members'], members: members)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Teamlab
|
4
|
+
# Helper to store methods for working with groups
|
5
|
+
module GroupHelper
|
6
|
+
# @param name [String] group info
|
7
|
+
# @return [Hash] info about that group
|
8
|
+
def info_by_name(name)
|
9
|
+
get_groups.data.each do |group|
|
10
|
+
return group if group['name'] == name
|
11
|
+
end
|
12
|
+
nil
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'mail/mail_accounts'
|
4
|
+
require_relative 'mail/mail_alerts'
|
5
|
+
require_relative 'mail/mail_contacts'
|
6
|
+
require_relative 'mail/mail_conversations'
|
7
|
+
require_relative 'mail/mail_folders'
|
8
|
+
require_relative 'mail/mail_helpcenter'
|
9
|
+
require_relative 'mail/mail_images'
|
10
|
+
require_relative 'mail/mail_messages'
|
11
|
+
require_relative 'mail/mail_settings'
|
12
|
+
require_relative 'mail/mail_signature'
|
13
|
+
require_relative 'mail/mail_tags'
|
14
|
+
module Teamlab
|
15
|
+
class Mail
|
16
|
+
include MailAccounts
|
17
|
+
include MailAlerts
|
18
|
+
include MailContacts
|
19
|
+
include MailConversations
|
20
|
+
include MailFolders
|
21
|
+
include MailHelpCenter
|
22
|
+
include MailImages
|
23
|
+
include MailMessages
|
24
|
+
include MailSignature
|
25
|
+
include MailSettings
|
26
|
+
include MailTags
|
27
|
+
|
28
|
+
def initialize
|
29
|
+
@request = Teamlab::Request.new('mail')
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Teamlab
|
4
|
+
# Methods for working with mail accounts
|
5
|
+
module MailAccounts
|
6
|
+
def get_account_list
|
7
|
+
@request.get(%w[accounts])
|
8
|
+
end
|
9
|
+
|
10
|
+
def get_account_by_email(email)
|
11
|
+
@request.get(['accounts', email.to_s])
|
12
|
+
end
|
13
|
+
|
14
|
+
def get_default_account_settings(email, options = {})
|
15
|
+
@request.get(['accounts', email.to_s, 'default'], options)
|
16
|
+
end
|
17
|
+
|
18
|
+
def create_account_with_custom_mail_service(name, email, account, password, options = {})
|
19
|
+
@request.post(%w[accounts], { name: name, email: email, account: account, password: password }.merge(options))
|
20
|
+
end
|
21
|
+
|
22
|
+
def create_oauth_account(email, token, options = {})
|
23
|
+
@request.post(%w[accounts oauth], { email: email, token: token }.merge(options))
|
24
|
+
end
|
25
|
+
|
26
|
+
def create_account_by_email(email, password)
|
27
|
+
@request.post(%w[accounts simple], email: email, password: password)
|
28
|
+
end
|
29
|
+
|
30
|
+
def update_account(name, email, password, options = {})
|
31
|
+
@request.put(%w[accounts], { name: name, email: email, password: password }.merge(options))
|
32
|
+
end
|
33
|
+
|
34
|
+
def set_account_state(email, state)
|
35
|
+
@request.put(['accounts', email.to_s, 'state'], state: state)
|
36
|
+
end
|
37
|
+
|
38
|
+
def set_account_state_by_mailbox(mailbox_id, email_in_folder)
|
39
|
+
@request.put(['accounts', mailbox_id.to_s, 'emailinfolder'], emailInFolder: email_in_folder)
|
40
|
+
end
|
41
|
+
|
42
|
+
# Sets the default account specified in the request
|
43
|
+
# @param email [String] email of account
|
44
|
+
# @param is_default [Boolean] Set or reset account as default
|
45
|
+
def set_default_account(email, is_default)
|
46
|
+
@request.put(%w[accounts default], email: email, isDefault: is_default)
|
47
|
+
end
|
48
|
+
|
49
|
+
def delete_account(email)
|
50
|
+
@request.delete(['accounts', email.to_s])
|
51
|
+
rescue StandardError
|
52
|
+
@request.delete(['accounts'], email: email.to_s) # for version 8.7
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Teamlab
|
4
|
+
# Methods for working with mail alerts
|
5
|
+
module MailAlerts
|
6
|
+
def get_alerts_list
|
7
|
+
@request.get('alert')
|
8
|
+
end
|
9
|
+
|
10
|
+
def delete_alert_by_id(id)
|
11
|
+
@request.delete(['alert', id.to_s])
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|