teamlab 0.3.16 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.overcommit.yml +34 -0
  3. data/.rubocop.yml +2 -0
  4. data/.rubocop_todo.yml +85 -0
  5. data/.travis.yml +6 -0
  6. data/Changelog.md +4 -0
  7. data/Gemfile +2 -0
  8. data/Rakefile +9 -0
  9. data/lib/teamlab/{Config.rb → config.rb} +5 -5
  10. data/lib/teamlab/{Modules/Calendar.rb → modules/calendar.rb} +12 -13
  11. data/lib/teamlab/{Modules/Community.rb → modules/community.rb} +16 -17
  12. data/lib/teamlab/{Modules/Crm.rb → modules/crm.rb} +62 -63
  13. data/lib/teamlab/{Modules/Files.rb → modules/files.rb} +14 -15
  14. data/lib/teamlab/{Modules/Group.rb → modules/group.rb} +6 -8
  15. data/lib/teamlab/{Modules/Mail.rb → modules/mail.rb} +34 -36
  16. data/lib/teamlab/{Modules/People.rb → modules/people.rb} +16 -18
  17. data/lib/teamlab/modules/portals.rb +15 -0
  18. data/lib/teamlab/{Modules/Project.rb → modules/project.rb} +46 -46
  19. data/lib/teamlab/{Modules/Settings.rb → modules/settings.rb} +1 -3
  20. data/lib/teamlab/{Request.rb → request.rb} +5 -5
  21. data/lib/teamlab/{Response.rb → response.rb} +3 -5
  22. data/lib/teamlab/version.rb +1 -1
  23. data/lib/teamlab.rb +18 -14
  24. data/spec/lib/calendar_spec.rb +2 -3
  25. data/spec/lib/community_spec.rb +3 -4
  26. data/spec/lib/crm_spec.rb +25 -26
  27. data/spec/lib/files_spec.rb +19 -19
  28. data/spec/lib/group_spec.rb +2 -2
  29. data/spec/lib/mail_spec.rb +2 -3
  30. data/spec/lib/people_spec.rb +2 -2
  31. data/spec/lib/portal_spec.rb +25 -0
  32. data/spec/lib/project_spec.rb +6 -8
  33. data/spec/lib/settings_spec.rb +2 -2
  34. data/spec/lib/{Teamlab_spec.rb → teamlab_spec.rb} +1 -5
  35. data/spec/spec_helper.rb +1 -2
  36. data/spec/support/http_data.rb +23 -23
  37. data/teamlab.gemspec +6 -6
  38. metadata +23 -16
data/lib/teamlab.rb CHANGED
@@ -1,19 +1,19 @@
1
1
  require_relative 'teamlab/version'
2
- require_relative 'teamlab/Config'
3
- require_relative 'teamlab/Request'
4
- require_relative 'teamlab/Response'
5
- require_relative 'teamlab/Modules/People'
6
- require_relative 'teamlab/Modules/Group'
7
- require_relative 'teamlab/Modules/Settings'
8
- require_relative 'teamlab/Modules/Files'
9
- require_relative 'teamlab/Modules/Project'
10
- require_relative 'teamlab/Modules/Crm'
11
- require_relative 'teamlab/Modules/Community'
12
- require_relative 'teamlab/Modules/Calendar'
13
- require_relative 'teamlab/Modules/Mail'
2
+ require_relative 'teamlab/config'
3
+ require_relative 'teamlab/request'
4
+ require_relative 'teamlab/response'
5
+ require_relative 'teamlab/modules/people'
6
+ require_relative 'teamlab/modules/group'
7
+ require_relative 'teamlab/modules/settings'
8
+ require_relative 'teamlab/modules/files'
9
+ require_relative 'teamlab/modules/project'
10
+ require_relative 'teamlab/modules/portals'
11
+ require_relative 'teamlab/modules/crm'
12
+ require_relative 'teamlab/modules/community'
13
+ require_relative 'teamlab/modules/calendar'
14
+ require_relative 'teamlab/modules/mail'
14
15
 
15
16
  module Teamlab
16
-
17
17
  def self.people
18
18
  @people ||= Teamlab::People.new
19
19
  end
@@ -34,6 +34,10 @@ module Teamlab
34
34
  @project ||= Teamlab::Project.new
35
35
  end
36
36
 
37
+ def self.portal
38
+ @portal ||= Teamlab::Portal.new
39
+ end
40
+
37
41
  def self.crm
38
42
  @crm ||= Teamlab::Crm.new
39
43
  end
@@ -49,4 +53,4 @@ module Teamlab
49
53
  def self.mail
50
54
  @mail ||= Teamlab::Mail.new
51
55
  end
52
- end
56
+ end
@@ -1,7 +1,6 @@
1
1
  require_relative '../spec_helper'
2
2
 
3
3
  describe '[Calendar]' do
4
-
5
4
  let(:teamlab_module) { :calendar }
6
5
 
7
6
  before :all do
@@ -47,7 +46,7 @@ describe '[Calendar]' do
47
46
  it_should_behave_like 'an api request' do
48
47
  let(:command) { :add_event }
49
48
  i = -1
50
- let(:args) { [DATA_COLLECTOR[:calendar_ids][i += 1], random_word, {description: random_word, startDate: DateTime.now, endDate: DateTime.now, repeatType: '', alertType: '-1', isAllDayLong: false}] }
49
+ let(:args) { [DATA_COLLECTOR[:calendar_ids][i += 1], random_word, { description: random_word, startDate: DateTime.now, endDate: DateTime.now, repeatType: '', alertType: '-1', isAllDayLong: false }] }
51
50
  let(:add_data_to_collector) { true }
52
51
  let(:data_param) { :event_ids }
53
52
  let(:param_names) { %w(objectId) }
@@ -119,7 +118,7 @@ describe '[Calendar]' do
119
118
  describe '#update_calendar_user_view' do
120
119
  it_should_behave_like 'an api request' do
121
120
  let(:command) { :update_calendar_user_view }
122
- let(:args) { [random_id(:calendar), random_word, TIME_ZONES.sample, {textColor: 'red', backgroundColor: 'blue'}] }
121
+ let(:args) { [random_id(:calendar), random_word, TIME_ZONES.sample, { textColor: 'red', backgroundColor: 'blue' }] }
123
122
  end
124
123
  end
125
124
 
@@ -1,7 +1,6 @@
1
1
  require_relative '../spec_helper'
2
2
 
3
3
  describe '[Community]' do
4
-
5
4
  let(:teamlab_module) { :community }
6
5
 
7
6
  before :all do
@@ -35,7 +34,7 @@ describe '[Community]' do
35
34
  describe '#add_bookmark' do
36
35
  it_should_behave_like 'an api request' do
37
36
  let(:command) { :add_bookmark }
38
- let(:args) { [SOME_URL, random_word, {tags: [random_word(4), random_word(4), random_word(4)].join(', ')}] }
37
+ let(:args) { [SOME_URL, random_word, { tags: [random_word(4), random_word(4), random_word(4)].join(', ') }] }
39
38
  let(:add_data_to_collector) { true }
40
39
  let(:data_param) { :bookmark_ids }
41
40
  let(:param_names) { %w(id) }
@@ -65,7 +64,7 @@ describe '[Community]' do
65
64
  describe '#create_poll' do
66
65
  it_should_behave_like 'an api request' do
67
66
  let(:command) { :create_event }
68
- let(:args) { [random_word, random_word, {type: 'Poll'}] }
67
+ let(:args) { [random_word, random_word, { type: 'Poll' }] }
69
68
  let(:add_data_to_collector) { true }
70
69
  let(:data_param) { :poll_ids }
71
70
  let(:param_names) { %w(id) }
@@ -138,7 +137,7 @@ describe '[Community]' do
138
137
  describe '#update_post' do
139
138
  it_should_behave_like 'an api request' do
140
139
  let(:command) { :update_post }
141
- let(:args) { [random_id(:community_post), random_word, random_word, {tags: [random_word(4), random_word(4), random_word(4)].join(',')}] }
140
+ let(:args) { [random_id(:community_post), random_word, random_word, { tags: [random_word(4), random_word(4), random_word(4)].join(',') }] }
142
141
  end
143
142
  end
144
143
 
data/spec/lib/crm_spec.rb CHANGED
@@ -178,7 +178,7 @@ describe '[CRM]' do
178
178
  end
179
179
  end
180
180
 
181
- #describe '#create_task_group' do
181
+ # describe '#create_task_group' do
182
182
  # it_should_behave_like 'an api request' do
183
183
  # let(:command) { :create_task_group }
184
184
  # let(:args) { [random_word] }
@@ -186,7 +186,7 @@ describe '[CRM]' do
186
186
  # let(:data_param) { :task_group_ids }
187
187
  # let(:param_names) { %w(id) }
188
188
  # end
189
- #end
189
+ # end
190
190
 
191
191
  describe '#update_history_category' do
192
192
  it_should_behave_like 'an api request' do
@@ -244,7 +244,7 @@ describe '[CRM]' do
244
244
  it_should_behave_like 'an api request' do
245
245
  let(:command) { :add_contact_info }
246
246
  i = -1
247
- let(:args) { [DATA_COLLECTOR[:new_contact_ids][i+=1], info_type = CONTACT_INFO_TYPES.sample, random_word, random_info_category(info_type)] }
247
+ let(:args) { [DATA_COLLECTOR[:new_contact_ids][i += 1], info_type = CONTACT_INFO_TYPES.sample, random_word, random_info_category(info_type)] }
248
248
  let(:add_data_to_collector) { true }
249
249
  let(:data_param) { :contact_info_ids }
250
250
  let(:param_names) { %w(id) }
@@ -253,7 +253,6 @@ describe '[CRM]' do
253
253
 
254
254
  describe '#quick_person_list_creation' do
255
255
  it_should_behave_like 'an api request' do
256
- pending ('http://bugzserver/show_bug.cgi?id=23997')
257
256
  let(:command) { :quick_person_list_creation }
258
257
  let(:args) { [[[random_word, random_word], [random_word, random_word]]] }
259
258
  end
@@ -263,7 +262,7 @@ describe '[CRM]' do
263
262
  it_should_behave_like 'an api request' do
264
263
  let(:command) { :add_opportunity_contact }
265
264
  i = -1
266
- let(:args) { [DATA_COLLECTOR[:opportunity_ids].last, DATA_COLLECTOR[:new_contact_ids][i+=1]] }
265
+ let(:args) { [DATA_COLLECTOR[:opportunity_ids].last, DATA_COLLECTOR[:new_contact_ids][i += 1]] }
267
266
  end
268
267
  end
269
268
 
@@ -488,7 +487,7 @@ describe '[CRM]' do
488
487
  describe '#add_tag_to_batch_contacts' do
489
488
  it_should_behave_like 'an api request' do
490
489
  let(:command) { :add_tag_to_batch_contacts }
491
- let(:args) { [(1..rand(1..4)).map {random_word(rand(3..6))}] }
490
+ let(:args) { [(1..rand(1..4)).map { random_word(rand(3..6)) }] }
492
491
  end
493
492
  end
494
493
 
@@ -509,7 +508,7 @@ describe '[CRM]' do
509
508
  describe '#set_is_portal_configured' do
510
509
  it_should_behave_like 'an api request' do
511
510
  let(:command) { :set_is_portal_configured }
512
- let(:args) { [{configured: random_bool}] }
511
+ let(:args) { [{ configured: random_bool }] }
513
512
  end
514
513
  end
515
514
 
@@ -547,7 +546,7 @@ describe '[CRM]' do
547
546
  describe '#update_contact_status' do
548
547
  it_should_behave_like 'an api request' do
549
548
  let(:command) { :update_contact_status }
550
- let(:args) { [random_id(:contact_status), random_word, {color: COLORS_NAMES.sample}] }
549
+ let(:args) { [random_id(:contact_status), random_word, { color: COLORS_NAMES.sample }] }
551
550
  end
552
551
  end
553
552
 
@@ -632,12 +631,12 @@ describe '[CRM]' do
632
631
  end
633
632
  end
634
633
 
635
- #describe '#change_contact_photo' do
634
+ # describe '#change_contact_photo' do
636
635
  # it_should_behave_like 'an api request' do
637
636
  # let(:command) { :change_contact_photo }
638
637
  # let(:args) { [random_id(:new_contact), 'path_to_image'] }
639
638
  # end
640
- #end
639
+ # end
641
640
 
642
641
  describe '#update_person_and_its_company_status' do
643
642
  it_should_behave_like 'an api request' do
@@ -713,7 +712,7 @@ describe '[CRM]' do
713
712
 
714
713
  describe '#get_contact_upcoming_tasks' do
715
714
  it_should_behave_like 'an api request' do
716
- #pending 'http://bugzserver/show_bug.cgi?id=23925'
715
+ # pending 'http://bugzserver/show_bug.cgi?id=23925'
717
716
  let(:command) { :get_contact_upcoming_tasks }
718
717
  let(:args) { [random_id(:new_contact)] }
719
718
  end
@@ -784,7 +783,7 @@ describe '[CRM]' do
784
783
  it_should_behave_like 'an api request' do
785
784
  let(:command) { :add_persons_to_company }
786
785
  i = -1
787
- let(:args) { [DATA_COLLECTOR[:company_ids].last, DATA_COLLECTOR[:new_contact_ids][i+=1]] }
786
+ let(:args) { [DATA_COLLECTOR[:company_ids].last, DATA_COLLECTOR[:new_contact_ids][i += 1]] }
788
787
  end
789
788
  end
790
789
 
@@ -849,7 +848,7 @@ describe '[CRM]' do
849
848
  it_should_behave_like 'an api request' do
850
849
  let(:command) { :add_contact_address }
851
850
  i = -1
852
- let(:args) { [DATA_COLLECTOR[:new_contact_ids][i+=1], random_info_category('Address'), random_word] }
851
+ let(:args) { [DATA_COLLECTOR[:new_contact_ids][i += 1], random_info_category('Address'), random_word] }
853
852
  let(:add_data_to_collector) { true }
854
853
  let(:data_param) { :contact_address_ids }
855
854
  let(:param_names) { %w() }
@@ -888,28 +887,28 @@ describe '[CRM]' do
888
887
  describe '#set_contact_access_rights' do
889
888
  it_should_behave_like 'an api request' do
890
889
  let(:command) { :set_contact_access_rights }
891
- let(:args) { [ random_id(:new_contact) ] }
890
+ let(:args) { [random_id(:new_contact)] }
892
891
  end
893
892
  end
894
893
 
895
894
  describe '#update_company' do
896
895
  it_should_behave_like 'an api request' do
897
896
  let(:command) { :update_company }
898
- let(:args) { [ random_id(:company), random_word ] }
897
+ let(:args) { [random_id(:company), random_word] }
899
898
  end
900
899
  end
901
900
 
902
901
  describe '#update_contact_info' do
903
902
  it_should_behave_like 'an api request' do
904
903
  let(:command) { :update_contact_info }
905
- let(:args) { [ random_id(:contact_info), random_id(:new_contact), random_word ] }
904
+ let(:args) { [random_id(:contact_info), random_id(:new_contact), random_word] }
906
905
  end
907
906
  end
908
907
 
909
908
  describe '#change_contact_photo_by_url' do
910
909
  it_should_behave_like 'an api request' do
911
910
  let(:command) { :change_contact_photo_by_url }
912
- let(:args) { [ random_id(:new_contact), IMAGE_URL ] }
911
+ let(:args) { [random_id(:new_contact), IMAGE_URL] }
913
912
  end
914
913
  end
915
914
 
@@ -917,7 +916,7 @@ describe '[CRM]' do
917
916
  it_should_behave_like 'an api request' do
918
917
  pending('http://bugzserver/show_bug.cgi?id=24002')
919
918
  let(:command) { :update_contact_address }
920
- let(:args) { [ random_id(:new_contact), random_id(:contact_address), random_word ] }
919
+ let(:args) { [random_id(:new_contact), random_id(:contact_address), random_word] }
921
920
  end
922
921
  end
923
922
 
@@ -1094,7 +1093,7 @@ describe '[CRM]' do
1094
1093
  describe '#set_case_access_rights' do
1095
1094
  it_should_behave_like 'an api request' do
1096
1095
  let(:command) { :set_case_access_rights }
1097
- let(:args) { [random_id(:crm_case), {isPrivate: random_bool}] }
1096
+ let(:args) { [random_id(:crm_case), { isPrivate: random_bool }] }
1098
1097
  end
1099
1098
  end
1100
1099
 
@@ -1108,7 +1107,7 @@ describe '[CRM]' do
1108
1107
  describe '#set_case_access_rights_by_filter' do
1109
1108
  it_should_behave_like 'an api request' do
1110
1109
  let(:command) { :set_case_access_rights_by_filter }
1111
- let(:args) { [{contactId: random_id(:new_contact), isPrivate: random_bool}] }
1110
+ let(:args) { [{ contactId: random_id(:new_contact), isPrivate: random_bool }] }
1112
1111
  end
1113
1112
  end
1114
1113
 
@@ -1245,7 +1244,7 @@ describe '[CRM]' do
1245
1244
  it_should_behave_like 'an api request' do
1246
1245
  let(:command) { :delete_opportunity_contact }
1247
1246
  i = -1
1248
- let(:args) { [DATA_COLLECTOR[:opportunity_ids].last, DATA_COLLECTOR[:new_contact_ids][i+=1]] }
1247
+ let(:args) { [DATA_COLLECTOR[:opportunity_ids].last, DATA_COLLECTOR[:new_contact_ids][i += 1]] }
1249
1248
  end
1250
1249
  end
1251
1250
 
@@ -1268,7 +1267,7 @@ describe '[CRM]' do
1268
1267
  it_should_behave_like 'an api request' do
1269
1268
  pending 'http://bugzserver/show_bug.cgi?id=23902'
1270
1269
  let(:command) { :delete_batch_contacts_by_filter }
1271
- let(:args) { [{tags: [random_word(4)]}] }
1270
+ let(:args) { [{ tags: [random_word(4)] }] }
1272
1271
  end
1273
1272
  end
1274
1273
 
@@ -1319,7 +1318,7 @@ describe '[CRM]' do
1319
1318
  it_should_behave_like 'an api request' do
1320
1319
  let(:command) { :delete_person_from_company }
1321
1320
  i = -1
1322
- let(:args) { [ DATA_COLLECTOR[:company_ids].last, DATA_COLLECTOR[:new_contact_ids][i+=1]] }
1321
+ let(:args) { [DATA_COLLECTOR[:company_ids].last, DATA_COLLECTOR[:new_contact_ids][i += 1]] }
1323
1322
  end
1324
1323
  end
1325
1324
 
@@ -1328,14 +1327,14 @@ describe '[CRM]' do
1328
1327
  pending 'http://bugzserver/show_bug.cgi?id=24028'
1329
1328
  let(:command) { :delete_contact_address }
1330
1329
  i = -1
1331
- let(:args) { [ DATA_COLLECTOR[:new_contact_ids][i+=1], DATA_COLLECTOR[:contact_address_ids].shift ] }
1330
+ let(:args) { [DATA_COLLECTOR[:new_contact_ids][i += 1], DATA_COLLECTOR[:contact_address_ids].shift] }
1332
1331
  end
1333
1332
  end
1334
1333
 
1335
1334
  describe '#remove_contact_from_project' do
1336
1335
  it_should_behave_like 'an api request' do
1337
1336
  let(:command) { :remove_contact_from_project }
1338
- let(:args) { [ random_id(:new_contact), random_id(:project)] }
1337
+ let(:args) { [random_id(:new_contact), random_id(:project)] }
1339
1338
  end
1340
1339
  end
1341
1340
 
@@ -1350,7 +1349,7 @@ describe '[CRM]' do
1350
1349
  it_should_behave_like 'an api request' do
1351
1350
  let(:command) { :delete_contact_info }
1352
1351
  i = -1
1353
- let(:args) { [DATA_COLLECTOR[:new_contact_ids][i+=1], DATA_COLLECTOR[:contact_info_ids][i]] }
1352
+ let(:args) { [DATA_COLLECTOR[:new_contact_ids][i += 1], DATA_COLLECTOR[:contact_info_ids][i]] }
1354
1353
  end
1355
1354
  end
1356
1355
 
@@ -24,9 +24,9 @@ describe '[Files]' do
24
24
  describe '#get_my_files' do
25
25
  it_should_behave_like 'an api request' do
26
26
  let(:command) { :get_my_files }
27
- #let(:add_data_to_collector) { true }
28
- #let(:data_param) {:my_documents_ids}
29
- #let(:param_names) {%w(current id)}
27
+ # let(:add_data_to_collector) { true }
28
+ # let(:data_param) {:my_documents_ids}
29
+ # let(:param_names) {%w(current id)}
30
30
  end
31
31
  end
32
32
 
@@ -34,8 +34,8 @@ describe '[Files]' do
34
34
  it_should_behave_like 'an api request' do
35
35
  let(:command) { :get_trash }
36
36
  let(:add_data_to_collector) { true }
37
- let(:data_param) {:trash_documents_ids}
38
- let(:param_names) {%w(current id)}
37
+ let(:data_param) { :trash_documents_ids }
38
+ let(:param_names) { %w(current id) }
39
39
  end
40
40
  end
41
41
 
@@ -43,8 +43,8 @@ describe '[Files]' do
43
43
  it_should_behave_like 'an api request' do
44
44
  let(:command) { :get_shared_docs }
45
45
  let(:add_data_to_collector) { true }
46
- let(:data_param) {:shared_documents_ids}
47
- let(:param_names) {%w(current id)}
46
+ let(:data_param) { :shared_documents_ids }
47
+ let(:param_names) { %w(current id) }
48
48
  end
49
49
  end
50
50
 
@@ -52,8 +52,8 @@ describe '[Files]' do
52
52
  it_should_behave_like 'an api request' do
53
53
  let(:command) { :get_common_docs }
54
54
  let(:add_data_to_collector) { true }
55
- let(:data_param) {:common_documents_ids}
56
- let(:param_names) {%w(current id)}
55
+ let(:data_param) { :common_documents_ids }
56
+ let(:param_names) { %w(current id) }
57
57
  end
58
58
  end
59
59
 
@@ -62,8 +62,8 @@ describe '[Files]' do
62
62
  let(:command) { :new_folder }
63
63
  let(:args) { [random_id(:my_documents), random_word] }
64
64
  let(:add_data_to_collector) { true }
65
- let(:data_param) {:new_folder_ids}
66
- let(:param_names) {%w(current id)}
65
+ let(:data_param) { :new_folder_ids }
66
+ let(:param_names) { %w(current id) }
67
67
  end
68
68
  end
69
69
 
@@ -93,8 +93,8 @@ describe '[Files]' do
93
93
  let(:command) { :create_file }
94
94
  let(:args) { [random_id(:new_folder), random_word] }
95
95
  let(:add_data_to_collector) { true }
96
- let(:data_param) {:new_file_ids}
97
- let(:param_names) {%w(id)}
96
+ let(:data_param) { :new_file_ids }
97
+ let(:param_names) { %w(id) }
98
98
  end
99
99
  end
100
100
 
@@ -205,21 +205,21 @@ describe '[Files]' do
205
205
  describe '#move_files' do
206
206
  it_should_behave_like 'an api request' do
207
207
  let(:command) { :move_files }
208
- let(:args) { [random_id(:new_folder), { fileids: DATA_COLLECTOR[:new_file_ids].sample(rand(1..4)), overwrite: random_bool}] }
208
+ let(:args) { [random_id(:new_folder), { fileids: DATA_COLLECTOR[:new_file_ids].sample(rand(1..4)), overwrite: random_bool }] }
209
209
  end
210
210
  end
211
211
 
212
212
  describe '#copy_to_folder' do
213
213
  it_should_behave_like 'an api request' do
214
214
  let(:command) { :copy_to_folder }
215
- let(:args) { [random_id(:new_folder), { fileids: DATA_COLLECTOR[:new_file_ids].sample(rand(1..4)), overwrite: random_bool}] }
215
+ let(:args) { [random_id(:new_folder), { fileids: DATA_COLLECTOR[:new_file_ids].sample(rand(1..4)), overwrite: random_bool }] }
216
216
  end
217
217
  end
218
218
 
219
219
  describe '#delete' do
220
220
  it_should_behave_like 'an api request' do
221
221
  let(:command) { :delete }
222
- let(:args) { [ folderIds: [], fileids: [] ] }
222
+ let(:args) { [folderIds: [], fileids: []] }
223
223
  end
224
224
  end
225
225
 
@@ -238,7 +238,7 @@ describe '[Files]' do
238
238
  describe '#finish_operations' do
239
239
  it_should_behave_like 'an api request' do
240
240
  let(:command) { :finish_operations }
241
- let(:args) { [ folderIds: [random_id(:new_folder)], fileids: [random_id(:new_file)] ] }
241
+ let(:args) { [folderIds: [random_id(:new_folder)], fileids: [random_id(:new_file)]] }
242
242
  end
243
243
  end
244
244
 
@@ -273,14 +273,14 @@ describe '[Files]' do
273
273
  describe '#remove_file_sharing_rights' do
274
274
  it_should_behave_like 'an api request' do
275
275
  let(:command) { :remove_file_sharing_rights }
276
- let(:args) { [ random_id(:new_file), [random_id(:user)] ] }
276
+ let(:args) { [random_id(:new_file), [random_id(:user)]] }
277
277
  end
278
278
  end
279
279
 
280
280
  describe '#remove_folder_sharing_rights' do
281
281
  it_should_behave_like 'an api request' do
282
282
  let(:command) { :remove_folder_sharing_rights }
283
- let(:args) { [ random_id(:new_folder), [random_id(:user)] ] }
283
+ let(:args) { [random_id(:new_folder), [random_id(:user)]] }
284
284
  end
285
285
  end
286
286
 
@@ -33,8 +33,8 @@ describe '[Group]' do
33
33
  let(:command) { :add_group }
34
34
  let(:args) { [random_id(:user), random_word, DATA_COLLECTOR[:user_ids]] }
35
35
  let(:add_data_to_collector) { true }
36
- let(:data_param) {:group_ids}
37
- let(:param_names) {%w(id)}
36
+ let(:data_param) { :group_ids }
37
+ let(:param_names) { %w(id) }
38
38
  end
39
39
  end
40
40
 
@@ -1,7 +1,6 @@
1
1
  require_relative '../spec_helper'
2
2
 
3
3
  describe '[Mail]' do
4
-
5
4
  let(:teamlab_module) { :mail }
6
5
 
7
6
  before :all do
@@ -15,7 +14,7 @@ describe '[Mail]' do
15
14
  describe '#create_tag' do
16
15
  it_should_behave_like 'an api request' do
17
16
  let(:command) { :create_tag }
18
- let(:args) { [random_word(4), {style: rand(15)}] }
17
+ let(:args) { [random_word(4), { style: rand(15) }] }
19
18
  end
20
19
  end
21
20
 
@@ -36,7 +35,7 @@ describe '[Mail]' do
36
35
  describe '#get_message' do
37
36
  it_should_behave_like 'an api request' do
38
37
  let(:command) { :get_message }
39
- let(:args) {message_id}
38
+ let(:args) { message_id }
40
39
  end
41
40
  end
42
41
 
@@ -33,7 +33,7 @@ describe '[People]' do
33
33
  describe '#filter' do
34
34
  it_should_behave_like 'an api request' do
35
35
  let(:command) { :filter_people }
36
- let(:args) { [{activationStatus: 1}] }
36
+ let(:args) { [{ activationStatus: 1 }] }
37
37
  end
38
38
  end
39
39
 
@@ -109,7 +109,7 @@ describe '[People]' do
109
109
  describe '#update_user' do
110
110
  it_should_behave_like 'an api request' do
111
111
  let(:command) { :update_user }
112
- let(:args) { [random_id(:new_user), random_bool, random_email, random_word, random_word, {comment: random_word}] }
112
+ let(:args) { [random_id(:new_user), random_bool, random_email, random_word, random_word, { comment: random_word }] }
113
113
  end
114
114
  end
115
115
 
@@ -0,0 +1,25 @@
1
+ require_relative '../spec_helper'
2
+
3
+ describe '[Portals]' do
4
+ before :all do
5
+ Teamlab.configure do |config|
6
+ config.server = SERVER
7
+ config.username = USERNAME
8
+ config.password = PASSWORD
9
+ end
10
+ end
11
+
12
+ let(:teamlab_module) { :portal }
13
+
14
+ describe '#invite_user_url' do
15
+ it_should_behave_like 'an api request' do
16
+ let(:command) { :invite_user_url }
17
+ end
18
+ end
19
+
20
+ describe '#invite_visitor_url' do
21
+ it_should_behave_like 'an api request' do
22
+ let(:command) { :invite_visitor_url }
23
+ end
24
+ end
25
+ end
@@ -1,7 +1,6 @@
1
1
  require_relative '../spec_helper'
2
2
 
3
3
  describe '[Project]' do
4
-
5
4
  before :all do
6
5
  Teamlab.configure do |config|
7
6
  config.server = SERVER
@@ -78,7 +77,7 @@ describe '[Project]' do
78
77
  describe '#create_project' do
79
78
  it_should_behave_like 'an api request' do
80
79
  let(:command) { :create_project }
81
- let(:args) { [random_word, random_word, random_id(:user), random_word(3), random_bool, {participants: DATA_COLLECTOR[:user_ids]}] }
80
+ let(:args) { [random_word, random_word, random_id(:user), random_word(3), random_bool, { participants: DATA_COLLECTOR[:user_ids] }] }
82
81
  let(:add_data_to_collector) { true }
83
82
  let(:data_param) { :new_project_ids }
84
83
  let(:param_names) { %w(id) }
@@ -195,7 +194,7 @@ describe '[Project]' do
195
194
  describe '#get_message_by_filter' do
196
195
  it_should_behave_like 'an api request' do
197
196
  let(:command) { :get_message_by_filter }
198
- let(:args) { [{projectId: random_id(:new_project)}] }
197
+ let(:args) { [{ projectId: random_id(:new_project) }] }
199
198
  end
200
199
  end
201
200
 
@@ -461,7 +460,7 @@ describe '[Project]' do
461
460
  describe '#update_project' do
462
461
  it_should_behave_like 'an api request' do
463
462
  let(:command) { :update_project }
464
- let(:args) { [random_id(:new_project), random_word, random_id(:user), {private: random_bool, notify: random_bool}] }
463
+ let(:args) { [random_id(:new_project), random_word, random_id(:user), { private: random_bool, notify: random_bool }] }
465
464
  end
466
465
  end
467
466
 
@@ -503,7 +502,7 @@ describe '[Project]' do
503
502
  describe '#update_project_team' do
504
503
  it_should_behave_like 'an api request' do
505
504
  let(:command) { :update_project_team }
506
- let(:args) { [random_id(:new_project), DATA_COLLECTOR[:user_ids].sample(rand(2..4)), {notify: random_bool}] }
505
+ let(:args) { [random_id(:new_project), DATA_COLLECTOR[:user_ids].sample(rand(2..4)), { notify: random_bool }] }
507
506
  end
508
507
  end
509
508
 
@@ -530,7 +529,7 @@ describe '[Project]' do
530
529
  describe '#get_task_by_filter' do
531
530
  it_should_behave_like 'an api request' do
532
531
  let(:command) { :get_task_by_filter }
533
- let(:args) { [{participant: random_id(:user)}] }
532
+ let(:args) { [{ participant: random_id(:user) }] }
534
533
  end
535
534
  end
536
535
 
@@ -655,7 +654,7 @@ describe '[Project]' do
655
654
  describe '#get_milestones_by_filter' do
656
655
  it_should_behave_like 'an api request' do
657
656
  let(:command) { :get_milestones_by_filter }
658
- let(:args) { [{projectid: random_id(:new_project)}] }
657
+ let(:args) { [{ projectid: random_id(:new_project) }] }
659
658
  end
660
659
  end
661
660
 
@@ -803,5 +802,4 @@ describe '[Project]' do
803
802
  let(:args) { [DATA_COLLECTOR[:project_template_ids].pop] }
804
803
  end
805
804
  end
806
-
807
805
  end
@@ -36,7 +36,7 @@ describe '[Settings]' do
36
36
 
37
37
  describe '#get_ldap_settings' do
38
38
  it_should_behave_like 'an api request', :pending do
39
- pending 'only for self-hosted, error 500 when running on saas portal'
39
+ pending 'only for self-hosted, error 500 when running on saas portal'
40
40
  let(:command) { :get_ldap_settings }
41
41
  end
42
42
  end
@@ -97,7 +97,7 @@ describe '[Settings]' do
97
97
  describe '#set_security' do
98
98
  it_should_behave_like 'an api request' do
99
99
  let(:command) { :set_security }
100
- let(:args) { [random_settings_entity_id, {enabled: random_bool}] }
100
+ let(:args) { [random_settings_entity_id, { enabled: random_bool }] }
101
101
  end
102
102
  end
103
103
 
@@ -1,7 +1,6 @@
1
1
  require_relative '../spec_helper'
2
2
 
3
3
  describe Teamlab do
4
-
5
4
  before :all do
6
5
  Teamlab.configure do |config|
7
6
  config.server = SERVER
@@ -76,10 +75,7 @@ describe Teamlab do
76
75
  end
77
76
  end
78
77
 
79
-
80
-
81
78
  describe 'Cleaning enviroment' do
82
-
83
79
  describe '#delete_file' do
84
80
  it_should_behave_like 'an api request' do
85
81
  let(:teamlab_module) { :files }
@@ -104,4 +100,4 @@ describe Teamlab do
104
100
  end
105
101
  end
106
102
  end
107
- end
103
+ end
data/spec/spec_helper.rb CHANGED
@@ -12,13 +12,12 @@ shared_examples_for 'an api request' do |*flags|
12
12
  DATA_COLLECTOR[data_param] ||= []
13
13
  response = [@response.body['response']].flatten
14
14
  response.each do |cur_response|
15
- DATA_COLLECTOR[data_param] << param_names.inject(cur_response) { |resp, param| resp[param] }
15
+ DATA_COLLECTOR[data_param] << param_names.inject(cur_response) { |a, e| a[e] }
16
16
  end
17
17
  end
18
18
  end
19
19
 
20
20
  context 'Successful api request' do
21
-
22
21
  it 'returns Teamlab::Response object' do
23
22
  expect(@response).to be_instance_of(Teamlab::Response)
24
23
  end