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,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Teamlab
4
+ # Methods for working with community wikis
5
+ module CommunityWiki
6
+ def get_wiki_pages
7
+ @request.get(%w[wiki])
8
+ end
9
+
10
+ def get_wiki_page(name, options = {})
11
+ @request.get(['wiki', name], options)
12
+ end
13
+
14
+ def get_wiki_file_info(name)
15
+ @request.get(['wiki', 'file', name.to_s])
16
+ end
17
+
18
+ def get_page_history(name)
19
+ @request.get(['wiki', name.to_s, 'story'])
20
+ end
21
+
22
+ def get_all_page_comments(page_name)
23
+ @request.get(['wiki', page_name.to_s, 'comment'])
24
+ end
25
+
26
+ def search_wiki_pages_by_name(name)
27
+ @request.get(['wiki', 'search', 'byname', name.to_s])
28
+ end
29
+
30
+ def search_wiki_pages_by_content(content)
31
+ @request.get(['wiki', 'search', 'bycontent', content.to_s])
32
+ end
33
+
34
+ def create_page(name, body)
35
+ @request.post(%w[wiki], name: name.to_s, body: body.to_s)
36
+ end
37
+
38
+ def upload_files(file)
39
+ @request.post(%w[wiki file], somefile: File.new(file))
40
+ end
41
+
42
+ def create_wiki_page_comment(page_name, content, options = {})
43
+ @request.post(['wiki', page_name.to_s, 'comment'], { content: content.to_s }.merge(options))
44
+ end
45
+
46
+ def update_wiki_page(name, body)
47
+ @request.put(['wiki', name.to_s], body: body.to_s)
48
+ end
49
+
50
+ def update_wiki_page_comment(comment_id, body)
51
+ @request.put(['wiki', 'comment', comment_id.to_s], content: body)
52
+ end
53
+
54
+ def delete_wiki_page(name)
55
+ @request.delete(['wiki', name.to_s])
56
+ end
57
+
58
+ def delete_wiki_file(name)
59
+ @request.delete(['wiki', 'file', name.to_s])
60
+ end
61
+
62
+ def delete_wiki_page_comment(id)
63
+ @request.delete(['wiki', 'comment', id.to_s])
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'crm/crm_cases'
4
+ require_relative 'crm/crm_common'
5
+ require_relative 'crm/crm_contacts'
6
+ require_relative 'crm/crm_files'
7
+ require_relative 'crm/crm_history'
8
+ require_relative 'crm/crm_invoices'
9
+ require_relative 'crm/crm_opportunities'
10
+ require_relative 'crm/crm_organisation'
11
+ require_relative 'crm/crm_tags'
12
+ require_relative 'crm/crm_tasks'
13
+ require_relative 'crm/crm_user_fields'
14
+ module Teamlab
15
+ class Crm
16
+ include CrmCases
17
+ include CrmCommon
18
+ include CrmContacts
19
+ include CrmFiles
20
+ include CrmHistory
21
+ include CrmInvoices
22
+ include CrmOpportunities
23
+ include CrmOrganisation
24
+ include CrmTags
25
+ include CrmTasks
26
+ include CrmUserFields
27
+
28
+ def initialize
29
+ @request = Teamlab::Request.new('crm')
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Teamlab
4
+ # Methods for working with crm cases
5
+ module CrmCases
6
+ def get_cases_by_prefix(contact_id, prefix)
7
+ @request.get(%w[case byprefix], contactId: contact_id, prefix: prefix)
8
+ end
9
+
10
+ def get_case_list(options = {})
11
+ @request.get(%w[case filter], options)
12
+ end
13
+
14
+ def get_case_by_id(id)
15
+ @request.get(['case', id.to_s])
16
+ end
17
+
18
+ def get_all_case_contacts(case_id)
19
+ @request.get(['case', case_id.to_s, 'contact'])
20
+ end
21
+
22
+ def create_case(title, options = {})
23
+ @request.post(%w[case], { title: title }.merge(options))
24
+ end
25
+
26
+ def add_case_contact(case_id, contact_id)
27
+ @request.post(['case', case_id.to_s, 'contact'], contactId: contact_id)
28
+ end
29
+
30
+ def set_case_access_rights(case_ids, options = {})
31
+ @request.put(%w[case access], { caseId: case_ids }.merge(options))
32
+ end
33
+
34
+ def update_case(case_id, title, options = {})
35
+ @request.put(['case', case_id.to_s], { title: title }.merge(options))
36
+ end
37
+
38
+ def set_case_access_rights_by_filter(options = {})
39
+ @request.put(%w[case filter access], options)
40
+ end
41
+
42
+ def resume_case(case_id)
43
+ @request.put(['case', case_id.to_s, 'reopen'])
44
+ end
45
+
46
+ def close_case(case_id)
47
+ @request.put(['case', case_id.to_s, 'close'])
48
+ end
49
+
50
+ def set_rights_to_case(case_id, options = {})
51
+ @request.put(['case', case_id.to_s, 'access'],
52
+ { casesid: case_id }.merge(options))
53
+ end
54
+
55
+ def delete_case_group(*case_ids)
56
+ @request.put(%w[case], casesids: case_ids.flatten)
57
+ end
58
+ alias delete_cases_bulk delete_case_group
59
+
60
+ def delete_case_group_by_filter(options = {})
61
+ @request.delete(%w[case filter], options)
62
+ end
63
+
64
+ def delete_case(case_id)
65
+ @request.delete(['case', case_id.to_s])
66
+ end
67
+
68
+ def delete_case_contact(case_id, contact_id)
69
+ @request.delete(['case', case_id.to_s, 'contact', contact_id.to_s])
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Teamlab
4
+ # Methods for working with crm common methods
5
+ module CrmCommon
6
+ def get_currency_list
7
+ @request.get(%w[settings currency])
8
+ end
9
+
10
+ def get_result_of_convertation(options = {})
11
+ @request.get(%w[settings currency convert], options)
12
+ end
13
+
14
+ def get_summary_table(currency)
15
+ @request.get(%w[settings currency summarytable], currency: currency)
16
+ end
17
+
18
+ def update_crm_currency(currency)
19
+ @request.put(%w[settings currency], currency: currency)
20
+ end
21
+
22
+ def get_all_currency_rates
23
+ @request.get(%w[currency rates], {})
24
+ end
25
+
26
+ def set_currency_rate(from = 'EUR', to = 'USD', rate = '1.0')
27
+ @request.post(%w[currency rates], fromCurrency: from, toCurrency: to, rate: rate)
28
+ end
29
+
30
+ def get_currency_rate_by_id(id)
31
+ @request.get(['currency', 'rates', id.to_s], {})
32
+ end
33
+
34
+ def delete_currency_rate_by_id(id)
35
+ @request.delete(['currency', 'rates', id.to_s], {})
36
+ end
37
+
38
+ def set_is_portal_configured(options = {})
39
+ @request.put(%w[settings], options)
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,243 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Teamlab
4
+ # Methods for working with crm contacts methods
5
+ module CrmContacts
6
+ def get_contacts_for_mail(*contact_ids)
7
+ @request.get(%w[contact mail], contactids: contact_ids.flatten)
8
+ end
9
+
10
+ def get_contact_statuses
11
+ @request.get(%w[contact status])
12
+ end
13
+
14
+ def get_contacts_by_filter(options = {})
15
+ @request.get(%w[contact filter], options)
16
+ end
17
+
18
+ def get_simple_contacts(options = {})
19
+ @request.get(%w[contact simple filter], options)
20
+ end
21
+
22
+ def get_contact_status_by_id(contact_status_id)
23
+ @request.get(['contact', 'status', contact_status_id.to_s])
24
+ end
25
+
26
+ def create_contact_type(title, options = {})
27
+ @request.post(%w[contact type], { title: title }.merge(options))
28
+ end
29
+
30
+ def create_contact_status(title, color, options = {})
31
+ @request.post(%w[contact status], { title: title, color: color }.merge(options))
32
+ end
33
+
34
+ def create_person(first_name, last_name, options = {})
35
+ @request.post(%w[contact person], { firstName: first_name, lastName: last_name }.merge(options))
36
+ end
37
+
38
+ def create_company(company_name, managers, options = {})
39
+ @request.post(%w[contact company], { companyName: company_name, managerList: managers }.merge(options))
40
+ end
41
+
42
+ def create_task_group(title, options = {})
43
+ @request.post(%w[contact task group], { title: title }.merge(options))
44
+ end
45
+
46
+ def add_tag_to_batch_contacts(tags, options = {})
47
+ @request.post(%w[contact filter taglist], { tags: tags }.merge(options))
48
+ end
49
+
50
+ def update_contact_type(id, title, options = {})
51
+ @request.put(['contact', 'type', id.to_s], { title: title }.merge(options))
52
+ end
53
+
54
+ def update_contact_status(id, title, options = {})
55
+ @request.put(['contact', 'status', id.to_s], { title: title.to_s }.merge(options))
56
+ end
57
+
58
+ def update_crm_contact_tag_setting(options = {})
59
+ @request.put(%w[contact tag settings], options)
60
+ end
61
+
62
+ def set_access_to_batch_contact(options = {})
63
+ @request.put(%w[contact filter access], options)
64
+ end
65
+
66
+ def update_statuses_contact_order(options = {})
67
+ @request.put(%w[contact status reorder], options)
68
+ end
69
+
70
+ def update_crm_contact_status_settings(options = {})
71
+ @request.put(%w[contact status settings], options)
72
+ end
73
+
74
+ def update_contact_status_color(status_id, color)
75
+ @request.put(['contact', 'status', status_id.to_s, 'color'], color: color)
76
+ end
77
+
78
+ def update_person(id, first_name, last_name, options = {})
79
+ @request.put(['contact', 'person', id.to_s], { firstName: first_name, lastName: last_name }.merge(options))
80
+ end
81
+
82
+ def update_contact_status_by_id(contact_id, contact_status_id)
83
+ @request.put(['contact', contact_id, 'status'], contactStatusid: contact_status_id)
84
+ end
85
+
86
+ def change_contact_photo(contact_id, photo)
87
+ @request.put(['contact', contact_id.to_s, 'changephoto'], photo: File.new(photo))
88
+ end
89
+
90
+ def update_person_and_its_company_status(person_id, contact_status_id)
91
+ @request.put(['contact', 'person', person_id.to_s, 'status'], contactStatusId: contact_status_id)
92
+ end
93
+
94
+ def update_company_and_participants_status(company_id, contact_status_id)
95
+ @request.put(['contact', 'company', company_id.to_s, 'status'], contactStatusId: contact_status_id)
96
+ end
97
+
98
+ def delete_batch_contacts_by_filter(options = {})
99
+ @request.delete(%w[contact filter], options)
100
+ end
101
+
102
+ def delete_contact_status(contact_status_id)
103
+ @request.delete(['contact', 'status', contact_status_id])
104
+ end
105
+
106
+ def delete_deal_from_contact(contact_id, opportunity_id)
107
+ @request.delete(['contact', contact_id.to_s, 'opportunity', opportunity_id.to_s])
108
+ end
109
+
110
+ def get_all_contact_types
111
+ @request.get(%w[contact type])
112
+ end
113
+
114
+ def get_contact_by_id(id)
115
+ @request.get(['contact', id.to_s])
116
+ end
117
+
118
+ def get_all_contact_info_types
119
+ @request.get(%w[contact data infotype])
120
+ end
121
+
122
+ def get_contacts_by_project_id(id)
123
+ @request.get(['contact', 'project', id.to_s])
124
+ end
125
+
126
+ def get_contact_type(id)
127
+ @request.get(['contact', 'type', id.to_s])
128
+ end
129
+
130
+ def get_contact_info(contact_id, contact_info_id)
131
+ @request.get(['contact', contact_id.to_s, 'data', contact_info_id.to_s])
132
+ end
133
+
134
+ def get_all_categories(info_type)
135
+ @request.get(['contact', 'data', info_type.to_s, 'category'])
136
+ end
137
+
138
+ def get_company_linked_persons_list(company_id)
139
+ @request.get(['contact', 'company', company_id.to_s, 'person'])
140
+ end
141
+
142
+ def get_contact_information_by_type(contact_id, info_type)
143
+ @request.get(['contact', contact_id.to_s, 'data', info_type.to_s])
144
+ end
145
+
146
+ def quick_person_list_creation(data)
147
+ @request.post(%w[contact person quick], data: data)
148
+ end
149
+
150
+ def quick_company_list_creation(*names)
151
+ @request.post(%w[contact company quick], companyName: names.flatten)
152
+ end
153
+
154
+ def add_contact_info(contact_id, infotype, data, category, options = {})
155
+ @request.post(['contact', contact_id.to_s, 'data'], { infoType: infotype, data: data, category: category }.merge(options))
156
+ end
157
+
158
+ def link_contact_list_with_project(project_id, *contact_ids)
159
+ @request.post(['contact', 'project', project_id.to_s], contactId: contact_ids.flatten)
160
+ end
161
+
162
+ def add_persons_to_company(company_id, person_id)
163
+ @request.post(['contact', 'company', company_id.to_s, 'person'], personId: person_id)
164
+ end
165
+
166
+ def link_contact_with_project(contact_id, project_id)
167
+ @request.post(['contact', contact_id.to_s, 'project', project_id.to_s])
168
+ end
169
+
170
+ def add_contact_opportunity(contact_id, opportunity_id)
171
+ @request.post(['contact', contact_id.to_s, 'opportunity', opportunity_id.to_s])
172
+ end
173
+
174
+ def delete_contact_group(*contact_ids)
175
+ @request.put(%w[contact], contactids: contact_ids.flatten)
176
+ end
177
+ alias delete_contacts_bulk delete_contact_group
178
+
179
+ def merge_contacts(from_contact_id, to_contact_id)
180
+ @request.put(%w[contact merge], fromcontactid: from_contact_id, tocontactid: to_contact_id)
181
+ end
182
+
183
+ def set_contacts_access_rights(contact_ids, options = {})
184
+ @request.put(%w[contact access], { contactId: contact_ids }.merge(options))
185
+ end
186
+
187
+ def update_contact_types_order(*titles)
188
+ @request.put(%w[contact type reorder], titles: titles.flatten)
189
+ end
190
+
191
+ def set_contact_access_rights(contact_id, options = {})
192
+ @request.put(['contact', contact_id.to_s, 'access'], options)
193
+ end
194
+
195
+ def update_company(company_id, company_name, options = {})
196
+ @request.put(['contact', 'company', company_id.to_s], { companyName: company_name.to_s }.merge(options))
197
+ end
198
+
199
+ def update_crm_entity_creation_date(entity_name, entity_id, date = '2007-01-01')
200
+ id_field = "#{entity_name}id".to_sym
201
+ options = {}
202
+ options[id_field] = entity_id.to_s
203
+ options[:creationDate] = date.to_s
204
+ @request.put([entity_name.to_s, entity_id.to_s, 'creationdate'], options)
205
+ end
206
+
207
+ def update_crm_entity_modification_date(entity_name, entity_id, date = '2007-01-01')
208
+ id_field = "#{entity_name}id".to_sym
209
+ options = {}
210
+ options[id_field] = entity_id.to_s
211
+ options[:lastModifedDate] = date.to_s
212
+ @request.put([entity_name.to_s, entity_id.to_s, 'lastmodifeddate'], options)
213
+ end
214
+
215
+ def update_contact_info(information_id, contact_id, data, options = {})
216
+ @request.put(['contact', contact_id.to_s, 'data', information_id.to_s], { data: data }.merge(options))
217
+ end
218
+
219
+ def change_contact_photo_by_url(contact_id, photo_url)
220
+ @request.put(['contact', contact_id.to_s, 'changephotobyurl'], photourl: photo_url)
221
+ end
222
+
223
+ def delete_contact(id)
224
+ @request.delete(['contact', id.to_s])
225
+ end
226
+
227
+ def delete_contact_type(contact_type_id)
228
+ @request.delete(['contact', 'type', contact_type_id.to_s])
229
+ end
230
+
231
+ def delete_contact_info(contact_id, info_id)
232
+ @request.delete(['contact', contact_id.to_s, 'data', info_id.to_s])
233
+ end
234
+
235
+ def delete_person_from_company(company_id, person_id)
236
+ @request.delete(['contact', 'company', company_id.to_s, 'person'], personId: person_id)
237
+ end
238
+
239
+ def remove_contact_from_project(contact_id, project_id)
240
+ @request.delete(['contact', contact_id.to_s, 'project', project_id.to_s])
241
+ end
242
+ end
243
+ end