teamlab 0.2.1 → 0.2.2

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/README.md CHANGED
@@ -10,25 +10,25 @@ Add this line to your application's Gemfile:
10
10
 
11
11
  And then execute:
12
12
 
13
- $ bundle
13
+ bundle
14
14
 
15
15
  Or install it yourself as:
16
16
 
17
- $ gem install teamlab
17
+ gem install teamlab
18
18
 
19
19
  ## Usage
20
20
 
21
21
  First of all, you should configure your enviroment by commands
22
22
 
23
- $ Teamlab.configure do |config|
24
- $ config.server = 'example.teamlab.com'
25
- $ config.username = 'foo'
26
- $ config.password = 'bar'
27
- $ end
23
+ Teamlab.configure do |config|
24
+ config.server = 'example.teamlab.com'
25
+ config.username = 'foo'
26
+ config.password = 'bar'
27
+ end
28
28
 
29
29
  and then call methods you need:
30
30
 
31
- $ Teamlab.people.get_people
31
+ Teamlab.people.get_people
32
32
 
33
33
 
34
34
  ## Contributing
@@ -38,3 +38,8 @@ and then call methods you need:
38
38
  3. Commit your changes (`git commit -am 'Add some feature'`)
39
39
  4. Push to the branch (`git push origin my-new-feature`)
40
40
  5. Create new Pull Request
41
+
42
+
43
+ ## Documentation
44
+
45
+ Please read TeamLab API [documentation](http://api.teamlab.com/2.0/) for more information about API methods
@@ -37,18 +37,18 @@ module Teamlab
37
37
  @request.get(['calendars', start_date.to_s, end_date.to_s])
38
38
  end
39
39
 
40
- def create_calendar(name, options = {})
41
- @request.post('', {name: name}.merge(options))
40
+ def create_calendar(name, time_zone, options = {})
41
+ @request.post('', {name: name, timeZone: time_zone}.merge(options))
42
42
  end
43
43
 
44
- def create_calendar_by_ical_link(ical_url, options = {})
45
- @request.post(%w(calendarurl), {iCalUrl: ical_url}.merge(options))
44
+ def create_calendar_by_ical_link(ical_url, name, options = {})
45
+ @request.post(%w(calendarurl), {iCalUrl: ical_url, name: name}.merge(options))
46
46
  end
47
47
 
48
48
  #============== TODO: OPTIONAL VARIABLES
49
49
 
50
50
  def add_event(calendar_id, name, options = {})
51
- @request.post([calendar_id.to_s], {name: name}.merge(options))
51
+ @request.post([calendar_id.to_s, 'event'], {name: name}.merge(options))
52
52
  end
53
53
 
54
54
  def import_ical(calendar_id, *files)
@@ -57,14 +57,14 @@ module Teamlab
57
57
 
58
58
  #============== TODO: OPTIONAL VARIABLES
59
59
 
60
- def update_calendar(calendar_id, name, options = {})
61
- @request.put([calendar_id.to_s], {name: name}.merge(options))
60
+ def update_calendar(calendar_id, name, time_zone, options = {})
61
+ @request.put([calendar_id.to_s], {name: name, timeZone: time_zone}.merge(options))
62
62
  end
63
63
 
64
64
  #============== TODO: OPTIONAL VARIABLES
65
65
 
66
- def update_calendar_user_view(calendar_id, options = {})
67
- @request.put([calendar_id.to_s, 'view'], options)
66
+ def update_calendar_user_view(calendar_id, name, time_zone, options = {})
67
+ @request.put([calendar_id.to_s, 'view'], {name: name, timeZone: time_zone}.merge(options))
68
68
  end
69
69
 
70
70
  def manage_subscriptions(states)
@@ -158,8 +158,8 @@ module Teamlab
158
158
 
159
159
  #==================================== TODO: ERROR
160
160
 
161
- def add_thread_to_category(category_id, category_name, thread_name, options = {})
162
- @request.post(%w(forum), {categoryId: category_id, categoryName: category_name.to_s, threadName: thread_name}.merge(options))
161
+ def add_thread_to_category(category_id, category_name, thread_name, description)
162
+ @request.post(%w(forum), categoryId: category_id, categoryName: category_name.to_s, threadName: thread_name, description: description)
163
163
  end
164
164
 
165
165
  def add_topic_to_thread(thread_id, subject, content, options = {})
@@ -170,8 +170,8 @@ module Teamlab
170
170
  @request.post(['forum', 'topic', topic_id.to_s], {subject: subject, content: content}.merge(options))
171
171
  end
172
172
 
173
- def update_topic_in_thread(topic_id, options = {})
174
- @request.put(['forum', 'topic', topic_id.to_s], options)
173
+ def update_topic_in_thread(topic_id, subject, options = {})
174
+ @request.put(['forum', 'topic', topic_id.to_s], {subject: subject}.merge(options))
175
175
  end
176
176
 
177
177
  def update_post_in_topic(topic_id, post_id, options = {})
@@ -5,6 +5,7 @@ module Teamlab
5
5
  @request = Teamlab::Request.new('crm')
6
6
  end
7
7
 
8
+ #region Opportunity
8
9
  def get_all_opportunity_stages
9
10
  @request.get(%w(opportunity stage))
10
11
  end
@@ -37,11 +38,11 @@ module Teamlab
37
38
  @request.get(['settings', 'currency', currency.to_s, 'summarytable'])
38
39
  end
39
40
 
40
- def create_opportunity(title, responsible_id, options = {})
41
- @request.post(%w(opportunity), {title: title, responsibleid: responsible_id}.merge(options))
41
+ def create_opportunity(stage_id, title, responsible_id, options = {}) #есть тест
42
+ @request.post(%w(opportunity), {stageId: stage_id, title: title, responsibleid: responsible_id}.merge(options))
42
43
  end
43
44
 
44
- def create_opportunity_stage(title, color, options = {})
45
+ def create_opportunity_stage(title, color, options = {}) #есть тест
45
46
  @request.post(%w(opportunity stage), { title: title, color: color }.merge(options))
46
47
  end
47
48
 
@@ -49,19 +50,19 @@ module Teamlab
49
50
  @request.post(['opportunity', opportunity_id.to_s, 'contact', contact_id.to_s])
50
51
  end
51
52
 
52
- def set_opportunity_success_rights(opportunity_id, is_private, access_list)
53
- @request.put(%w(opportunity access), opportunityid: opportunity_id, isPrivate: is_private, accessList: access_list)
53
+ def set_opportunity_access_rights(opportunity_ids, is_private, *users)
54
+ @request.put(%w(opportunity access), opportunityid: opportunity_ids.to_a.flatten, isPrivate: is_private, accessList: users.flatten)
54
55
  end
55
56
 
56
57
  def update_opportunity_stage(id, title, color, options = {})
57
58
  @request.put(['opportunity', 'stage', id.to_s], { title: title, color: color, }.merge(options))
58
59
  end
59
60
 
60
- def update_opportunity_stage_order(options = {})
61
+ def update_opportunity_stages_order(options = {})
61
62
  @request.put(%w(opportunity stage reorder), options)
62
63
  end
63
64
 
64
- def set_opportunity_access_rights(options = {})
65
+ def set_opportunity_access_rights_for_users(options = {})
65
66
  @request.put(%w(opportunity filter access), options)
66
67
  end
67
68
 
@@ -82,8 +83,8 @@ module Teamlab
82
83
  @request.put(['opportunity', opportunity_id.to_s, 'stage', stage_id.to_s], stageid: stage_id)
83
84
  end
84
85
 
85
- def delete_opportunity_group(opportunity_ids)
86
- @request.delete(%w(opportunity), opportunityids: opportunity_ids)
86
+ def delete_opportunity_group(*opportunity_ids)
87
+ @request.delete(%w(opportunity), opportunityids: opportunity_ids.flatten)
87
88
  end
88
89
 
89
90
  def delete_opportunity_group_by_filter(options = {})
@@ -102,12 +103,16 @@ module Teamlab
102
103
  @request.delete(['opportunity', opportunity_id.to_s, 'contact', contact_id.to_s])
103
104
  end
104
105
 
106
+ #endregion
107
+
108
+ #region General
109
+
105
110
  def get_invoice_taxes
106
111
  @request.get(%w(invoice tax))
107
112
  end
108
113
 
109
- def get_contacts_for_mail(contact_ids)
110
- @request.get(%w(contact mail), contactids: contact_ids)
114
+ def get_contacts_for_mail(*contact_ids)
115
+ @request.get(%w(contact mail), contactids: contact_ids.flatten)
111
116
  end
112
117
 
113
118
  def get_cases_by_prefix(contact_id, prefix)
@@ -122,11 +127,11 @@ module Teamlab
122
127
  @request.get(%w(invoice sample))
123
128
  end
124
129
 
125
- def get_invoices(options = {})
130
+ def get_invoices_by_filter(options = {})
126
131
  @request.get(%w(invoice filter), options)
127
132
  end
128
133
 
129
- def get_contacts(options = {})
134
+ def get_contacts_by_filter(options = {})
130
135
  @request.get(%w(contact filter), options)
131
136
  end
132
137
 
@@ -134,7 +139,7 @@ module Teamlab
134
139
  @request.get(%w(invoice settings))
135
140
  end
136
141
 
137
- def get_invoice_items(options = {})
142
+ def get_invoice_items_by_filter(options = {})
138
143
  @request.get(%w(invoiceitem filter), options)
139
144
  end
140
145
 
@@ -166,12 +171,12 @@ module Teamlab
166
171
 
167
172
  #=========================================== TODO: OPTIONAL VARIABLES =====================================================
168
173
 
169
- def create_invoice_line(invoice_id)
170
- @request.post(%w(invoiceline), invoiceId: invoice_id)
174
+ def create_invoice_line(invoice_id, options = {})
175
+ @request.post(%w(invoiceline), {invoiceId: invoice_id}.merge(options))
171
176
  end
172
177
 
173
- def create_invoice_item(options = {})
174
- @request.post(%w(invoiceitem), options)
178
+ def create_invoice_item(title, description, price, stock_keeping_unit, options = {})
179
+ @request.post(%w(invoiceitem), {title: title, description: description, price: price, sku: stock_keeping_unit.to_s}.merge(options))
175
180
  end
176
181
 
177
182
  def create_invoice_tax(name, description, options = {})
@@ -190,10 +195,8 @@ module Teamlab
190
195
  @request.post(%w(contact person), {firstName: first_name, lastName: last_name}.merge(options))
191
196
  end
192
197
 
193
- #=========================================== TODO: OPTIONAL VARIABLES =====================================================
194
-
195
- def create_company(company_name, options = {})
196
- @request.post(%w(contact company), {companyName: company_name}.merge(options))
198
+ def create_company(company_name, managers, options = {})
199
+ @request.post(%w(contact company), {companyName: company_name, managerList: managers}.merge(options))
197
200
  end
198
201
 
199
202
  def create_task_group(title, options = {})
@@ -216,16 +219,12 @@ module Teamlab
216
219
  @request.put(%w(settings), options)
217
220
  end
218
221
 
219
- #=========================================== TODO: OPTIONAL VARIABLES =====================================================
220
-
221
- def update_task(task_id, options = {})
222
- @request.put(['task', task_id.to_s], options)
222
+ def update_task(task_id, title, deadline, category_id, options = {})
223
+ @request.put(['task', task_id.to_s], {title: title, deadline: deadline, categoryid: category_id}.merge(options))
223
224
  end
224
225
 
225
- #=========================================== TODO: OPTIONAL VARIABLES =====================================================
226
-
227
- def update_invoice_item(id, options = {})
228
- @request.put(['invoiceitem', id.to_s], options)
226
+ def update_invoice_item(id, title, description, price, stock_keeping_unit, options = {})
227
+ @request.put(['invoiceitem', id.to_s], {title: title, description: description, price: price, sku: stock_keeping_unit.to_s}.merge(options))
229
228
  end
230
229
 
231
230
  def update_invoice_tax(id, name, options = {})
@@ -236,8 +235,8 @@ module Teamlab
236
235
  @request.put(['contact', 'type', id.to_s], {title: title}.merge(options))
237
236
  end
238
237
 
239
- def update_contact_status(id, options = {})
240
- @request.put(['contact', 'status', id.to_s], options)
238
+ def update_contact_status(id, title, options = {})
239
+ @request.put(['contact', 'status', id.to_s], {title: title.to_s}.merge(options))
241
240
  end
242
241
 
243
242
  #=========================================== TODO: OPTIONAL VARIABLES =====================================================
@@ -250,6 +249,10 @@ module Teamlab
250
249
  @request.put(%w(contact tag settings), options)
251
250
  end
252
251
 
252
+ def save_number_settings(options = {})
253
+ @request.put(%w(invoice settings name), options)
254
+ end
255
+
253
256
  def set_access_to_batch_contact(options = {})
254
257
  @request.put(%w(contact filter access), options)
255
258
  end
@@ -274,10 +277,8 @@ module Teamlab
274
277
  @request.put(['contact', 'status', status_id.to_s, 'color'], color: color)
275
278
  end
276
279
 
277
- #=========================================== TODO: OPTIONAL VARIABLES =====================================================
278
-
279
- def update_person(id, options = {})
280
- @request.put(['contact', 'person', id.to_s], options)
280
+ def update_person(id, first_name, last_name, options = {})
281
+ @request.put(['contact', 'person', id.to_s], {firstName: first_name, lastName: last_name}.merge(options))
281
282
  end
282
283
 
283
284
  def update_contact_status_by_id(contact_id, contact_status_id)
@@ -295,7 +296,7 @@ module Teamlab
295
296
  end
296
297
 
297
298
  def update_person_and_its_company_status(person_id, contact_status_id)
298
- @request.put(['contact', 'preson', person_id.to_s, 'status'], contactStatusId: contact_status_id)
299
+ @request.put(['contact', 'person', person_id.to_s, 'status'], contactStatusId: contact_status_id)
299
300
  end
300
301
 
301
302
  def update_company_and_participants_status(company_id, contact_status_id)
@@ -346,10 +347,8 @@ module Teamlab
346
347
  @request.get(%w(history category))
347
348
  end
348
349
 
349
- #=========================================== TODO: OPTIONAL VARIABLES =====================================================
350
-
351
- def create_event(options = {})
352
- @request.post(%w(history), options)
350
+ def create_event(contact_id, content, category_id, options = {})
351
+ @request.post(%w(history), {contactId: contact_id, content: content, categoryId: category_id}.merge(options))
353
352
  end
354
353
 
355
354
  def create_history_category(title, image_name, options = {})
@@ -396,12 +395,12 @@ module Teamlab
396
395
  @request.post(%w(task category), {title: title.to_s, imageName: image_name.to_s}.merge(options))
397
396
  end
398
397
 
399
- def get_contact_upcoming_tasks(contact_id)
400
- @request.post(%w(contact task near), contactid: contact_id)
398
+ def get_contact_upcoming_tasks(*contact_ids)
399
+ @request.post(%w(contact task near), contactid: contact_ids.flatten)
401
400
  end
402
401
 
403
- def update_task_category(category_id, options = {})
404
- @request.put(['task', 'category', category_id.to_s], options)
402
+ def update_task_category(category_id, title, options = {})
403
+ @request.put(['task', 'category', category_id.to_s], { title: title }.merge(options))
405
404
  end
406
405
 
407
406
  def close_task(task_id)
@@ -468,8 +467,8 @@ module Teamlab
468
467
  @request.post(%w(contact data), items: items.flatten)
469
468
  end
470
469
 
471
- def quick_person_list_creation(*data)
472
- @request.post(%w(contact person quick), data: data.flatten)
470
+ def quick_person_list_creation(data)
471
+ @request.post(%w(contact person quick), data: data)
473
472
  end
474
473
 
475
474
  def quick_company_list_creation(*names)
@@ -524,16 +523,16 @@ module Teamlab
524
523
  @request.put(['contact', 'company', company_id.to_s], {companyName: company_name.to_s}.merge(options))
525
524
  end
526
525
 
527
- def update_contact_info(information_id, contact_id, info_type, data, options = {})
528
- @request.put(['contact', contact_id.to_s, 'data', information_id.to_s], {infoType: info_type, data: INFO_DATA}.merge(options))
526
+ def update_contact_info(information_id, contact_id, data, options = {})
527
+ @request.put(['contact', contact_id.to_s, 'data', information_id.to_s], {data: data}.merge(options))
529
528
  end
530
529
 
531
530
  def change_contact_photo_by_url(contact_id, photo_url)
532
531
  @request.put(['contact', contact_id.to_s, 'changephotobyurl'], photourl: photo_url)
533
532
  end
534
533
 
535
- def update_contact_address(contact_id, information_record_id, address, options = {})
536
- @request.put(['contact', contact_id.to_s, 'data', 'address', information_record_id.to_s], {address: address}.merge(options))
534
+ def update_contact_address(contact_id, information_id, address, options = {})
535
+ @request.put(['contact', contact_id.to_s, 'data', 'address', information_id.to_s], {address: address}.merge(options))
537
536
  end
538
537
 
539
538
  def delete_contact(id)
@@ -552,14 +551,16 @@ module Teamlab
552
551
  @request.delete(['contact', 'company', company_id.to_s, 'person'], {personId: person_id})
553
552
  end
554
553
 
555
- def delete_ontact_address(contact_id, information_record_id)
556
- @request.delete(['contact', contact_id.to_s, 'data', 'address', information_record_id.to_s])
554
+ def delete_contact_address(contact_id, information_id)
555
+ @request.delete(['contact', contact_id.to_s, 'data', 'address', information_id.to_s])
557
556
  end
558
557
 
559
558
  def remove_contact_from_project(contact_id, project_id)
560
559
  @request.delete(['contact', contact_id.to_s, 'project', project_id.to_s])
561
560
  end
562
561
 
562
+ #region Files
563
+
563
564
  def get_root_folder_id
564
565
  @request.get(%w(files root))
565
566
  end
@@ -572,8 +573,8 @@ module Teamlab
572
573
  @request.post([entity_type, entity_id, 'files'], files: fileids.flatten)
573
574
  end
574
575
 
575
- def create_txt(entity_type, entity_id, title, options = {})
576
- @request.post([entity_type.to_s, entity_id.to_s, 'files', 'text'], {title: title}.merge(options))
576
+ def create_txt(entity_type, entity_id, title, content)
577
+ @request.post([entity_type.to_s, entity_id.to_s, 'files', 'text'], title: title, content: content)
577
578
  end
578
579
 
579
580
  #================================== TODO: UPLOAD FILES ================================
@@ -599,13 +600,13 @@ module Teamlab
599
600
  end
600
601
 
601
602
  def create_tag(entity_type, tag_name)
602
- @request.get([entity_type.to_s, 'tag'], tagName: tag_name)
603
+ @request.post([entity_type.to_s, 'tag'], tagName: tag_name)
603
604
  end
604
605
 
605
606
  #=========================================== TODO: OPTIONAL VARIABLES =====================================================
606
607
 
607
- def add_tag_to_case_group_by_filter(options = {})
608
- @request.post(%w(case filter taglist), options)
608
+ def add_tag_to_case_group_by_filter(tag_name, options = {})
609
+ @request.post(%w(case filter taglist), {tagName: tag_name}.merge(options))
609
610
  end
610
611
 
611
612
  #=========================================== TODO: OPTIONAL VARIABLES =====================================================
@@ -616,8 +617,8 @@ module Teamlab
616
617
 
617
618
  #=========================================== TODO: OPTIONAL VARIABLES =====================================================
618
619
 
619
- def add_tag_to_opportunity_group(options = {})
620
- @request.post(%w(opportunity filter taglist), options)
620
+ def add_tag_to_opportunity_group(tag_name, options = {})
621
+ @request.post(%w(opportunity filter taglist), {tagName: tag_name}.merge(options))
621
622
  end
622
623
 
623
624
  def add_tag(entity_type, entity_id, tag_name)
@@ -668,8 +669,8 @@ module Teamlab
668
669
 
669
670
  #=========================================== TODO: OPTIONAL VARIABLES =====================================================
670
671
 
671
- def update_task_template(container_id, task_template_id, options = {})
672
- @request.put(['tasktemplatecontainer', container_id.to_s, 'tasktemplate'], {id: task_template_id.to_s}.merge(options))
672
+ def update_task_template(container_id, task_template_id, title, options = {})
673
+ @request.put(['tasktemplatecontainer', container_id.to_s, 'tasktemplate'], {id: task_template_id.to_s, title: title}.merge(options))
673
674
  end
674
675
 
675
676
  def delete_task_template_container(container_id)
@@ -680,8 +681,6 @@ module Teamlab
680
681
  @request.delete(['tasktemplatecontainer', 'tasktemplate', id.to_s])
681
682
  end
682
683
 
683
- #=========================================== TODO: OPTIONAL VARIABLES =====================================================
684
-
685
684
  def get_case_list(options = {})
686
685
  @request.get(%w(case filter), options)
687
686
  end
@@ -702,8 +701,8 @@ module Teamlab
702
701
  @request.post(['case', case_id.to_s, 'contact'], contactId: contact_id)
703
702
  end
704
703
 
705
- def set_case_access_rights(case_id, options = {})
706
- @request.put(%w(case access), {caseId: case_id}.merge(options))
704
+ def set_case_access_rights(case_ids, options = {})
705
+ @request.put(%w(case access), {caseId: case_ids}.merge(options))
707
706
  end
708
707
 
709
708
  def update_case(case_id, title, options = {})
@@ -750,16 +749,16 @@ module Teamlab
750
749
  @request.get([entity_type.to_s, 'customfield', 'definitions'])
751
750
  end
752
751
 
753
- def create_user_field(entity_type, field_type, options = {})
754
- @request.post([entity_type.to_s, 'customfield'], {fieldType: field_type}.merge(options))
752
+ def create_user_field(entity_type, label, field_type, options = {})
753
+ @request.post([entity_type.to_s, 'customfield'], {fieldType: field_type, label: label}.merge(options))
755
754
  end
756
755
 
757
756
  def set_user_field_value(entity_type, entity_id, field_id, field_value)
758
757
  @request.post([entity_type.to_s, entity_id.to_s, 'customfield', field_id.to_s], fieldValue: field_value)
759
758
  end
760
759
 
761
- def update_selected_user_field(entity_type, user_field_id, field_type, options = {})
762
- @request.put([entity_type.to_s, 'customfield', user_field_id.to_s], {fieldType: field_type}.merge(options))
760
+ def update_selected_user_field(entity_type, user_field_id, label, field_type, options = {})
761
+ @request.put([entity_type.to_s, 'customfield', user_field_id.to_s], {fieldType: field_type, label: label}.merge(options))
763
762
  end
764
763
 
765
764
  def update_user_fields_order(entity_type, *field_ids)
@@ -37,7 +37,7 @@ module Teamlab
37
37
  @request.get(['@search', query.to_s])
38
38
  end
39
39
 
40
- def get_recent_upload_files(folder_id)
40
+ def get_recent_uploaded_files(folder_id)
41
41
  @request.get([folder_id.to_s, 'feeds'])
42
42
  end
43
43