teamleader 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NTBmOGY3MWIyMWQ0NmU5YzY1MGEwNzY3NDY0ZjkxMjQ3YmZkN2Y5ZQ==
4
+ NThkMjM5MmRhNzc0MWM4MjBlNjhkOGIyMjY2ZmUyNDY4YWI3NGViMA==
5
5
  data.tar.gz: !binary |-
6
- YjYyZDQxY2QxOTA3NWEwMzQxMTlkNWMxYTE3OWM4MzA3MzkzOWZhZA==
6
+ M2UwOWJkNDc1MTMwOGY4ZDFiYWQ2MTFjOTdhNWFjMzg4ZDAxNmVjNQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ODU3M2Q0YTQ0NGYyYjNiNDViMmJlMDM0NDIyYWUwMWNmOWE3YWI5MWIxM2Fm
10
- ZDJiZjIyYjcyMmVkYWUzZmU2NTNhZGQ1OTc3ZDllNTQ1N2ExYmFmMWYwZDMz
11
- NDdhZWVmMmRhMDk4NThhN2IwMjhlMTI5NGVhY2Q1MWVkZWFiNjc=
9
+ ZjhhMzQ2MTU3OGE5NWQxZjMwZTcwNzMzNmQyNTM2NmEwMjAzNjc0YzAzZTZm
10
+ MDc5ZTI3ZDY5NTUyMjNjZjNhZjc4YTZjYjBkYWQ5NzVlZDM1NjZiZmZmMzA4
11
+ MzI1MDQ0ZjRkNDAxNWI1ODVlMDJkMTZmZjM3NjNkODUzY2QwNjU=
12
12
  data.tar.gz: !binary |-
13
- Yjc2N2IyMDEwNDBkYWNmMzI2ZDlmZWY0NGY5OTNiNWZiNzI5NDM4N2FlNWU4
14
- MzYzMjg1MTZlZjliOTYxMTA5Y2FkODFkYmI0MGY3M2MxYTc2MzI1MmRjMmYy
15
- OGYxZmIwZDk5MzVhNWM4YjZkODFlOWNjODc2NWNiZDY5YmUzMzE=
13
+ YzMzMmU0YmFmM2VmYTk1NmI0MjE4NmE4MzVhM2VhMWYwMjVjMGI5ZmI3ZDI5
14
+ YWQyYzM2ZmE4N2UzNDZmNWUyZjQxYTE0NTRkZDNjZGNjNTRlNDlhZDRiMTAx
15
+ NmNlMDQ5NmJiYzYxZGRjMzA1YzY0MzE5Njg4OWM1MTEzOWY1ZDg=
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [0.3.0] - 2017-05-12
5
+ ### Added
6
+ - Methods for Contacts (add, get, update, delete, link to company, search, get contacts from a company, get relationships between contacts and companies)
7
+
4
8
  ## [0.2.0] - 2017-05-12
5
9
  ### Added
6
10
  - Method `link_contact_to_company`
data/README.md CHANGED
@@ -35,26 +35,66 @@ When a method expects a hash as argument, the hash keys have the same name as de
35
35
 
36
36
  If a required parameter is missing or if the API returns an error, the method will throw an exception.
37
37
 
38
- ### Users
38
+ ### General
39
39
 
40
40
  ```ruby
41
41
  teamleader.get_users
42
+ teamleader.get_departments
43
+ teamleader.get_tags
42
44
  ```
45
+
46
+ ### Contacts
47
+
48
+ ```ruby
49
+ teamleader.add_contact :forename => "John", :surname => "Doe", :email => "john.doe@provider.com"
50
+ teamleader.update_contact({:contact_id => 123, :track_changes => 0, :forename => "Johnny"})
51
+ teamleader.delete_contact({:contact_id => 123})
52
+ teamleader.link_contact_to_company({:contact_id => 123, :company_id => 456, :mode => "link"})
53
+ teamleader.get_contacts({:amount => 100, :pageno => 0, :searchby => "John"}) # pagination starts at 0
54
+ teamleader.get_contact({:contact_id => 123})
55
+ teamleader.get_contacts_by_company({:company_id => 123})
56
+ teamleader.get_contact_company_relations({:amount => 10, :pageno => 0})
57
+ ```
58
+
43
59
  ### Companies
44
60
 
45
61
  ```ruby
46
62
  teamleader.add_company({:name => "Hello World"})
47
- teamleader.get_company(12345)
63
+ teamleader.get_company({:company_id => 12345})
48
64
  teamleader.get_companies({:amount => 100, :pageno => 0, :searchby => "hello"}) # pagination starts at 0
49
65
  ```
50
66
 
51
67
  ### Invoices
52
68
 
53
69
  ```ruby
54
- teamleader.get_invoice(12345)
70
+ teamleader.add_invoice({
71
+ :contact_or_company => "company",
72
+ :contact_or_company_id => 12345,
73
+ :sys_department_id => 5678,
74
+ :description_1 => "My awesome item",
75
+ :price_1 => 50,
76
+ :amount_1 => 1
77
+ })
78
+ teamleader.update_invoice_payment_status({:invoice_id => 123, :status => "paid"})
79
+ teamleader.get_invoice({:invoice_id => 123})
80
+ teamleader.download_invoice_pdf({:invoice_id => 123})
55
81
  teamleader.get_invoices({:date_from => "01/01/2017", :date_to => "01/05/2017"})
56
82
  ```
57
83
 
84
+ ### Products
85
+
86
+ ```ruby
87
+ teamleader.add_product({
88
+ :name => "My Awesome Product",
89
+ :price => 49.99
90
+ })
91
+ teamleader.update_product({:product_id => 123, :price => 39.99})
92
+ teamleader.get_product({:product_id => 123})
93
+ teamleader.delete_product({:product_id => 123})
94
+ teamleader.get_products({:amount => 100, :pageno => 0}) # Pagination starts at 0
95
+ ```
96
+
97
+
58
98
  ## License
59
99
  The Teamleader GEM is released under the MIT License.
60
100
 
@@ -35,6 +35,47 @@ module Teamleader
35
35
  request "/addContact.php", params
36
36
  end
37
37
 
38
+ def get_contact(params={})
39
+ raise "contact_id is required" if params[:contact_id].nil?
40
+ request "/getContact.php", params
41
+ end
42
+
43
+ def update_contact(params={})
44
+ raise "contact_id is required" if params[:contact_id].nil?
45
+ raise "track_changes is required" if params[:track_changes].nil?
46
+ request "/updateContact.php", params
47
+ end
48
+
49
+ def delete_contact(params={})
50
+ raise "contact_id is required" if params[:contact_id].nil?
51
+ request "/deleteContact.php", params
52
+ end
53
+
54
+ def link_contact_to_company(params={})
55
+ raise "contact_id is required" if params[:contact_id].nil?
56
+ raise "company_id is required" if params[:company_id].nil?
57
+ raise "mode is required" if params[:mode].nil?
58
+ raise "mode must be 'link' or 'unlink'" unless ['link', 'unlink'].include?(params[:status])
59
+ request "/linkContactToCompany.php", params
60
+ end
61
+
62
+ def get_contacts(params={})
63
+ raise "amount is required" if params[:amount].nil?
64
+ raise "pageno is required" if params[:pageno].nil?
65
+ request "/getContacts.php", params
66
+ end
67
+
68
+ def get_contacts_by_company(params={})
69
+ raise "company_id is required" if params[:company_id].nil?
70
+ request "/getContactsByCompany.php", params
71
+ end
72
+
73
+ def get_contact_company_relations(params={})
74
+ raise "amount is required" if params[:amount].nil?
75
+ raise "pageno is required" if params[:pageno].nil?
76
+ request "/getContactCompanyRelations.php", params
77
+ end
78
+
38
79
  # Returns the ID of the company
39
80
  def add_company(params={})
40
81
  raise "name is required" if params[:name].nil?
@@ -103,11 +144,6 @@ module Teamleader
103
144
  request "/getProduct.php", params
104
145
  end
105
146
 
106
- def get_product(params={})
107
- raise "product_id is required" if params[:product_id].nil?
108
- request "/getProduct.php", params
109
- end
110
-
111
147
  def get_products(params={})
112
148
  raise "amount is required" if params[:amount].nil?
113
149
  raise "pageno is required" if params[:pageno].nil?
@@ -1,3 +1,3 @@
1
1
  module Teamleader
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teamleader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre-Yves Orban