teamlab 0.1

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.
@@ -0,0 +1,53 @@
1
+ module Teamlab
2
+
3
+ class Settings
4
+
5
+ def initialize
6
+ @request = Teamlab::Request
7
+ end
8
+
9
+ def get_settings
10
+ @request.get
11
+ end
12
+
13
+ def get_logo
14
+ @request.get(['logo'])
15
+ end
16
+
17
+ def get_usage_quota
18
+ @request.get(['quota'])
19
+ end
20
+
21
+ def get_version
22
+ @request.get(['version'])
23
+ end
24
+
25
+ def get_security(ids = [])
26
+ @request.get(['security'], ids: ids)
27
+ end
28
+
29
+ def get_admin_security(product_id, user_id)
30
+ @request.get(['security', 'administrator'], productid: product_id, userid: user_id)
31
+ end
32
+
33
+ def get_product_admin(product_id)
34
+ @request.get(['security', 'administrator', product_id.to_s])
35
+ end
36
+
37
+ def set_version(version_id)
38
+ @request.put(['version'], versionId: version_id)
39
+ end
40
+
41
+ def set_security(id, options = {})
42
+ @request.put(['security'], { id: id }.merge(options))
43
+ end
44
+
45
+ def set_access(id, enabled = true)
46
+ @request.put(['access'], items: [id, enabled])
47
+ end
48
+
49
+ def set_product_admin(product_id, user_id, administrator = true)
50
+ @request.put(['security', 'administrator'], productid: product_id, userid: user_id, administrator: administrator)
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,61 @@
1
+ require 'net/http'
2
+ require 'json'
3
+ require 'httparty'
4
+ require 'httmultiparty'
5
+ require_relative 'Response'
6
+
7
+ module Teamlab
8
+ class Request
9
+ #include HTTParty
10
+ include HTTMultiParty
11
+
12
+ def self.post(*args)
13
+ request(:post, args)
14
+ end
15
+
16
+ def self.get(*args)
17
+ request(:get, args)
18
+ end
19
+
20
+ def self.put(*args)
21
+ request(:put, args)
22
+ end
23
+
24
+ def self.delete(*args)
25
+ request(:delete, args)
26
+ end
27
+
28
+ private
29
+
30
+ def self.request(type, args)
31
+ command, opts = parse_args(args)
32
+ url = generate_request_url(command)
33
+ attempts = 0
34
+ begin
35
+ response = Teamlab::Response.new(HTTParty.send(type, url, opts))
36
+ rescue TimeoutError
37
+ attempts += 1
38
+ retry if attempts < 3
39
+ raise 'Can\'t ' + type.to_s + ' ' + url.to_s
40
+ rescue Exception => e
41
+ fail e
42
+ end
43
+ fail response.error.to_s unless response.success
44
+ response
45
+ end
46
+
47
+ def self.generate_request_url(command)
48
+ Teamlab.config.server + Teamlab.config.api_path + Teamlab.config.api_additive + command
49
+ end
50
+
51
+ def self.parse_args(args)
52
+ command = args.first.instance_of?(Array) ? '/' + args.shift.join('/') : args.shift.to_s
53
+ opts = {}
54
+ opts[:body] = args.last.instance_of?(Hash) ? args.pop : {}
55
+ opts[:headers] = opts[:body][:headers] ? Teamlab.config.headers.merge(opts[:body].delete(:headers)) : Teamlab.config.headers
56
+ opts[:query] = opts.delete(:body) if opts[:body].key?(:somefile)
57
+ [command, opts]
58
+ end
59
+
60
+ end
61
+ end
@@ -0,0 +1,14 @@
1
+ module Teamlab
2
+
3
+ class Response
4
+
5
+ attr_reader :body, :error, :code, :success
6
+
7
+ def initialize(http_response)
8
+ @code = http_response.code
9
+ @body = http_response.respond_to?(:parsed_response) && http_response.parsed_response.key?('result') ? http_response.parsed_response['result'] : nil
10
+ @error = @body['error']['message'] if @body.key?('error') && @body['error'].key?('message')
11
+ @success = @code < 400
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,3 @@
1
+ module Teamlab
2
+ VERSION = '0.1'
3
+ end
@@ -0,0 +1,1745 @@
1
+ require_relative '../spec_helper'
2
+
3
+ describe Teamlab do
4
+
5
+ before :all do
6
+ Teamlab.configure do |config|
7
+ config.server = SERVER
8
+ config.username = USERNAME
9
+ config.password = PASSWORD
10
+ end
11
+ end
12
+
13
+ shared_examples_for 'an api request' do
14
+ before do
15
+ @module = Teamlab.send(teamlab_module)
16
+ @response = args.empty? ? @module.send(command) : @module.send(command, *args)
17
+ end
18
+
19
+ context 'Successful api request' do
20
+
21
+ it 'returns Teamlab::Response object' do
22
+ @response.should be_instance_of(Teamlab::Response)
23
+ end
24
+
25
+ it 'returns Teamlab::Response object with successful parameter, set to true' do
26
+ @response.success.should be_true
27
+ end
28
+
29
+ it 'returns Teamlab::Response object with nil error parameter' do
30
+ @response.error.should be_nil
31
+ end
32
+
33
+ it 'returns Teamlab::Response object with hash body' do
34
+ @response.body.should be_instance_of(Hash)
35
+ end
36
+ end
37
+ end
38
+
39
+ describe '[People]' do
40
+ let(:teamlab_module) { :people }
41
+
42
+ describe '#get_people' do
43
+ it_should_behave_like 'an api request' do
44
+ let(:command) { :get_people }
45
+ end
46
+ end
47
+
48
+ describe '#get_self' do
49
+ it_should_behave_like 'an api request' do
50
+ let(:command) { :get_self }
51
+ end
52
+ end
53
+
54
+ describe '#search_people' do
55
+ it_should_behave_like 'an api request' do
56
+ let(:command) { :search_people }
57
+ let(:args) { SEARCH_USER_NAME }
58
+ end
59
+ end
60
+
61
+ describe '#filter' do
62
+ it_should_behave_like 'an api request' do
63
+ let(:command) { :filter_people }
64
+ let(:args) { USER_FILTER }
65
+ end
66
+ end
67
+
68
+ describe '#add_user' do
69
+ it_should_behave_like 'an api request' do
70
+ let(:command) { :add_user }
71
+ let(:args) { [IS_VISITOR, random_email, NEW_USER_FIRSTNAME, NEW_USER_LASTNAME] }
72
+ end
73
+ end
74
+
75
+ describe '#get_user_by_username' do
76
+ it_should_behave_like 'an api request' do
77
+ let(:command) { :get_user_by_username }
78
+ let(:args) { USERNAME_FOR_OPERATIONS }
79
+ end
80
+ end
81
+
82
+ describe '#get_people_by_status' do
83
+ it_should_behave_like 'an api request' do
84
+ let(:command) { :get_people_by_status }
85
+ let(:args) { USER_STATUS }
86
+ end
87
+ end
88
+
89
+ describe '#get_people_by_search_query' do
90
+ it_should_behave_like 'an api request' do
91
+ let(:command) { :get_people_by_search_query }
92
+ let(:args) { SEARCH_QUERY }
93
+ end
94
+ end
95
+
96
+ describe '#remind_password' do
97
+ it_should_behave_like 'an api request' do
98
+ let(:command) { :remind_password }
99
+ let(:args) { [USER_ID, USER_EMAIL] }
100
+ end
101
+ end
102
+
103
+ describe '#search_with_status' do
104
+ it_should_behave_like 'an api request' do
105
+ let(:command) { :search_with_status }
106
+ let(:args) { [USER_STATUS, SEARCH_QUERY] }
107
+ end
108
+ end
109
+
110
+ describe '#active' do
111
+ it_should_behave_like 'an api request' do
112
+ let(:command) { :active }
113
+ let(:args) { [] }
114
+ end
115
+ end
116
+
117
+ describe '#update_contacts' do
118
+ it_should_behave_like 'an api request' do
119
+ let(:command) { :update_contacts }
120
+ let(:args) { [USER_ID, USER_CONTACTS] }
121
+ end
122
+ end
123
+
124
+ describe '#send_invite' do
125
+ it_should_behave_like 'an api request' do
126
+ let(:command) { :send_invite }
127
+ let(:args) { [FEW_USER_IDS] }
128
+ end
129
+ end
130
+
131
+ describe '#delete' do
132
+ it_should_behave_like 'an api request' do
133
+ let(:command) { :delete }
134
+ let(:args) { [USERS_TO_DELETE] }
135
+ end
136
+ end
137
+
138
+ describe '#update_user' do
139
+ it_should_behave_like 'an api request' do
140
+ let(:command) { :update_user }
141
+ let(:args) { [USER_ID, IS_VISITOR, random_email, NEW_USER_FIRSTNAME, NEW_USER_LASTNAME, { comment: NEW_USER_FIRSTNAME + ' ' + NEW_USER_LASTNAME}] }
142
+ end
143
+ end
144
+
145
+ describe '#change_people_type' do
146
+ it_should_behave_like 'an api request' do
147
+ let(:command) { :change_people_type }
148
+ let(:args) { [ USER_TYPE, FEW_USER_IDS] }
149
+ end
150
+ end
151
+
152
+ describe '#update_photo' do
153
+ it_should_behave_like 'an api request' do
154
+ let(:command) { :update_photo }
155
+ let(:args) { [USER_ID, PATH_TO_IMAGE] }
156
+ end
157
+ end
158
+
159
+ describe '#change_people_status' do
160
+ it_should_behave_like 'an api request' do
161
+ let(:command) { :change_people_status }
162
+ let(:args) { [ USER_STATUS, FEW_USER_IDS] }
163
+ end
164
+ end
165
+
166
+ describe '#add_contacts' do
167
+ it_should_behave_like 'an api request' do
168
+ let(:command) { :add_contacts }
169
+ let(:args) { [ USER_CONTACTS, USER_ID] }
170
+ end
171
+ end
172
+
173
+ describe '#delete_user' do
174
+ it_should_behave_like 'an api request' do
175
+ let(:command) { :delete_user }
176
+ let(:args) { USERS_TO_DELETE.first }
177
+ end
178
+ end
179
+
180
+ describe '#delete_photo' do
181
+ it_should_behave_like 'an api request' do
182
+ let(:command) { :delete_photo }
183
+ let(:args) { USERS_TO_DELETE.first }
184
+ end
185
+ end
186
+
187
+ describe '#delete_contacts' do
188
+ it_should_behave_like 'an api request' do
189
+ let(:command) { :delete_contacts }
190
+ let(:args) { [USER_ID, USER_CONTACTS] }
191
+ end
192
+ end
193
+ end
194
+
195
+ describe '[Group]' do
196
+ let(:teamlab_module) { :group }
197
+
198
+ describe '#get_groups' do
199
+ it_should_behave_like 'an api request' do
200
+ let(:command) { :get_groups }
201
+ end
202
+ end
203
+
204
+ describe '#get_group' do
205
+ it_should_behave_like 'an api request' do
206
+ let(:command) { :get_group }
207
+ let(:args) { GROUP_ID }
208
+ end
209
+ end
210
+
211
+ describe '#add_group' do
212
+ it_should_behave_like 'an api request' do
213
+ let(:command) { :add_group }
214
+ let(:args) { [USER_ID, GROUP_NAME, FEW_USER_IDS] }
215
+ end
216
+ end
217
+
218
+ describe '#replace_members' do
219
+ it_should_behave_like 'an api request' do
220
+ let(:command) { :replace_members }
221
+ let(:args) { [GROUP_ID_FOR_OPERATIONS, FEW_USER_IDS] }
222
+ end
223
+ end
224
+
225
+ describe '#update_group' do
226
+ it_should_behave_like 'an api request' do
227
+ let(:command) { :update_group }
228
+ let(:args) { [GROUP_ID_FOR_OPERATIONS, GROUP_UPDATE_OPTIONS] }
229
+ end
230
+ end
231
+
232
+ describe '#add_group_users' do
233
+ it_should_behave_like 'an api request' do
234
+ let(:command) { :add_group_users }
235
+ let(:args) { [GROUP_ID_FOR_OPERATIONS, FEW_USER_IDS] }
236
+ end
237
+ end
238
+
239
+ describe '#set_group_manager' do
240
+ it_should_behave_like 'an api request' do
241
+ let(:command) { :set_group_manager }
242
+ let(:args) { [GROUP_ID_FOR_OPERATIONS, USER_ID] }
243
+ end
244
+ end
245
+
246
+ describe '#move_group_members' do
247
+ it_should_behave_like 'an api request' do
248
+ let(:command) { :move_group_members }
249
+ let(:args) { [GROUP_ID_FOR_OPERATIONS, GROUP_ID] }
250
+ end
251
+ end
252
+
253
+ describe '#delete_group' do
254
+ it_should_behave_like 'an api request' do
255
+ let(:command) { :delete_group }
256
+ let(:args) { GROUP_ID_TO_DELETE }
257
+ end
258
+ end
259
+
260
+ describe '#remove_group_members' do
261
+ it_should_behave_like 'an api request' do
262
+ let(:command) { :remove_group_members }
263
+ let(:args) { GROUP_ID_FOR_OPERATIONS }
264
+ end
265
+ end
266
+ end
267
+
268
+ describe '[Settings]' do
269
+ let(:teamlab_module) { :settings }
270
+
271
+ describe '#get_settings' do
272
+ it_should_behave_like 'an api request' do
273
+ let(:command) { :get_settings }
274
+ end
275
+ end
276
+
277
+ describe '#get_logo' do
278
+ it_should_behave_like 'an api request' do
279
+ let(:command) { :get_logo }
280
+ end
281
+ end
282
+
283
+ describe '#get_usage_quota' do
284
+ it_should_behave_like 'an api request' do
285
+ let(:command) { :get_usage_quota }
286
+ end
287
+ end
288
+
289
+ describe '#get_version' do
290
+ it_should_behave_like 'an api request' do
291
+ let(:command) { :get_version }
292
+ end
293
+ end
294
+
295
+ describe '#get_security' do
296
+ it_should_behave_like 'an api request' do
297
+ let(:command) { :get_security }
298
+ let(:args) { [SETTINGS_ENTITY_IDS] }
299
+ end
300
+ end
301
+
302
+ describe '#get_admin_security' do
303
+ it_should_behave_like 'an api request' do
304
+ let(:command) { :get_admin_security }
305
+ let(:args) { [SETTINGS_TALK_MODULE_ID, SETTINGS_TEST_USER] }
306
+ end
307
+ end
308
+
309
+ describe '#get_product_admin' do
310
+ it_should_behave_like 'an api request' do
311
+ let(:command) { :get_product_admin }
312
+ let(:args) { [SETTINGS_TALK_MODULE_ID] }
313
+ end
314
+ end
315
+
316
+ describe '#set_version' do
317
+ it_should_behave_like 'an api request' do
318
+ let(:command) { :set_version }
319
+ let(:args) { [SETTINGS_VERSION] }
320
+ end
321
+ end
322
+
323
+ describe '#set_security' do
324
+ it_should_behave_like 'an api request' do
325
+ let(:command) { :set_security }
326
+ let(:args) { [SETTINGS_TALK_MODULE_ID, SETTINGS_FOR_TALK] }
327
+ end
328
+ end
329
+
330
+ describe '#set_access' do
331
+ it_should_behave_like 'an api request' do
332
+ let(:command) { :set_access }
333
+ let(:args) { [SETTINGS_TALK_MODULE_ID] }
334
+ end
335
+ end
336
+
337
+ describe '#set_product_admin' do
338
+ it_should_behave_like 'an api request' do
339
+ let(:command) { :set_product_admin }
340
+ let(:args) { [SETTINGS_TALK_MODULE_ID, SETTINGS_TEST_USER] }
341
+ end
342
+ end
343
+ end
344
+
345
+ describe '[Settings]' do
346
+ let(:teamlab_module) { :files }
347
+
348
+ describe '#get_my_files' do
349
+ it_should_behave_like 'an api request' do
350
+ let(:command) { :get_my_files }
351
+ end
352
+ end
353
+
354
+ describe '#get_trash' do
355
+ it_should_behave_like 'an api request' do
356
+ let(:command) { :get_trash }
357
+ end
358
+ end
359
+
360
+ describe '#get_folder' do
361
+ it_should_behave_like 'an api request' do
362
+ let(:command) { :get_folder }
363
+ let(:args) { FOLDER_COMMON_DOCS_ID }
364
+ end
365
+ end
366
+
367
+ describe '#new_folder' do
368
+ it_should_behave_like 'an api request' do
369
+ let(:command) { :new_folder }
370
+ let(:args) { ['1553123', FOLDER_TITLE] }
371
+ end
372
+ end
373
+
374
+ describe '#rename_folder' do
375
+ it_should_behave_like 'an api request' do
376
+ let(:command) { :rename_folder }
377
+ let(:args) { [FOLDER_FOR_OPERATIONS_ID, FOLDER_TITLE] }
378
+ end
379
+ end
380
+
381
+ describe '#get_shared_docs' do
382
+ it_should_behave_like 'an api request' do
383
+ let(:command) { :get_shared_docs }
384
+ end
385
+ end
386
+
387
+ describe '#get_common_docs' do
388
+ it_should_behave_like 'an api request' do
389
+ let(:command) { :get_common_docs }
390
+ end
391
+ end
392
+
393
+ describe '#search' do
394
+ it_should_behave_like 'an api request' do
395
+ let(:command) { :search }
396
+ let(:args) { FOLDER_TITLE }
397
+ end
398
+ end
399
+
400
+ describe '#get_recent_upload_files' do
401
+ it_should_behave_like 'an api request' do
402
+ let(:command) { :get_recent_upload_files }
403
+ let(:args) { FOLDER_COMMON_DOCS_ID }
404
+ end
405
+ end
406
+
407
+ describe '#get_share_link' do
408
+ it_should_behave_like 'an api request' do
409
+ let(:command) { :get_share_link }
410
+ let(:args) { [FOLDER_FOR_OPERATIONS_ID, FILES_SHARE_TYPE] }
411
+ end
412
+ end
413
+
414
+ describe '#upload_to_my_docs' do
415
+ it_should_behave_like 'an api request' do
416
+ let(:command) { :upload_to_my_docs }
417
+ let(:args) { FILE_TO_UPLOAD }
418
+ end
419
+ end
420
+
421
+ describe '#upload_to_common_docs' do
422
+ it_should_behave_like 'an api request' do
423
+ let(:command) { :upload_to_common_docs }
424
+ let(:args) { FILE_TO_UPLOAD }
425
+ end
426
+ end
427
+
428
+ describe '#upload_to_folder' do
429
+ it_should_behave_like 'an api request' do
430
+ let(:command) { :upload_to_folder }
431
+ let(:args) { [FOLDER_FOR_OPERATIONS_ID, FILE_TO_UPLOAD] }
432
+ end
433
+ end
434
+
435
+ describe '#chunked_upload' do
436
+ it_should_behave_like 'an api request' do
437
+ let(:command) { :chunked_upload }
438
+ let(:args) { [FOLDER_FOR_OPERATIONS_ID, FILE_TO_UPLOAD] }
439
+ end
440
+ end
441
+
442
+ describe '#create_txt_in_my_docs' do
443
+ it_should_behave_like 'an api request' do
444
+ let(:command) { :create_txt_in_my_docs }
445
+ let(:args) { [NEW_FILE_NAME, NEW_FILE_CONTENT] }
446
+ end
447
+ end
448
+
449
+ describe '#create_html_in_my_docs' do
450
+ it_should_behave_like 'an api request' do
451
+ let(:command) { :create_html_in_my_docs }
452
+ let(:args) { [NEW_FILE_NAME, NEW_FILE_CONTENT] }
453
+ end
454
+ end
455
+
456
+ describe '#create_txt_in_common_docs' do
457
+ it_should_behave_like 'an api request' do
458
+ let(:command) { :create_txt_in_common_docs }
459
+ let(:args) { [NEW_FILE_NAME, NEW_FILE_CONTENT] }
460
+ end
461
+ end
462
+
463
+ describe '#create_html_in_common_docs' do
464
+ it_should_behave_like 'an api request' do
465
+ let(:command) { :create_html_in_common_docs }
466
+ let(:args) { [NEW_FILE_NAME, NEW_FILE_CONTENT] }
467
+ end
468
+ end
469
+
470
+ describe '#create_txt' do
471
+ it_should_behave_like 'an api request' do
472
+ let(:command) { :create_txt }
473
+ let(:args) { [FOLDER_FOR_OPERATIONS_ID, NEW_FILE_NAME, NEW_FILE_CONTENT] }
474
+ end
475
+ end
476
+
477
+ describe '#create_html' do
478
+ it_should_behave_like 'an api request' do
479
+ let(:command) { :create_html }
480
+ let(:args) { [FOLDER_FOR_OPERATIONS_ID, NEW_FILE_NAME, NEW_FILE_CONTENT] }
481
+ end
482
+ end
483
+
484
+ describe '#create_file' do
485
+ it_should_behave_like 'an api request' do
486
+ let(:command) { :create_file }
487
+ let(:args) { [FOLDER_FOR_OPERATIONS_ID, NEW_FILE_NAME] }
488
+ end
489
+ end
490
+
491
+ describe '#get_file_info' do
492
+ it_should_behave_like 'an api request' do
493
+ let(:command) { :get_file_info }
494
+ let(:args) { FILE_FOR_OPERATIONS_ID }
495
+ end
496
+ end
497
+
498
+ describe '#get_file_history' do
499
+ it_should_behave_like 'an api request' do
500
+ let(:command) { :get_file_history }
501
+ let(:args) { FILE_FOR_OPERATIONS_ID }
502
+ end
503
+ end
504
+
505
+ describe '#get_third_party_files' do
506
+ it_should_behave_like 'an api request' do
507
+ let(:command) { :get_third_party_files }
508
+ let(:args) { [THIRD_PARTY_SERVICE, THIRD_PARTY_LOGIN_DATA] }
509
+ end
510
+ end
511
+
512
+ describe '#update_file_info' do
513
+ it_should_behave_like 'an api request' do
514
+ let(:command) { :update_file_info }
515
+ let(:args) { [FILE_FOR_OPERATIONS_ID, NEW_FILE_NAME, FILE_FOR_OPERATIONS_VERSION] }
516
+ end
517
+ end
518
+
519
+ describe '#finish_importing' do
520
+ it_should_behave_like 'an api request' do
521
+ let(:command) { :finish_importing }
522
+ end
523
+ end
524
+
525
+ describe '#import_from_third_party' do
526
+ it_should_behave_like 'an api request' do
527
+ let(:command) { :import_from_third_party }
528
+ let(:args) { [THIRD_PARTY_SERVICE, THIRD_PARTY_FOLDER_ID, IGNORE_COINCIDENCE_FILES, DATA_TO_IMPORT, THIRD_PARTY_LOGIN_DATA] }
529
+ end
530
+ end
531
+
532
+ describe '#delete_file' do
533
+ it_should_behave_like 'an api request' do
534
+ let(:command) { :delete_file }
535
+ let(:args) { FILE_TO_DELETE_ID }
536
+ end
537
+ end
538
+
539
+ describe '#delete_folder' do
540
+ it_should_behave_like 'an api request' do
541
+ let(:command) { :delete_folder }
542
+ let(:args) { FOLDER_TO_DELETE_ID }
543
+ end
544
+ end
545
+
546
+ describe '#get_file_operations_list' do
547
+ it_should_behave_like 'an api request' do
548
+ let(:command) { :get_file_operations_list }
549
+ end
550
+ end
551
+
552
+ describe '#move_files' do
553
+ it_should_behave_like 'an api request' do
554
+ let(:command) { :move_files }
555
+ let(:args) { [FOLDER_FOR_OPERATIONS_ID, { folderIds: [FOLDER_TO_DELETE_ID], fileids: [FILE_TO_DELETE_ID], overwrite: true}] }
556
+ end
557
+ end
558
+
559
+ describe '#copy_to_folder' do
560
+ it_should_behave_like 'an api request' do
561
+ let(:command) { :copy_to_folder }
562
+ let(:args) { [FOLDER_FOR_OPERATIONS_ID, { folderIds: [FOLDER_TO_DELETE_ID], fileids: [FILE_TO_DELETE_ID], overwrite: true}] }
563
+ end
564
+ end
565
+
566
+ describe '#delete' do
567
+ it_should_behave_like 'an api request' do
568
+ let(:command) { :delete }
569
+ let(:args) { [ folderIds: [FOLDER_TO_DELETE_ID], fileids: [FILE_TO_DELETE_ID] ] }
570
+ end
571
+ end
572
+
573
+ describe '#finish_all' do
574
+ it_should_behave_like 'an api request' do
575
+ let(:command) { :finish_all }
576
+ end
577
+ end
578
+
579
+ describe '#clear_recycle_bin' do
580
+ it_should_behave_like 'an api request' do
581
+ let(:command) { :clear_recycle_bin }
582
+ end
583
+ end
584
+
585
+ describe '#mark_as_read' do
586
+ it_should_behave_like 'an api request' do
587
+ let(:command) { :clear_recycle_bin }
588
+ end
589
+ end
590
+
591
+ describe '#finish_operations' do
592
+ it_should_behave_like 'an api request' do
593
+ let(:command) { :finish_operations }
594
+ let(:args) { [ folderIds: [FOLDER_FOR_OPERATIONS_ID], fileids: [FILE_FOR_OPERATIONS_ID] ] }
595
+ end
596
+ end
597
+
598
+ describe '#get_file_sharing' do
599
+ it_should_behave_like 'an api request' do
600
+ let(:command) { :get_file_sharing }
601
+ let(:args) { FILE_FOR_OPERATIONS_ID }
602
+ end
603
+ end
604
+
605
+ describe '#get_folder_sharing' do
606
+ it_should_behave_like 'an api request' do
607
+ let(:command) { :get_folder_sharing }
608
+ let(:args) { FOLDER_FOR_OPERATIONS_ID }
609
+ end
610
+ end
611
+
612
+ describe '#share_file' do
613
+ it_should_behave_like 'an api request' do
614
+ let(:command) { :share_file }
615
+ let(:args) { [FILE_FOR_OPERATIONS_ID, USER_ID, ACCESS_TYPE, { notify: NOTIFY_USER, sharingMessage: NOTIFICATION_MESSAGE }] }
616
+ end
617
+ end
618
+
619
+ describe '#share_folder' do
620
+ it_should_behave_like 'an api request' do
621
+ let(:command) { :share_folder }
622
+ let(:args) { [FOLDER_FOR_OPERATIONS_ID, USER_ID, ACCESS_TYPE, { notify: NOTIFY_USER, sharingMessage: NOTIFICATION_MESSAGE }] }
623
+ end
624
+ end
625
+
626
+ describe '#remove_file_sharing_rights' do
627
+ it_should_behave_like 'an api request' do
628
+ let(:command) { :remove_file_sharing_rights }
629
+ let(:args) { [ FILE_FOR_OPERATIONS_ID, [USER_ID] ] }
630
+ end
631
+ end
632
+
633
+ describe '#remove_folder_sharing_rights' do
634
+ it_should_behave_like 'an api request' do
635
+ let(:command) { :remove_folder_sharing_rights }
636
+ let(:args) { [ FOLDER_FOR_OPERATIONS_ID, [USER_ID] ] }
637
+ end
638
+ end
639
+
640
+ describe '#get_third_party' do
641
+ it_should_behave_like 'an api request' do
642
+ let(:command) { :get_third_party }
643
+ end
644
+ end
645
+
646
+ describe '#remove_third_party_account' do
647
+ it_should_behave_like 'an api request' do
648
+ let(:command) { :remove_third_party_account }
649
+ let(:args) { PROVIDER_ID }
650
+ end
651
+ end
652
+ end
653
+
654
+ describe '[Project]' do
655
+ let(:teamlab_module) { :project }
656
+
657
+ describe '#get_import_status' do
658
+ it_should_behave_like 'an api request' do
659
+ let(:command) { :get_import_status }
660
+ end
661
+ end
662
+
663
+ describe '#add_importing_url_to_queue' do
664
+ it_should_behave_like 'an api request' do
665
+ let(:command) { :add_importing_url_to_queue }
666
+ let(:args) { [BASECAMP_URL, BASECAMP_LOGIN, BASECAMP_PSW, IMPORT_CLOSED_PROJECTS, DISABLE_NOTIFICATONS, IMPORT_USERS_AS_COLLABORATORS] }
667
+ end
668
+ end
669
+
670
+ describe '#get_projects_for_import' do
671
+ it_should_behave_like 'an api request' do
672
+ let(:command) { :get_projects_for_import }
673
+ end
674
+ end
675
+
676
+ describe '#get_projects' do
677
+ it_should_behave_like 'an api request' do
678
+ let(:command) { :get_projects }
679
+ end
680
+ end
681
+
682
+ describe '#get_import_status' do
683
+ it_should_behave_like 'an api request' do
684
+ let(:command) { :get_import_status }
685
+ end
686
+ end
687
+
688
+ describe '#get_latest_discussion_messages' do
689
+ it_should_behave_like 'an api request' do
690
+ let(:command) { :get_latest_discussion_messages }
691
+ end
692
+ end
693
+
694
+ describe '#get_message_by_filter' do
695
+ it_should_behave_like 'an api request' do
696
+ let(:command) { :get_message_by_filter }
697
+ end
698
+ end
699
+
700
+ describe '#get_messages' do
701
+ it_should_behave_like 'an api request' do
702
+ let(:command) { :get_messages }
703
+ let(:args) { PROJECT_ID_FOR_OPERATIONS }
704
+ end
705
+ end
706
+
707
+ describe '#get_message' do
708
+ it_should_behave_like 'an api request' do
709
+ let(:command) { :get_message }
710
+ let(:args) { MESSAGE_ID }
711
+ end
712
+ end
713
+
714
+ describe '#check_subscription_to_discussion' do
715
+ it_should_behave_like 'an api request' do
716
+ let(:command) { :check_subscription_to_discussion }
717
+ let(:args) { MESSAGE_ID }
718
+ end
719
+ end
720
+
721
+ describe '#add_message' do
722
+ it_should_behave_like 'an api request' do
723
+ let(:command) { :add_message }
724
+ let(:args) { [PROJECT_ID_FOR_OPERATIONS, MESSAGE_TITLE, MESSAGE_CONTENT, USERS_TO_DELETE] }
725
+ end
726
+ end
727
+
728
+ describe '#upload_file_to_task' do
729
+ it_should_behave_like 'an api request' do
730
+ let(:command) { :upload_file_to_task }
731
+ let(:args) { [TASK_ID, FEW_FILES_IDS] }
732
+ end
733
+ end
734
+
735
+ describe '#update_project' do
736
+ it_should_behave_like 'an api request' do
737
+ let(:command) { :update_project }
738
+ let(:args) { [PROJECT_ID_FOR_OPERATIONS, RANDOM_TITLE, RESPONSIBLE_ID, { description: PROJECT_DESCRIPTION}] }
739
+ end
740
+ end
741
+
742
+ describe '#update_project_task' do
743
+ it_should_behave_like 'an api request' do
744
+ let(:command) { :update_project_task }
745
+ let(:args) { [TASK_ID, RANDOM_TITLE] }
746
+ end
747
+ end
748
+
749
+ describe '#get_projects_teams' do
750
+ it_should_behave_like 'an api request' do
751
+ let(:command) { :get_projects_teams }
752
+ let(:args) { [[PROJECT_ID_FOR_OPERATIONS, ANOTHER_PROJECT_ID]] }
753
+ end
754
+ end
755
+
756
+ describe '#get_task_by_filter' do
757
+ it_should_behave_like 'an api request' do
758
+ let(:command) { :get_task_by_filter }
759
+ end
760
+ end
761
+
762
+ describe '#add_task' do
763
+ it_should_behave_like 'an api request' do
764
+ let(:command) { :add_task }
765
+ let(:args) { [PROJECT_ID_FOR_OPERATIONS, RANDOM_TITLE] }
766
+ end
767
+ end
768
+
769
+ describe '#add_task_from_discussion' do
770
+ it_should_behave_like 'an api request' do
771
+ let(:command) { :add_task_from_discussion }
772
+ let(:args) { [PROJECT_ID_FOR_OPERATIONS, MESSAGE_ID] }
773
+ end
774
+ end
775
+
776
+ describe '#update_task_milestone' do
777
+ it_should_behave_like 'an api request' do
778
+ let(:command) { :update_task_milestone }
779
+ let(:args) { [TASK_ID, MILESTONE_ID] }
780
+ end
781
+ end
782
+
783
+ describe '#update_milestone' do
784
+ it_should_behave_like 'an api request' do
785
+ let(:command) { :update_milestone }
786
+ let(:args) { [MILESTONE_ID, RANDOM_TITLE, SOME_DATE] }
787
+ end
788
+ end
789
+
790
+ describe '#add_task_time' do
791
+ it_should_behave_like 'an api request' do
792
+ let(:command) { :add_task_time }
793
+ let(:args) { [TASK_ID, RANDOM_NOTE, SIMPLE_DATE, USER_ID, 2, PROJECT_ID_FOR_OPERATIONS] }
794
+ end
795
+ end
796
+
797
+ describe '#update_task_time' do
798
+ it_should_behave_like 'an api request' do
799
+ let(:command) { :update_task_time }
800
+ let(:args) { [TIME_ID, RANDOM_NOTE, SIMPLE_DATE, USER_ID, 2] }
801
+ end
802
+ end
803
+ end
804
+
805
+ describe '[CRM]' do
806
+ let(:teamlab_module) { :crm }
807
+
808
+ describe '#get_all_opportunity_stages' do
809
+ it_should_behave_like 'an api request' do
810
+ let(:command) { :get_all_opportunity_stages }
811
+ end
812
+ end
813
+
814
+ describe '#get_curreny_list' do
815
+ it_should_behave_like 'an api request' do
816
+ let(:command) { :get_currency_list }
817
+ end
818
+ end
819
+
820
+ describe '#get_opportunity_list' do
821
+ it_should_behave_like 'an api request' do
822
+ let(:command) { :get_opportunity_list }
823
+ end
824
+ end
825
+
826
+ describe '#get_result_of_convertation' do
827
+ it_should_behave_like 'an api request' do
828
+ let(:command) { :get_result_of_convertation }
829
+ end
830
+ end
831
+
832
+ describe '#create_opportunity_stage' do
833
+ it_should_behave_like 'an api request' do
834
+ let(:command) { :create_opportunity_stage }
835
+ let(:args) { [RANDOM_TITLE, OPPORTUNITY_COLOR_NAME] }
836
+ end
837
+ end
838
+
839
+ describe '#update_opportunity_stage' do
840
+ it_should_behave_like 'an api request' do
841
+ let(:command) { :update_opportunity_stage }
842
+ let(:args) { [OPPORTUNITY_ID, RANDOM_TITLE, OPPORTUNITY_COLOR_NAME] }
843
+ end
844
+ end
845
+
846
+ describe '#update_opportunity_stage_order' do
847
+ it_should_behave_like 'an api request' do
848
+ let(:command) { :update_opportunity_stage_order }
849
+ end
850
+ end
851
+
852
+ describe '#set_opportunity_access_rights' do
853
+ it_should_behave_like 'an api request' do
854
+ let(:command) { :set_opportunity_access_rights }
855
+ end
856
+ end
857
+
858
+ describe '#update_opportunity' do
859
+ it_should_behave_like 'an api request' do
860
+ let(:command) { :update_opportunity }
861
+ let(:args) { [OPPORTUNITY_ID, CONTACT_ID, RANDOM_TITLE, RESPONSIBLE_ID, STAGE_ID] }
862
+ end
863
+ end
864
+
865
+ describe '#update_opportunity_stage_color' do
866
+ it_should_behave_like 'an api request' do
867
+ let(:command) { :update_opportunity_stage_color }
868
+ let(:args) { [STAGE_ID, OPPORTUNITY_COLOR_NAME] }
869
+ end
870
+ end
871
+
872
+ describe '#update_opportunity_stage_color' do
873
+ it_should_behave_like 'an api request' do
874
+ let(:command) { :update_opportunity_stage_color }
875
+ let(:args) { [OPPORTUNITY_ID, OPPORTUNITY_COLOR_NAME] }
876
+ end
877
+ end
878
+
879
+ describe '#set_rights_to_opportunity' do
880
+ it_should_behave_like 'an api request' do
881
+ let(:command) { :set_rights_to_opportunity }
882
+ let(:args) { [OPPORTUNITY_ID, IS_PRIVATE, FEW_USER_IDS] }
883
+ end
884
+ end
885
+
886
+ describe '#update_opportunity_to_stage' do
887
+ it_should_behave_like 'an api request' do
888
+ let(:command) { :update_opportunity_to_stage }
889
+ let(:args) { [OPPORTUNITY_ID, STAGE_ID] }
890
+ end
891
+ end
892
+
893
+ describe '#get_invoice_taxes' do
894
+ it_should_behave_like 'an api request' do
895
+ let(:command) { :get_invoice_taxes }
896
+ end
897
+ end
898
+
899
+ describe '#get_cases_by_prefix' do
900
+ it_should_behave_like 'an api request' do
901
+ let(:command) { :get_cases_by_prefix }
902
+ let(:args) { [CONTACT_ID, RANDOM_TITLE] }
903
+ end
904
+ end
905
+
906
+ describe '#get_contact_statuses' do
907
+ it_should_behave_like 'an api request' do
908
+ let(:command) { :get_contact_statuses }
909
+ end
910
+ end
911
+
912
+ describe '#get_invoice_sample' do
913
+ it_should_behave_like 'an api request' do
914
+ let(:command) { :get_invoice_sample }
915
+ end
916
+ end
917
+
918
+ describe '#get_invoices' do
919
+ it_should_behave_like 'an api request' do
920
+ let(:command) { :get_invoices }
921
+ end
922
+ end
923
+
924
+ describe '#get_contacts' do
925
+ it_should_behave_like 'an api request' do
926
+ let(:command) { :get_contacts }
927
+ end
928
+ end
929
+
930
+ describe '#get_settings' do
931
+ it_should_behave_like 'an api request' do
932
+ let(:command) { :get_settings }
933
+ end
934
+ end
935
+
936
+ describe '#get_invoice_items' do
937
+ it_should_behave_like 'an api request' do
938
+ let(:command) { :get_invoice_items }
939
+ end
940
+ end
941
+
942
+ describe '#get_invoice_by_id' do
943
+ it_should_behave_like 'an api request' do
944
+ let(:command) { :get_invoice_by_id }
945
+ let(:args) { [INVOICE_ID] }
946
+ end
947
+ end
948
+
949
+ describe '#get_simple_contacts' do
950
+ it_should_behave_like 'an api request' do
951
+ let(:command) { :get_simple_contacts }
952
+ end
953
+ end
954
+
955
+ describe '#create_task' do
956
+ it_should_behave_like 'an api request' do
957
+ let(:command) { :create_task }
958
+ let(:args) { [RANDOM_TITLE, SOME_DATE, RESPONSIBLE_ID, CATEGORY_ID] }
959
+ end
960
+ end
961
+
962
+ describe '#create_invoice_line' do
963
+ it_should_behave_like 'an api request' do
964
+ let(:command) { :create_invoice_line }
965
+ let(:args) { [INVOICE_ID] }
966
+ end
967
+ end
968
+
969
+ describe '#create_invoice_tax' do
970
+ it_should_behave_like 'an api request' do
971
+ let(:command) { :create_invoice_tax }
972
+ let(:args) { [RANDOM_TITLE, RANDOM_NOTE] }
973
+ end
974
+ end
975
+
976
+ describe '#create_invoice_tax' do
977
+ it_should_behave_like 'an api request' do
978
+ let(:command) { :create_invoice_tax }
979
+ let(:args) { [RANDOM_TITLE, RANDOM_NOTE] }
980
+ end
981
+ end
982
+
983
+ describe '#create_contact_type' do
984
+ it_should_behave_like 'an api request' do
985
+ let(:command) { :create_contact_type }
986
+ let(:args) { [RANDOM_TITLE] }
987
+ end
988
+ end
989
+
990
+ describe '#create_contact_status' do
991
+ it_should_behave_like 'an api request' do
992
+ let(:command) { :create_contact_status }
993
+ let(:args) { [RANDOM_TITLE, OPPORTUNITY_COLOR_NAME] }
994
+ end
995
+ end
996
+
997
+ describe '#create_person' do
998
+ it_should_behave_like 'an api request' do
999
+ let(:command) { :create_person }
1000
+ let(:args) { [NEW_USER_FIRSTNAME, NEW_USER_LASTNAME] }
1001
+ end
1002
+ end
1003
+
1004
+ describe '#create_company' do
1005
+ it_should_behave_like 'an api request' do
1006
+ let(:command) { :create_company }
1007
+ let(:args) { [RANDOM_TITLE] }
1008
+ end
1009
+ end
1010
+
1011
+ describe '#create_task_group' do
1012
+ it_should_behave_like 'an api request' do
1013
+ let(:command) { :create_task_group }
1014
+ let(:args) { [RANDOM_TITLE] }
1015
+ end
1016
+ end
1017
+
1018
+ describe '#add_tag_to_batch_contacts' do
1019
+ it_should_behave_like 'an api request' do
1020
+ let(:command) { :add_tag_to_batch_contacts }
1021
+ let(:args) { [RANDOM_TAGS] }
1022
+ end
1023
+ end
1024
+
1025
+ describe '#add_tag_to_batch_contacts' do
1026
+ it_should_behave_like 'an api request' do
1027
+ let(:command) { :add_tag_to_batch_contacts }
1028
+ let(:args) { [RANDOM_TAGS] }
1029
+ end
1030
+ end
1031
+
1032
+ describe '#set_is_portal_configured' do
1033
+ it_should_behave_like 'an api request' do
1034
+ let(:command) { :set_is_portal_configured }
1035
+ end
1036
+ end
1037
+
1038
+ describe '#update_task' do
1039
+ it_should_behave_like 'an api request' do
1040
+ let(:command) { :update_task }
1041
+ let(:args) { TASK_ID }
1042
+ end
1043
+ end
1044
+
1045
+ describe '#update_invoice_tax' do
1046
+ it_should_behave_like 'an api request' do
1047
+ let(:command) { :update_invoice_tax }
1048
+ let(:args) { TAX_ID }
1049
+ end
1050
+ end
1051
+
1052
+ describe '#update_contact_type' do
1053
+ it_should_behave_like 'an api request' do
1054
+ let(:command) { :update_contact_type }
1055
+ let(:args) { [CONTACT_TYPE_ID, RANDOM_TITLE] }
1056
+ end
1057
+ end
1058
+
1059
+ describe '#update_contact_status' do
1060
+ it_should_behave_like 'an api request' do
1061
+ let(:command) { :update_contact_status }
1062
+ let(:args) { [CONTACT_STATUS_ID, {title: RANDOM_TITLE}] }
1063
+ end
1064
+ end
1065
+
1066
+ describe '#update_crm_contact_tag_setting' do
1067
+ it_should_behave_like 'an api request' do
1068
+ let(:command) { :update_crm_contact_tag_setting }
1069
+ end
1070
+ end
1071
+
1072
+ describe '#save_number_settings' do
1073
+ it_should_behave_like 'an api request' do
1074
+ let(:command) { :save_number_settings }
1075
+ let(:args) {[AUTOGENERATED, random_word(3, true), rand(10)]}
1076
+ end
1077
+ end
1078
+
1079
+ describe '#set_access_to_batch_contact' do
1080
+ it_should_behave_like 'an api request' do
1081
+ let(:command) { :set_access_to_batch_contact }
1082
+ end
1083
+ end
1084
+
1085
+ describe '#update_statuses_contact_order' do
1086
+ it_should_behave_like 'an api request' do
1087
+ let(:command) { :update_statuses_contact_order }
1088
+ end
1089
+ end
1090
+
1091
+ describe '#save_terms_settings' do
1092
+ it_should_behave_like 'an api request' do
1093
+ let(:command) { :save_terms_settings }
1094
+ end
1095
+ end
1096
+
1097
+ describe '#update_crm_contact_status_settings' do
1098
+ it_should_behave_like 'an api request' do
1099
+ let(:command) { :update_crm_contact_status_settings }
1100
+ end
1101
+ end
1102
+
1103
+ describe '#update_invoice_patch_status' do
1104
+ it_should_behave_like 'an api request' do
1105
+ let(:command) { :update_invoice_patch_status }
1106
+ let(:args) { [INVOICE_STATUS, [INVOICE_ID]]}
1107
+ end
1108
+ end
1109
+
1110
+ describe '#update_contact_status_color' do
1111
+ it_should_behave_like 'an api request' do
1112
+ let(:command) { :update_contact_status_color }
1113
+ let(:args) { [CONTACT_STATUS_ID, OPPORTUNITY_COLOR_NAME]}
1114
+ end
1115
+ end
1116
+
1117
+ describe '#update_person' do
1118
+ it_should_behave_like 'an api request' do
1119
+ let(:command) { :update_person }
1120
+ let(:args) { [CONTACT_ID]}
1121
+ end
1122
+ end
1123
+
1124
+ describe '#update_contact_status_by_id' do
1125
+ it_should_behave_like 'an api request' do
1126
+ let(:command) { :update_contact_status_by_id }
1127
+ let(:args) { [CONTACT_ID, CONTACT_STATUS_ID]}
1128
+ end
1129
+ end
1130
+
1131
+ describe '#update_invoice_line' do
1132
+ it_should_behave_like 'an api request' do
1133
+ let(:command) { :update_invoice_line }
1134
+ let(:args) { [INVOICE_ID]}
1135
+ end
1136
+ end
1137
+
1138
+ describe '#create_history_category' do
1139
+ it_should_behave_like 'an api request' do
1140
+ let(:command) { :create_history_category }
1141
+ let(:args) { [RANDOM_TITLE, RANDOM_TITLE] }
1142
+ end
1143
+ end
1144
+
1145
+ describe '#update_history_category' do
1146
+ it_should_behave_like 'an api request' do
1147
+ let(:command) { :update_history_category }
1148
+ let(:args) { [HISTORY_CATEGORY_ID, RANDOM_TITLE] }
1149
+ end
1150
+ end
1151
+
1152
+ describe '#get_task_list_by_filter' do
1153
+ it_should_behave_like 'an api request' do
1154
+ let(:command) { :get_task_list_by_filter }
1155
+ end
1156
+ end
1157
+
1158
+ describe '#get_all_task_categories' do
1159
+ it_should_behave_like 'an api request' do
1160
+ let(:command) { :get_all_task_categories }
1161
+ end
1162
+ end
1163
+
1164
+ describe '#create_task_category' do
1165
+ it_should_behave_like 'an api request' do
1166
+ let(:command) { :create_task_category }
1167
+ let(:args) { [RANDOM_TITLE, RANDOM_NOTE, {description: RANDOM_NOTE, sortOrder: 4 }] }
1168
+ end
1169
+ end
1170
+
1171
+ describe '#get_contact_upcoming_tasks' do
1172
+ it_should_behave_like 'an api request' do
1173
+ let(:command) { :get_contact_upcoming_tasks }
1174
+ let(:args) { [CONTACTS_IDS] }
1175
+ end
1176
+ end
1177
+
1178
+ describe '#update_task_category' do
1179
+ it_should_behave_like 'an api request' do
1180
+ let(:command) { :update_task_category }
1181
+ let(:args) { [CATEGORY_ID, { title: RANDOM_TITLE, description: RANDOM_NOTE, imageName: RANDOM_NOTE, sortOrder: 4 }] }
1182
+ end
1183
+ end
1184
+
1185
+ describe '#get_all_contact_types' do
1186
+ it_should_behave_like 'an api request' do
1187
+ let(:command) { :get_all_contact_types }
1188
+ end
1189
+ end
1190
+
1191
+ describe '#get_contact_by_id' do
1192
+ it_should_behave_like 'an api request' do
1193
+ let(:command) { :get_contact_by_id }
1194
+ let(:args) { [CONTACT_ID] }
1195
+ end
1196
+ end
1197
+
1198
+ describe '#get_all_contact_info_types' do
1199
+ it_should_behave_like 'an api request' do
1200
+ let(:command) { :get_all_contact_info_types }
1201
+ end
1202
+ end
1203
+
1204
+ describe '#get_contacts_by_project_id' do
1205
+ it_should_behave_like 'an api request' do
1206
+ let(:command) { :get_contacts_by_project_id }
1207
+ let(:args) { [PROJECT_ID_FOR_OPERATIONS] }
1208
+ end
1209
+ end
1210
+
1211
+ describe '#get_contact_type' do
1212
+ it_should_behave_like 'an api request' do
1213
+ let(:command) { :get_contact_type }
1214
+ let(:args) { [CONTACT_TYPE_ID] }
1215
+ end
1216
+ end
1217
+
1218
+ describe '#get_contact_info' do
1219
+ it_should_behave_like 'an api request' do
1220
+ let(:command) { :get_contact_info }
1221
+ let(:args) { [CONTACT_ID, CONTACT_INFORMATION_ID] }
1222
+ end
1223
+ end
1224
+
1225
+ describe '#get_company_linked_persons_list' do
1226
+ it_should_behave_like 'an api request' do
1227
+ let(:command) { :get_company_linked_persons_list }
1228
+ let(:args) { [COMPANY_ID] }
1229
+ end
1230
+ end
1231
+
1232
+ describe '#quick_person_list_creation' do
1233
+ it_should_behave_like 'an api request' do
1234
+ let(:command) { :quick_person_list_creation }
1235
+ let(:args) { [NEW_RANDOM_USERS_ARRAY] }
1236
+ end
1237
+ end
1238
+
1239
+ describe '#add_contact_info' do
1240
+ it_should_behave_like 'an api request' do
1241
+ let(:command) { :add_contact_info }
1242
+ let(:args) { [CONTACT_ID, INFO_TYPE, RANDOM_NOTE, INFO_CATEGORY] }
1243
+ end
1244
+ end
1245
+
1246
+ describe '#add_persons_to_company' do
1247
+ it_should_behave_like 'an api request' do
1248
+ let(:command) { :add_persons_to_company }
1249
+ let(:args) { [COMPANY_ID, CONTACT_ID] }
1250
+ end
1251
+ end
1252
+
1253
+ describe '#link_contact_with_project' do
1254
+ it_should_behave_like 'an api request' do
1255
+ let(:command) { :link_contact_with_project }
1256
+ let(:args) { [CONTACT_ID, PROJECT_ID_FOR_OPERATIONS] }
1257
+ end
1258
+ end
1259
+
1260
+ describe '#add_contact_address' do
1261
+ it_should_behave_like 'an api request' do
1262
+ let(:command) { :add_contact_address }
1263
+ let(:args) { [CONTACT_ID, CATEGORY_ID, RANDOM_TITLE] }
1264
+ end
1265
+ end
1266
+
1267
+ describe '#set_contacts_access_rights' do
1268
+ it_should_behave_like 'an api request' do
1269
+ let(:command) { :set_contacts_access_rights }
1270
+ let(:args) { [[CONTACT_ID]] }
1271
+ end
1272
+ end
1273
+
1274
+ describe '#set_contact_access_rights' do
1275
+ it_should_behave_like 'an api request' do
1276
+ let(:command) { :set_contact_access_rights }
1277
+ let(:args) { [CONTACT_ID] }
1278
+ end
1279
+ end
1280
+
1281
+ describe '#update_company' do
1282
+ it_should_behave_like 'an api request' do
1283
+ let(:command) { :update_company }
1284
+ let(:args) { [COMPANY_ID, RANDOM_TITLE] }
1285
+ end
1286
+ end
1287
+
1288
+ describe '#update_contact_info' do
1289
+ it_should_behave_like 'an api request' do
1290
+ let(:command) { :update_contact_info }
1291
+ let(:args) { [CONTACT_INFORMATION_ID, CONTACT_ID, INFO_TYPE, RANDOM_TITLE] }
1292
+ end
1293
+ end
1294
+
1295
+ describe '#change_contact_photo_by_url' do
1296
+ it_should_behave_like 'an api request' do
1297
+ let(:command) { :change_contact_photo_by_url }
1298
+ let(:args) { [CONTACT_ID, IMAGE_URL] }
1299
+ end
1300
+ end
1301
+
1302
+ describe '#add_tag_to_case_group_by_filter' do
1303
+ it_should_behave_like 'an api request' do
1304
+ let(:command) { :add_tag_to_case_group_by_filter }
1305
+ end
1306
+ end
1307
+
1308
+
1309
+ end
1310
+
1311
+ describe '[Community]' do
1312
+ let(:teamlab_module) { :community }
1313
+
1314
+ describe '#get_all_posts' do
1315
+ it_should_behave_like 'an api request' do
1316
+ let(:command) { :get_all_posts }
1317
+ end
1318
+ end
1319
+
1320
+ describe '#get_blog_tags' do
1321
+ it_should_behave_like 'an api request' do
1322
+ let(:command) { :get_blog_tags }
1323
+ end
1324
+ end
1325
+
1326
+ describe '#get_my_posts' do
1327
+ it_should_behave_like 'an api request' do
1328
+ let(:command) { :get_my_posts }
1329
+ end
1330
+ end
1331
+
1332
+ describe '#get_post_by_id' do
1333
+ it_should_behave_like 'an api request' do
1334
+ let(:command) { :get_post }
1335
+ let(:args) { [POST_ID] }
1336
+ end
1337
+ end
1338
+
1339
+ describe '#get_posts_by_tag' do
1340
+ it_should_behave_like 'an api request' do
1341
+ let(:command) { :get_posts_by_tag }
1342
+ let(:args) { [RANDOM_TAGS.sample] }
1343
+ end
1344
+ end
1345
+
1346
+ describe '#search_posts' do
1347
+ it_should_behave_like 'an api request' do
1348
+ let(:command) { :search_posts }
1349
+ let(:args) { [SEARCH_QUERY] }
1350
+ end
1351
+ end
1352
+
1353
+ describe '#get_user_posts' do
1354
+ it_should_behave_like 'an api request' do
1355
+ let(:command) { :get_user_posts }
1356
+ let(:args) { [USERNAME_FOR_OPERATIONS] }
1357
+ end
1358
+ end
1359
+
1360
+ describe '#get_comments' do
1361
+ it_should_behave_like 'an api request' do
1362
+ let(:command) { :get_comments }
1363
+ let(:args) { [POST_ID] }
1364
+ end
1365
+ end
1366
+
1367
+ describe '#create_post' do
1368
+ it_should_behave_like 'an api request' do
1369
+ let(:command) { :create_post }
1370
+ let(:args) { [RANDOM_TITLE, RANDOM_NOTE] }
1371
+ end
1372
+ end
1373
+
1374
+ describe '#add_comment' do
1375
+ it_should_behave_like 'an api request' do
1376
+ let(:command) { :add_comment }
1377
+ let(:args) { [POST_ID, RANDOM_NOTE] }
1378
+ end
1379
+ end
1380
+
1381
+ describe '#update_post' do
1382
+ it_should_behave_like 'an api request' do
1383
+ let(:command) { :update_post }
1384
+ let(:args) { [POST_ID, RANDOM_TITLE, RANDOM_NOTE, {tags: RANDOM_TAGS.join(',')}] }
1385
+ end
1386
+ end
1387
+
1388
+ describe '#get_all_bookmarks' do
1389
+ it_should_behave_like 'an api request' do
1390
+ let(:command) { :get_all_bookmarks }
1391
+ end
1392
+ end
1393
+
1394
+ describe '#get_all_bookmark_tags' do
1395
+ it_should_behave_like 'an api request' do
1396
+ let(:command) { :get_all_bookmark_tags }
1397
+ end
1398
+ end
1399
+
1400
+ describe '#get_bookmark' do
1401
+ it_should_behave_like 'an api request' do
1402
+ let(:command) { :get_bookmark }
1403
+ let(:args) { [BOOKMARK_ID] }
1404
+ end
1405
+ end
1406
+
1407
+ describe '#get_bookmarks_added_by_me' do
1408
+ it_should_behave_like 'an api request' do
1409
+ let(:command) { :get_bookmarks_added_by_me }
1410
+ end
1411
+ end
1412
+
1413
+ describe '#get_my_favourite_bookmarks' do
1414
+ it_should_behave_like 'an api request' do
1415
+ let(:command) { :get_my_favourite_bookmarks }
1416
+ end
1417
+ end
1418
+
1419
+ describe '#get_top_of_day_bookmarks' do
1420
+ it_should_behave_like 'an api request' do
1421
+ let(:command) { :get_top_of_day_bookmarks }
1422
+ end
1423
+ end
1424
+
1425
+ describe '#get_top_of_week_bookmarks' do
1426
+ it_should_behave_like 'an api request' do
1427
+ let(:command) { :get_top_of_week_bookmarks }
1428
+ end
1429
+ end
1430
+
1431
+ describe '#get_top_of_month_bookmarks' do
1432
+ it_should_behave_like 'an api request' do
1433
+ let(:command) { :get_top_of_month_bookmarks }
1434
+ end
1435
+ end
1436
+
1437
+ describe '#get_top_of_year_bookmarks' do
1438
+ it_should_behave_like 'an api request' do
1439
+ let(:command) { :get_top_of_year_bookmarks }
1440
+ end
1441
+ end
1442
+
1443
+ describe '#get_bookmarks_by_tag' do
1444
+ it_should_behave_like 'an api request' do
1445
+ let(:command) { :get_bookmarks_by_tag }
1446
+ let(:args) { [RANDOM_TAGS.sample] }
1447
+ end
1448
+ end
1449
+
1450
+ describe '#get_recently_added_bookmarks' do
1451
+ it_should_behave_like 'an api request' do
1452
+ let(:command) { :get_recently_added_bookmarks }
1453
+ end
1454
+ end
1455
+
1456
+ describe '#get_bookmark_comments' do
1457
+ it_should_behave_like 'an api request' do
1458
+ let(:command) { :get_bookmark_comments }
1459
+ let(:args) { [BOOKMARK_ID] }
1460
+ end
1461
+ end
1462
+
1463
+ describe '#search_bookmarks' do
1464
+ it_should_behave_like 'an api request' do
1465
+ let(:command) { :search_bookmarks }
1466
+ let(:args) { [SEARCH_QUERY] }
1467
+ end
1468
+ end
1469
+
1470
+ describe '#add_bookmark' do
1471
+ it_should_behave_like 'an api request' do
1472
+ let(:command) { :add_bookmark }
1473
+ let(:args) { [IMAGE_URL, RANDOM_TITLE] }
1474
+ end
1475
+ end
1476
+
1477
+ describe '#add_comment_to_bookmark' do
1478
+ it_should_behave_like 'an api request' do
1479
+ let(:command) { :add_comment_to_bookmark }
1480
+ let(:args) { [BOOKMARK_ID, RANDOM_NOTE] }
1481
+ end
1482
+ end
1483
+
1484
+ describe '#get_all_events' do
1485
+ it_should_behave_like 'an api request' do
1486
+ let(:command) { :get_all_events }
1487
+ end
1488
+ end
1489
+
1490
+ describe '#get_my_events' do
1491
+ it_should_behave_like 'an api request' do
1492
+ let(:command) { :get_my_events }
1493
+ end
1494
+ end
1495
+
1496
+ describe '#get_event' do
1497
+ it_should_behave_like 'an api request' do
1498
+ let(:command) { :get_event }
1499
+ let(:args) { [EVENT_ID] }
1500
+ end
1501
+ end
1502
+
1503
+ describe '#search_events' do
1504
+ it_should_behave_like 'an api request' do
1505
+ let(:command) { :search_events }
1506
+ let(:args) { [SEARCH_QUERY] }
1507
+ end
1508
+ end
1509
+
1510
+ describe '#create_event' do
1511
+ it_should_behave_like 'an api request' do
1512
+ let(:command) { :create_event }
1513
+ let(:args) { [RANDOM_TITLE, RANDOM_NOTE] }
1514
+ end
1515
+ end
1516
+
1517
+ describe '#vote_for_event' do
1518
+ it_should_behave_like 'an api request' do
1519
+ let(:command) { :vote_for_event }
1520
+ let(:args) { [EVENT_ID, 1] }
1521
+ end
1522
+ end
1523
+
1524
+ describe '#add_comment_to_event' do
1525
+ it_should_behave_like 'an api request' do
1526
+ let(:command) { :add_comment_to_event }
1527
+ let(:args) { [EVENT_ID, RANDOM_NOTE] }
1528
+ end
1529
+ end
1530
+
1531
+ describe '#update_event' do
1532
+ it_should_behave_like 'an api request' do
1533
+ let(:command) { :update_event }
1534
+ let(:args) { [EVENT_ID, RANDOM_TITLE, RANDOM_NOTE] }
1535
+ end
1536
+ end
1537
+
1538
+ describe '#get_forums' do
1539
+ it_should_behave_like 'an api request' do
1540
+ let(:command) { :get_forums }
1541
+ end
1542
+ end
1543
+
1544
+ describe '#get_thread_topics' do
1545
+ it_should_behave_like 'an api request' do
1546
+ let(:command) { :get_thread_topics }
1547
+ let(:args) { [THREAD_ID] }
1548
+ end
1549
+ end
1550
+
1551
+ describe '#get_last_updated_topics' do
1552
+ it_should_behave_like 'an api request' do
1553
+ let(:command) { :get_last_updated_topics }
1554
+ end
1555
+ end
1556
+
1557
+ describe '#get_posts' do
1558
+ it_should_behave_like 'an api request' do
1559
+ let(:command) { :get_posts }
1560
+ let(:args) { [TOPIC_ID] }
1561
+ end
1562
+ end
1563
+
1564
+ describe '#search_topics' do
1565
+ it_should_behave_like 'an api request' do
1566
+ let(:command) { :search_topics }
1567
+ let(:args) { [random_word(5)] }
1568
+ end
1569
+ end
1570
+
1571
+ describe '#add_thread_to_category' do
1572
+ it_should_behave_like 'an api request' do
1573
+ let(:command) { :add_thread_to_category }
1574
+ let(:args) { [COMMUNITY_CATEGORY_ID, RANDOM_NOTE, {categoryName: RANDOM_TITLE, threadDescription: random_word(4)}] }
1575
+ end
1576
+ end
1577
+
1578
+ describe '#add_topic_to_thread' do
1579
+ it_should_behave_like 'an api request' do
1580
+ let(:command) { :add_topic_to_thread }
1581
+ let(:args) { [THREAD_ID, RANDOM_TITLE, RANDOM_NOTE] }
1582
+ end
1583
+ end
1584
+
1585
+ describe '#update_topic_in_thread' do
1586
+ it_should_behave_like 'an api request' do
1587
+ let(:command) { :update_topic_in_thread }
1588
+ let(:args) { [TOPIC_ID] }
1589
+ end
1590
+ end
1591
+
1592
+ describe '#update_post_in_topic' do
1593
+ it_should_behave_like 'an api request' do
1594
+ let(:command) { :update_post_in_topic }
1595
+ let(:args) { [TOPIC_ID, POST_ID] }
1596
+ end
1597
+ end
1598
+
1599
+ describe '#get_wiki_pages' do
1600
+ it_should_behave_like 'an api request' do
1601
+ let(:command) { :get_wiki_pages }
1602
+ end
1603
+ end
1604
+
1605
+ describe '#get_wiki_page' do
1606
+ it_should_behave_like 'an api request' do
1607
+ let(:command) { :get_wiki_page }
1608
+ let(:args) { [WIKI_PAGE_NAME] }
1609
+ end
1610
+ end
1611
+
1612
+ describe '#get_wiki_file_info' do
1613
+ it_should_behave_like 'an api request' do
1614
+ let(:command) { :get_wiki_file_info }
1615
+ let(:args) { [WIKI_FILE_NAME] }
1616
+ end
1617
+ end
1618
+
1619
+ describe '#get_page_history' do
1620
+ it_should_behave_like 'an api request' do
1621
+ let(:command) { :get_page_history }
1622
+ let(:args) { [WIKI_PAGE_NAME] }
1623
+ end
1624
+ end
1625
+
1626
+ describe '#get_all_page_comments' do
1627
+ it_should_behave_like 'an api request' do
1628
+ let(:command) { :get_all_page_comments }
1629
+ let(:args) { [WIKI_PAGE_NAME] }
1630
+ end
1631
+ end
1632
+
1633
+ describe '#search_wiki_pages_by_name' do
1634
+ it_should_behave_like 'an api request' do
1635
+ let(:command) { :search_wiki_pages_by_name }
1636
+ let(:args) { [RANDOM_TITLE] }
1637
+ end
1638
+ end
1639
+
1640
+ describe '#search_wiki_pages_by_content' do
1641
+ it_should_behave_like 'an api request' do
1642
+ let(:command) { :search_wiki_pages_by_content }
1643
+ let(:args) { [RANDOM_TITLE] }
1644
+ end
1645
+ end
1646
+
1647
+ describe '#create_page' do
1648
+ it_should_behave_like 'an api request' do
1649
+ let(:command) { :create_page }
1650
+ let(:args) { [RANDOM_TITLE, RANDOM_NOTE] }
1651
+ end
1652
+ end
1653
+
1654
+ describe '#create_wiki_page_comment' do
1655
+ it_should_behave_like 'an api request' do
1656
+ let(:command) { :create_wiki_page_comment }
1657
+ let(:args) { [WIKI_PAGE_NAME, RANDOM_NOTE] }
1658
+ end
1659
+ end
1660
+
1661
+ describe '#update_wiki_page' do
1662
+ it_should_behave_like 'an api request' do
1663
+ let(:command) { :update_wiki_page }
1664
+ let(:args) { [WIKI_PAGE_NAME, RANDOM_NOTE] }
1665
+ end
1666
+ end
1667
+
1668
+ describe '#update_wiki_page_comment' do
1669
+ it_should_behave_like 'an api request' do
1670
+ let(:command) { :update_wiki_page_comment }
1671
+ let(:args) { [WIKI_PAGE_COMMENT_ID, RANDOM_NOTE] }
1672
+ end
1673
+ end
1674
+ end
1675
+
1676
+ describe '[Calendar]' do
1677
+ let(:teamlab_module) { :calendar }
1678
+
1679
+ describe '#get_default_access' do
1680
+ it_should_behave_like 'an api request' do
1681
+ let(:command) { :get_default_access }
1682
+ end
1683
+ end
1684
+
1685
+ describe '#get_calendar' do
1686
+ it_should_behave_like 'an api request' do
1687
+ let(:command) { :get_calendar }
1688
+ let(:args) { [CALENDAR_ID] }
1689
+ end
1690
+ end
1691
+
1692
+ describe '#get_subscription_list' do
1693
+ it_should_behave_like 'an api request' do
1694
+ let(:command) { :get_subscription_list }
1695
+ end
1696
+ end
1697
+
1698
+ describe '#get_icalc_link' do
1699
+ it_should_behave_like 'an api request' do
1700
+ let(:command) { :get_icalc_link }
1701
+ let(:args) { [CALENDAR_ID] }
1702
+ end
1703
+ end
1704
+
1705
+ describe '#get_access_parameters' do
1706
+ it_should_behave_like 'an api request' do
1707
+ let(:command) { :get_access_parameters }
1708
+ let(:args) { [CALENDAR_ID] }
1709
+ end
1710
+ end
1711
+
1712
+ describe '#create_calendar' do
1713
+ it_should_behave_like 'an api request' do
1714
+ let(:command) { :create_calendar }
1715
+ let(:args) { [RANDOM_TITLE] }
1716
+ end
1717
+ end
1718
+
1719
+ #describe '#create_calendar_by_ical_link' do
1720
+ # it_should_behave_like 'an api request' do
1721
+ # let(:command) { :create_calendar_by_ical_link } #ХЗ ГДЕ ВЗЯТЬ ЛИНКУ
1722
+ # let(:args) { [RANDOM_TITLE] }
1723
+ # end
1724
+ #end
1725
+
1726
+
1727
+ end
1728
+
1729
+ describe '[Mail]' do
1730
+ let(:teamlab_module) { :mail }
1731
+
1732
+ describe '#get_tag_list' do
1733
+ it_should_behave_like 'an api request' do
1734
+ let(:command) { :get_tag_list }
1735
+ end
1736
+ end
1737
+
1738
+ describe '#create_tag' do
1739
+ it_should_behave_like 'an api request' do
1740
+ let(:command) { :create_tag }
1741
+ let(:args) { [random_word(4), {style: rand(15)}] }
1742
+ end
1743
+ end
1744
+ end
1745
+ end