teamleader 0.2.0 → 0.3.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.
- checksums.yaml +8 -8
- data/CHANGELOG.md +4 -0
- data/README.md +43 -3
- data/lib/teamleader/api.rb +41 -5
- data/lib/teamleader/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NThkMjM5MmRhNzc0MWM4MjBlNjhkOGIyMjY2ZmUyNDY4YWI3NGViMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
M2UwOWJkNDc1MTMwOGY4ZDFiYWQ2MTFjOTdhNWFjMzg4ZDAxNmVjNQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZjhhMzQ2MTU3OGE5NWQxZjMwZTcwNzMzNmQyNTM2NmEwMjAzNjc0YzAzZTZm
|
10
|
+
MDc5ZTI3ZDY5NTUyMjNjZjNhZjc4YTZjYjBkYWQ5NzVlZDM1NjZiZmZmMzA4
|
11
|
+
MzI1MDQ0ZjRkNDAxNWI1ODVlMDJkMTZmZjM3NjNkODUzY2QwNjU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
-
###
|
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.
|
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
|
|
data/lib/teamleader/api.rb
CHANGED
@@ -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?
|
data/lib/teamleader/version.rb
CHANGED