teamlab 0.1.3 → 0.1.4
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.
- data/lib/teamlab/Modules/Crm.rb +4 -4
- data/lib/teamlab/version.rb +1 -1
- data/spec/lib/Teamlab_spec.rb +34 -34
- data/spec/support/http_data.rb +18 -8
- metadata +2 -2
data/lib/teamlab/Modules/Crm.rb
CHANGED
@@ -37,8 +37,8 @@ module Teamlab
|
|
37
37
|
@request.get(['settings', 'currency', currency.to_s, 'summarytable'])
|
38
38
|
end
|
39
39
|
|
40
|
-
def create_opportunity(
|
41
|
-
@request.post(%w(opportunity), {
|
40
|
+
def create_opportunity(title, responsible_id, options = {})
|
41
|
+
@request.post(%w(opportunity), {title: title, responsibleid: responsible_id}.merge(options))
|
42
42
|
end
|
43
43
|
|
44
44
|
def create_opportunity_stage(title, color, options = {})
|
@@ -192,8 +192,8 @@ module Teamlab
|
|
192
192
|
|
193
193
|
#=========================================== TODO: OPTIONAL VARIABLES =====================================================
|
194
194
|
|
195
|
-
def create_company(
|
196
|
-
@request.post(%w(contact company), {
|
195
|
+
def create_company(company_name, options = {})
|
196
|
+
@request.post(%w(contact company), {companyName: company_name}.merge(options))
|
197
197
|
end
|
198
198
|
|
199
199
|
def create_task_group(title, options = {})
|
data/lib/teamlab/version.rb
CHANGED
data/spec/lib/Teamlab_spec.rb
CHANGED
@@ -14,6 +14,7 @@ describe Teamlab do
|
|
14
14
|
before do
|
15
15
|
@module = Teamlab.send(teamlab_module)
|
16
16
|
@response = args.empty? ? @module.send(command) : @module.send(command, *args)
|
17
|
+
DATA_COLLECTOR[data_param] << @response.body['response'][param_name] if add_data_to_collector
|
17
18
|
end
|
18
19
|
|
19
20
|
context 'Successful api request' do
|
@@ -54,7 +55,7 @@ describe Teamlab do
|
|
54
55
|
describe '#search_people' do
|
55
56
|
it_should_behave_like 'an api request' do
|
56
57
|
let(:command) { :search_people }
|
57
|
-
let(:args) {
|
58
|
+
let(:args) { random_word(4, true) }
|
58
59
|
end
|
59
60
|
end
|
60
61
|
|
@@ -68,126 +69,125 @@ describe Teamlab do
|
|
68
69
|
describe '#add_user' do
|
69
70
|
it_should_behave_like 'an api request' do
|
70
71
|
let(:command) { :add_user }
|
71
|
-
let(:args) { [
|
72
|
+
let(:args) { [random_bool, random_email, random_word(rand(10), true), random_word(rand(10), true)] }
|
73
|
+
let(:add_data_to_collector) { true }
|
74
|
+
let(:data_param) {:user_ids}
|
75
|
+
let(:param_name) {'id'}
|
72
76
|
end
|
73
77
|
end
|
74
78
|
|
75
79
|
describe '#get_user_by_username' do
|
76
80
|
it_should_behave_like 'an api request' do
|
77
81
|
let(:command) { :get_user_by_username }
|
78
|
-
let(:args) {
|
82
|
+
let(:args) { DATA_COLLECTOR[:user_ids].first }
|
83
|
+
let(:add_data_to_collector) { true }
|
84
|
+
let(:data_param) {:emails}
|
85
|
+
let(:param_name) {'email'}
|
79
86
|
end
|
80
87
|
end
|
81
88
|
|
82
89
|
describe '#get_people_by_status' do
|
83
90
|
it_should_behave_like 'an api request' do
|
84
91
|
let(:command) { :get_people_by_status }
|
85
|
-
let(:args) {
|
92
|
+
let(:args) { USER_STATUSES.sample }
|
86
93
|
end
|
87
94
|
end
|
88
95
|
|
89
96
|
describe '#get_people_by_search_query' do
|
90
97
|
it_should_behave_like 'an api request' do
|
91
98
|
let(:command) { :get_people_by_search_query }
|
92
|
-
let(:args) {
|
99
|
+
let(:args) { random_word }
|
93
100
|
end
|
94
101
|
end
|
95
102
|
|
96
103
|
describe '#remind_password' do
|
97
104
|
it_should_behave_like 'an api request' do
|
98
105
|
let(:command) { :remind_password }
|
99
|
-
let(:args) { [
|
106
|
+
let(:args) { [DATA_COLLECTOR[:user_ids].first, DATA_COLLECTOR[:emails].pop] }
|
100
107
|
end
|
101
108
|
end
|
102
109
|
|
103
110
|
describe '#search_with_status' do
|
104
111
|
it_should_behave_like 'an api request' do
|
105
112
|
let(:command) { :search_with_status }
|
106
|
-
let(:args) { [
|
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) { [] }
|
113
|
+
let(:args) { [USER_STATUSES.sample.downcase, random_word] }
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
117
117
|
describe '#update_contacts' do
|
118
118
|
it_should_behave_like 'an api request' do
|
119
119
|
let(:command) { :update_contacts }
|
120
|
-
let(:args) { [
|
120
|
+
let(:args) { [DATA_COLLECTOR[:user_ids].sample, USER_CONTACTS] }
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|
124
124
|
describe '#send_invite' do
|
125
125
|
it_should_behave_like 'an api request' do
|
126
126
|
let(:command) { :send_invite }
|
127
|
-
let(:args) { [
|
127
|
+
let(:args) { [DATA_COLLECTOR[:user_ids]] }
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
131
131
|
describe '#delete' do
|
132
132
|
it_should_behave_like 'an api request' do
|
133
133
|
let(:command) { :delete }
|
134
|
-
let(:args) { [
|
134
|
+
let(:args) { [[]] }
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
138
138
|
describe '#update_user' do
|
139
139
|
it_should_behave_like 'an api request' do
|
140
140
|
let(:command) { :update_user }
|
141
|
-
let(:args) { [
|
141
|
+
let(:args) { [DATA_COLLECTOR[:user_ids].sample, random_bool, random_email, random_word, random_word, { comment: random_word}] }
|
142
142
|
end
|
143
143
|
end
|
144
144
|
|
145
145
|
describe '#change_people_type' do
|
146
146
|
it_should_behave_like 'an api request' do
|
147
147
|
let(:command) { :change_people_type }
|
148
|
-
let(:args) { [
|
148
|
+
let(:args) { [USER_TYPES.sample, DATA_COLLECTOR[:user_ids]] }
|
149
149
|
end
|
150
150
|
end
|
151
151
|
|
152
152
|
describe '#update_photo' do
|
153
153
|
it_should_behave_like 'an api request' do
|
154
154
|
let(:command) { :update_photo }
|
155
|
-
let(:args) { [
|
155
|
+
let(:args) { [DATA_COLLECTOR[:user_ids].sample, PATH_TO_IMAGE] }
|
156
156
|
end
|
157
157
|
end
|
158
158
|
|
159
159
|
describe '#change_people_status' do
|
160
160
|
it_should_behave_like 'an api request' do
|
161
161
|
let(:command) { :change_people_status }
|
162
|
-
let(:args) { [
|
162
|
+
let(:args) { [ USER_STATUSES.sample, DATA_COLLECTOR[:user_ids]] }
|
163
163
|
end
|
164
164
|
end
|
165
165
|
|
166
166
|
describe '#add_contacts' do
|
167
167
|
it_should_behave_like 'an api request' do
|
168
168
|
let(:command) { :add_contacts }
|
169
|
-
let(:args) { [ USER_CONTACTS,
|
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 }
|
169
|
+
let(:args) { [ USER_CONTACTS, DATA_COLLECTOR[:user_ids].sample] }
|
177
170
|
end
|
178
171
|
end
|
179
172
|
|
180
173
|
describe '#delete_photo' do
|
181
174
|
it_should_behave_like 'an api request' do
|
182
175
|
let(:command) { :delete_photo }
|
183
|
-
let(:args) {
|
176
|
+
let(:args) { DATA_COLLECTOR[:user_ids].sample }
|
184
177
|
end
|
185
178
|
end
|
186
179
|
|
187
180
|
describe '#delete_contacts' do
|
188
181
|
it_should_behave_like 'an api request' do
|
189
182
|
let(:command) { :delete_contacts }
|
190
|
-
let(:args) { [
|
183
|
+
let(:args) { [DATA_COLLECTOR[:user_ids].sample, USER_CONTACTS] }
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
describe '#delete_user' do
|
188
|
+
it_should_behave_like 'an api request' do
|
189
|
+
let(:command) { :delete_user }
|
190
|
+
let(:args) { DATA_COLLECTOR[:user_ids].pop }
|
191
191
|
end
|
192
192
|
end
|
193
193
|
end
|
@@ -1346,7 +1346,7 @@ describe Teamlab do
|
|
1346
1346
|
describe '#search_posts' do
|
1347
1347
|
it_should_behave_like 'an api request' do
|
1348
1348
|
let(:command) { :search_posts }
|
1349
|
-
let(:args) { [
|
1349
|
+
let(:args) { [random_word] }
|
1350
1350
|
end
|
1351
1351
|
end
|
1352
1352
|
|
@@ -1463,7 +1463,7 @@ describe Teamlab do
|
|
1463
1463
|
describe '#search_bookmarks' do
|
1464
1464
|
it_should_behave_like 'an api request' do
|
1465
1465
|
let(:command) { :search_bookmarks }
|
1466
|
-
let(:args) { [
|
1466
|
+
let(:args) { [random_word] }
|
1467
1467
|
end
|
1468
1468
|
end
|
1469
1469
|
|
@@ -1503,7 +1503,7 @@ describe Teamlab do
|
|
1503
1503
|
describe '#search_events' do
|
1504
1504
|
it_should_behave_like 'an api request' do
|
1505
1505
|
let(:command) { :search_events }
|
1506
|
-
let(:args) { [
|
1506
|
+
let(:args) { [random_word] }
|
1507
1507
|
end
|
1508
1508
|
end
|
1509
1509
|
|
data/spec/support/http_data.rb
CHANGED
@@ -1,38 +1,48 @@
|
|
1
|
-
SERVER = ''
|
2
|
-
USERNAME = ''
|
3
|
-
PASSWORD = ''
|
1
|
+
SERVER = 'https://autotestdoc.teamlab.info'
|
2
|
+
USERNAME = 'teamlab.ruby@gmail.com'
|
3
|
+
PASSWORD = '123456'
|
4
4
|
|
5
5
|
def args
|
6
6
|
[]
|
7
7
|
end
|
8
8
|
|
9
|
-
def random_word(length, capitalize = false)
|
9
|
+
def random_word(length = 8, capitalize = false)
|
10
10
|
capitalize ? (0...length).map { ('a'..'z').to_a[rand(26)] }.join.capitalize : (0...length).map { ('a'..'z').to_a[rand(26)] }.join
|
11
11
|
end
|
12
12
|
|
13
|
+
def random_bool
|
14
|
+
[true, false].sample
|
15
|
+
end
|
16
|
+
|
13
17
|
def random_email
|
14
18
|
random_word(7) + '@sharklasers.com'
|
15
19
|
end
|
16
20
|
|
21
|
+
def add_data_to_collector
|
22
|
+
false
|
23
|
+
end
|
24
|
+
|
25
|
+
DATA_COLLECTOR = {user_ids: [], emails: []}
|
26
|
+
|
17
27
|
#region OPTIONS
|
18
28
|
#region People
|
19
29
|
SEARCH_USER_NAME = 'Allison'
|
20
30
|
USER_FILTER = { activationStatus: 1 }
|
21
31
|
USER_ID = 'efcb452b-2be3-4311-b539-fabad4d42e95'#'e83cceef-2cbf-4cdf-9a4c-fea4e810705b'
|
22
32
|
USERNAME_FOR_OPERATIONS = 'kcwijpgg'
|
23
|
-
|
33
|
+
USER_STATUSES = %w(Active Terminated LeaveOfAbsence Default All)
|
24
34
|
SEARCH_QUERY = random_word(7, true)
|
25
35
|
USER_EMAIL = random_email
|
26
36
|
IS_VISITOR = false
|
27
37
|
NEW_USER_FIRSTNAME = random_word(7, true)
|
28
38
|
NEW_USER_LASTNAME = random_word(7, true)
|
29
39
|
USER_CONTACTS = [
|
30
|
-
{ type: 'skype', value:
|
31
|
-
{ type: 'email', value:
|
40
|
+
{ type: 'skype', value: random_word },
|
41
|
+
{ type: 'email', value: random_email }
|
32
42
|
]
|
33
43
|
FEW_USER_IDS = %w(37f5ce64-9db1-4df9-8b93-436e39721b4d 6d5c7d2f-b81e-4afb-b5d6-cd6ef2426e35)
|
34
44
|
USERS_TO_DELETE = ['864663e3-6135-4252-a11c-e507f96e59a9']
|
35
|
-
|
45
|
+
USER_TYPES = %w(All User Visitor)
|
36
46
|
PATH_TO_IMAGE = 'http://ic.pics.livejournal.com/scryp/14761862/5478/5478_original.jpg'
|
37
47
|
#endregion
|
38
48
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teamlab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-04-
|
12
|
+
date: 2014-04-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|