onlyoffice_api 0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +7 -0
  2. data/lib/onlyoffice_api.rb +65 -0
  3. data/lib/teamlab/config.rb +39 -0
  4. data/lib/teamlab/modules/calendar.rb +111 -0
  5. data/lib/teamlab/modules/community.rb +20 -0
  6. data/lib/teamlab/modules/community/community_blogs.rb +54 -0
  7. data/lib/teamlab/modules/community/community_bookmarks.rb +60 -0
  8. data/lib/teamlab/modules/community/community_events.rb +50 -0
  9. data/lib/teamlab/modules/community/community_forums.rb +70 -0
  10. data/lib/teamlab/modules/community/community_wiki.rb +66 -0
  11. data/lib/teamlab/modules/crm.rb +32 -0
  12. data/lib/teamlab/modules/crm/crm_cases.rb +72 -0
  13. data/lib/teamlab/modules/crm/crm_common.rb +42 -0
  14. data/lib/teamlab/modules/crm/crm_contacts.rb +243 -0
  15. data/lib/teamlab/modules/crm/crm_files.rb +44 -0
  16. data/lib/teamlab/modules/crm/crm_history.rb +42 -0
  17. data/lib/teamlab/modules/crm/crm_invoices.rb +123 -0
  18. data/lib/teamlab/modules/crm/crm_opportunities.rb +93 -0
  19. data/lib/teamlab/modules/crm/crm_organisation.rb +14 -0
  20. data/lib/teamlab/modules/crm/crm_tags.rb +54 -0
  21. data/lib/teamlab/modules/crm/crm_tasks.rb +62 -0
  22. data/lib/teamlab/modules/crm/crm_user_fields.rb +34 -0
  23. data/lib/teamlab/modules/feed.rb +23 -0
  24. data/lib/teamlab/modules/files.rb +256 -0
  25. data/lib/teamlab/modules/group.rb +53 -0
  26. data/lib/teamlab/modules/group/group_helper.rb +15 -0
  27. data/lib/teamlab/modules/mail.rb +32 -0
  28. data/lib/teamlab/modules/mail/mail_accounts.rb +55 -0
  29. data/lib/teamlab/modules/mail/mail_alerts.rb +14 -0
  30. data/lib/teamlab/modules/mail/mail_contacts.rb +14 -0
  31. data/lib/teamlab/modules/mail/mail_conversations.rb +54 -0
  32. data/lib/teamlab/modules/mail/mail_folders.rb +18 -0
  33. data/lib/teamlab/modules/mail/mail_helpcenter.rb +10 -0
  34. data/lib/teamlab/modules/mail/mail_images.rb +18 -0
  35. data/lib/teamlab/modules/mail/mail_messages.rb +74 -0
  36. data/lib/teamlab/modules/mail/mail_settings.rb +17 -0
  37. data/lib/teamlab/modules/mail/mail_signature.rb +14 -0
  38. data/lib/teamlab/modules/mail/mail_tags.rb +30 -0
  39. data/lib/teamlab/modules/people.rb +104 -0
  40. data/lib/teamlab/modules/people/people_reassign.rb +26 -0
  41. data/lib/teamlab/modules/portals.rb +17 -0
  42. data/lib/teamlab/modules/project.rb +37 -0
  43. data/lib/teamlab/modules/projects/projects_comments.rb +34 -0
  44. data/lib/teamlab/modules/projects/projects_contacts.rb +18 -0
  45. data/lib/teamlab/modules/projects/projects_discussions.rb +46 -0
  46. data/lib/teamlab/modules/projects/projects_files.rb +34 -0
  47. data/lib/teamlab/modules/projects/projects_milestones.rb +46 -0
  48. data/lib/teamlab/modules/projects/projects_projects.rb +82 -0
  49. data/lib/teamlab/modules/projects/projects_reports.rb +18 -0
  50. data/lib/teamlab/modules/projects/projects_settings.rb +11 -0
  51. data/lib/teamlab/modules/projects/projects_tags.rb +18 -0
  52. data/lib/teamlab/modules/projects/projects_tasks.rb +94 -0
  53. data/lib/teamlab/modules/projects/projects_team.rb +30 -0
  54. data/lib/teamlab/modules/projects/projects_templates.rb +26 -0
  55. data/lib/teamlab/modules/projects/projects_time.rb +34 -0
  56. data/lib/teamlab/modules/settings.rb +100 -0
  57. data/lib/teamlab/name.rb +5 -0
  58. data/lib/teamlab/request.rb +79 -0
  59. data/lib/teamlab/response.rb +41 -0
  60. data/lib/teamlab/version.rb +5 -0
  61. metadata +140 -0
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Teamlab
4
+ # Methods for working with mail contacts
5
+ module MailContacts
6
+ def get_contact_list_for_auto_complete(term)
7
+ @request.get(%w[contacts], term: term)
8
+ end
9
+
10
+ def get_crm_linked_entities(message_id)
11
+ @request.get(%w[crm linked entities], messageId: message_id)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Teamlab
4
+ # Methods for working with mail conversations
5
+ module MailConversations
6
+ def get_filtered_conversations(options = {})
7
+ @request.get(%w[conversations], options)
8
+ end
9
+
10
+ def get_messages_linked_into_one_chain(message_id, load_all_content)
11
+ @request.get(['conversation', message_id.to_s], loadAllContent: load_all_content)
12
+ end
13
+
14
+ def get_previous_or_next_conversation_id(id, direction, options = {})
15
+ @request.get(['conversation', id.to_s, direction.to_s], options)
16
+ end
17
+
18
+ def chain_crm_linked_by_message?(message_id)
19
+ @request.get(%w[conversations link crm status], messageId: message_id)
20
+ end
21
+
22
+ def move_conversations_to_folder(folder_id, *message_ids)
23
+ @request.put(%w[conversations move], folderId: folder_id, ids: message_ids.flatten)
24
+ end
25
+
26
+ def set_conversations_status(status, *ids)
27
+ @request.put(%w[conversations mark], status: status, ids: ids.flatten)
28
+ end
29
+
30
+ def remove_conversations(*ids)
31
+ @request.put(%w[conversations remove], ids: ids.flatten)
32
+ end
33
+
34
+ def restore_conversations_to_folders(*ids)
35
+ @request.put(%w[conversations restore], ids: ids.flatten)
36
+ end
37
+
38
+ def mark_conversation_as_crm_linked(message_id, *crm_contact_ids)
39
+ @request.put(%w[conversations crm mark], messageId: message_id, crmContactIds: crm_contact_ids.flatten)
40
+ end
41
+
42
+ def unmark_conversation_link_with_crm(message_id, *crm_contact_ids)
43
+ @request.put(%w[conversations crm unmark], messageId: message_id, crmContactIds: crm_contact_ids.flatten)
44
+ end
45
+
46
+ def add_tag_to_conversations(tag_id, *conversation_ids)
47
+ @request.put(['conversations', 'tag', tag_id.to_s, 'set'], messages: conversation_ids.flatten)
48
+ end
49
+
50
+ def remove_tag_from_conversations(tag_id, *conversation_ids)
51
+ @request.put(['conversations', 'tag', tag_id.to_s, 'unset'], messages: conversation_ids.flatten)
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Teamlab
4
+ # Methods for working with mail folders
5
+ module MailFolders
6
+ def get_folders(options = {})
7
+ @request.get(%w[folders], options)
8
+ end
9
+
10
+ def get_folder_change_date(folder_id)
11
+ @request.get(['folders', folder_id.to_s, 'modify_date'])
12
+ end
13
+
14
+ def remove_all_messages_from_folder(folder_id)
15
+ @request.delete(['folders', folder_id.to_s, 'messages'])
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Teamlab
4
+ # Methods for working with mail helpcenter
5
+ module MailHelpCenter
6
+ def get_html_of_help_center
7
+ @request.get(%w[helpcenter])
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Teamlab
4
+ # Methods for working with mail images
5
+ module MailImages
6
+ def get_trusted_addresses
7
+ @request.get(%w[display_images addresses])
8
+ end
9
+
10
+ def add_trusted_address(address)
11
+ @request.post(%w[display_images addresses], addres: address)
12
+ end
13
+
14
+ def remove_from_trusted_addresses(address)
15
+ @request.delete(%w[display_images addresses], addres: address)
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,74 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Teamlab
4
+ # Methods for working with mail messages
5
+ module MailMessages
6
+ def get_filtered_messages(page, options = {})
7
+ @request.get(%w[messages], { page: page }.merge(options))
8
+ end
9
+
10
+ def get_message(id, options = {})
11
+ @request.get(['messages', id.to_s], options)
12
+ end
13
+
14
+ def get_message_template
15
+ @request.get(%w[messages template])
16
+ end
17
+
18
+ def get_message_modify_date
19
+ @request.get(%w[messages modify_date])
20
+ end
21
+
22
+ def get_previous_or_next_message_id(id, direction, options = {})
23
+ @request.get(['messages', id.to_s, direction.to_s], options)
24
+ end
25
+
26
+ def set_message_crm_status(emails, *user_ids)
27
+ @request.post(%w[messages update_crm], emails: emails, userIds: user_ids.flatten)
28
+ end
29
+
30
+ def attach_teamlab_document(message_id, file_id, options = {})
31
+ @request.post(['messages', message_id.to_s, 'document'], { fileId: file_id }.merge(options))
32
+ end
33
+
34
+ def set_message_status(status, *ids)
35
+ @request.put(%w[messages mark], status: status, ids: ids.flatten)
36
+ end
37
+
38
+ def move_messages_to_folder(folder_id, *message_ids)
39
+ @request.put(%w[,essages move], folderId: folder_id, ids: message_ids.flatten)
40
+ end
41
+
42
+ def send_message(id, options = {})
43
+ @request.put(%w[messages send], { id: id }.merge(options))
44
+ end
45
+
46
+ def save_message(id, options = {})
47
+ @request.put(%w[messages save], { id: id }.merge(options))
48
+ end
49
+
50
+ def remove_messages(*ids)
51
+ @request.put(%w[messages remove], ids: ids.flatten)
52
+ end
53
+
54
+ def restore_message_to_folders
55
+ @request.put(%w[messages restore])
56
+ end
57
+
58
+ def export_mail_to_crm_relations_history(message_id, *crm_contact_ids)
59
+ @request.put(%w[messages crm export], messageId: message_id, crmContactIds: crm_contact_ids.flatten)
60
+ end
61
+
62
+ def export_attachments_to_my_docs(attachment_id)
63
+ @request.put(%w[attachment mydocuments export], attachmentId: attachment_id)
64
+ end
65
+
66
+ def export_all_message_attachments_to_my_docs(message_id)
67
+ @request.put(%w[attachments mydocuments export], messageId: message_id)
68
+ end
69
+
70
+ def delete_attachment_from_message(message_id, attachment_id)
71
+ @request.delete(['messages', message_id.to_s, 'attachments', attachment_id.to_s])
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Teamlab
4
+ # Methods for working with mail settings
5
+ module MailSettings
6
+ # @param enabled [True, False] set value of always display image
7
+ # @return [Void]
8
+ def set_always_display_images(enabled = true)
9
+ @request.put(%w[settings alwaysDisplayImages], enabled: enabled.to_s)
10
+ end
11
+
12
+ # @return [True, False] get value of flag for dispay images
13
+ def always_display_images
14
+ @request.get(%w[settings alwaysDisplayImages])
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Teamlab
4
+ # Methods for working with mail signatures
5
+ module MailSignature
6
+ def get_meail_signature(mailbox_id)
7
+ @request.get(['signature', mailbox_id.to_s])
8
+ end
9
+
10
+ def update_signature(mailbox_id, html, options = {})
11
+ @request.post(['signature', 'update', mailbox_id.to_s], { html: html }.merge(options))
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Teamlab
4
+ # Methods for working with mail tags
5
+ module MailTags
6
+ def get_tag_list
7
+ @request.get(%w[tags])
8
+ end
9
+
10
+ def create_tag(name, options = {})
11
+ @request.post(%w[tags], { name: name }.merge(options))
12
+ end
13
+
14
+ def update_tag(id, name, options = {})
15
+ @request.put(['tags', id.to_s], { name: name }.merge(options))
16
+ end
17
+
18
+ def set_tag_to_messages(id, *message_ids)
19
+ @request.put(['tags', id.to_s, 'set'], messages: message_ids.flatten)
20
+ end
21
+
22
+ def remove_tag_from_messages(id, *message_ids)
23
+ @request.put(['tags', id.to_s, 'remove'], messages: message_ids.flatten)
24
+ end
25
+
26
+ def delete_tag(id)
27
+ @request.delete(['tags', id.to_s])
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,104 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'people/people_reassign'
4
+ module Teamlab
5
+ class People
6
+ include PeopleReassign
7
+
8
+ def initialize
9
+ @request = Teamlab::Request.new('people')
10
+ end
11
+
12
+ def get_people
13
+ @request.get
14
+ end
15
+
16
+ def get_self
17
+ @request.get(['@self'])
18
+ end
19
+
20
+ def search_people(query)
21
+ @request.get(['search'], query: query)
22
+ end
23
+
24
+ def filter_people(filters)
25
+ @request.get(['filter'], filters)
26
+ end
27
+
28
+ def get_user_by_username(username)
29
+ @request.get([username.to_s])
30
+ end
31
+
32
+ def get_people_by_status(status)
33
+ @request.get(['status', status])
34
+ end
35
+
36
+ def get_people_by_search_query(query)
37
+ @request.get(['@search', query])
38
+ end
39
+
40
+ def search_with_status(status, query)
41
+ @request.get(['status', status.to_s, 'search'], query: query.to_s)
42
+ end
43
+
44
+ def add_user(is_visitor, email, firstname, lastname, options = {})
45
+ @request.post(nil, { isVisitor: is_visitor, email: email, firstname: firstname, lastname: lastname }.merge(options))
46
+ end
47
+
48
+ def active(options = {})
49
+ @request.post(['active'], options) # TODO: need some fixing
50
+ end
51
+
52
+ def update_contacts(user_id, contacts = {})
53
+ @request.post([user_id, 'contacts'], contacts)
54
+ end
55
+
56
+ def send_invite(*user_ids)
57
+ @request.put(['invite'], userIds: user_ids.flatten)
58
+ end
59
+
60
+ def delete(*user_ids)
61
+ @request.put(['delete'], userIds: user_ids.flatten)
62
+ end
63
+
64
+ def update_user(user_id, is_visitor, email, firstname, lastname, options = {})
65
+ @request.put([user_id.to_s], { isVisitor: is_visitor, email: email, firstname: firstname, lastname: lastname }.merge(options))
66
+ end
67
+
68
+ def change_people_type(type, user_ids)
69
+ @request.put(['type', type.to_s], userIds: user_ids)
70
+ end
71
+
72
+ def update_photo(user_id, path)
73
+ @request.put([user_id.to_s, 'photo'], files: path)
74
+ end
75
+
76
+ def change_people_status(status, user_ids)
77
+ @request.put(['status', status], userIds: user_ids)
78
+ end
79
+
80
+ def add_contacts(contacts, user_id)
81
+ @request.put([user_id, 'contacts'], contacts: contacts)
82
+ end
83
+
84
+ def link_account(profile)
85
+ @request.put([%w[thirdparty linkaccount]], serializedProfile: profile)
86
+ end
87
+
88
+ def delete_user(user_id)
89
+ @request.delete([user_id])
90
+ end
91
+
92
+ def delete_photo(user_id)
93
+ @request.delete([user_id, 'photo'])
94
+ end
95
+
96
+ def delete_contacts(user_id, contacts)
97
+ @request.delete([user_id, 'contacts'], contacts: contacts)
98
+ end
99
+
100
+ def unlink_account(provider)
101
+ @request.delete([%w[thirdparty unlinkaccount]], provider: provider)
102
+ end
103
+ end
104
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Teamlab
4
+ # Module for people reassign data
5
+ module PeopleReassign
6
+ # Start a reassign process
7
+ # @param from_user_id [String] guid of user from whom reassign
8
+ # @param to_user_id [String] guid of user to whom reassign
9
+ # @param delete_profile [True, False] Delete profile when reassignment will be finished
10
+ def start_reassign_user_data(from_user_id, to_user_id, delete_profile = true)
11
+ @request.post(%w[reassign start], fromUserId: from_user_id, toUserId: to_user_id, deleteProfile: delete_profile)
12
+ end
13
+
14
+ # Returns the progress of the started reassign process
15
+ # @param from_user_id [String] User ID (guid) whose data is reassigned
16
+ def get_reassign_progress(from_user_id)
17
+ @request.get(%w[reassign progress], userId: from_user_id)
18
+ end
19
+
20
+ # Terminate reassign process
21
+ # @param user_id [String] User ID (guid) whose data is reassigned
22
+ def terminate_reassign(user_id)
23
+ @request.put(%w[reassign terminate], userId: user_id)
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Teamlab
4
+ class Portal
5
+ def initialize
6
+ @request = Teamlab::Request.new('portal')
7
+ end
8
+
9
+ def invite_user_url
10
+ @request.get(%w[users invite user])
11
+ end
12
+
13
+ def invite_visitor_url
14
+ @request.get(%w[users invite visitor])
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'projects/projects_comments'
4
+ require_relative 'projects/projects_contacts'
5
+ require_relative 'projects/projects_discussions'
6
+ require_relative 'projects/projects_files'
7
+ require_relative 'projects/projects_milestones'
8
+ require_relative 'projects/projects_projects'
9
+ require_relative 'projects/projects_reports'
10
+ require_relative 'projects/projects_settings'
11
+ require_relative 'projects/projects_tags'
12
+ require_relative 'projects/projects_tasks'
13
+ require_relative 'projects/projects_team'
14
+ require_relative 'projects/projects_templates'
15
+ require_relative 'projects/projects_time'
16
+
17
+ module Teamlab
18
+ class Project
19
+ include ProjectsComments
20
+ include ProjectsContacts
21
+ include ProjectsDiscussions
22
+ include ProjectsFiles
23
+ include ProjectsMilestones
24
+ include ProjectsProjects
25
+ include ProjectsReports
26
+ include ProjectsSettings
27
+ include ProjectsTags
28
+ include ProjectsTasks
29
+ include ProjectsTeam
30
+ include ProjectsTemplates
31
+ include ProjectsTime
32
+
33
+ def initialize
34
+ @request = Teamlab::Request.new('project')
35
+ end
36
+ end
37
+ end