teamleader 0.1.1 → 0.2.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
- MWY1YWIxZjQ4Njc0NmM3ZTJjMmU3N2FlNzgwM2QwMmViMDJlNGQ4Zg==
4
+ NTBmOGY3MWIyMWQ0NmU5YzY1MGEwNzY3NDY0ZjkxMjQ3YmZkN2Y5ZQ==
5
5
  data.tar.gz: !binary |-
6
- OTlkYjQyMzIwNTZiMzNlMmEyMDljNWExN2EzNDc3ODgyZGZjNzgzZA==
6
+ YjYyZDQxY2QxOTA3NWEwMzQxMTlkNWMxYTE3OWM4MzA3MzkzOWZhZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- N2VmMGNmYTE2OGE3ZDczNTliZGFiYWIzMGM2OTI1NTJjYmRhMDMyNTY4MDZh
10
- OWRkZmMwYzViMTk1N2M2NDZjZGQzN2E3N2FkYzk5MWY4ZmE3NTA1NzhkNDdh
11
- ZjFkOGNiNDg3YzRiNWJlYzI5NDBkMzNlMDRkOGExMTZiNDljMDE=
9
+ ODU3M2Q0YTQ0NGYyYjNiNDViMmJlMDM0NDIyYWUwMWNmOWE3YWI5MWIxM2Fm
10
+ ZDJiZjIyYjcyMmVkYWUzZmU2NTNhZGQ1OTc3ZDllNTQ1N2ExYmFmMWYwZDMz
11
+ NDdhZWVmMmRhMDk4NThhN2IwMjhlMTI5NGVhY2Q1MWVkZWFiNjc=
12
12
  data.tar.gz: !binary |-
13
- YWM0MTA2YTEwYTk4MDAyOWU1OTUzNDgzNTM5YTFhNzcyZTM2ZjgxMWI0YTM0
14
- ZDMyZDgyNDY2MTZkNzAyZDM5ZjNjNzJkNTNmMWFhMjMzNjRkMDU2YWFkYjg5
15
- NTY2ZGRlZjkxOTA3ODYyYTc3MjU5NTkyNzcwOWE0ZTI4ZmQxZjM=
13
+ Yjc2N2IyMDEwNDBkYWNmMzI2ZDlmZWY0NGY5OTNiNWZiNzI5NDM4N2FlNWU4
14
+ MzYzMjg1MTZlZjliOTYxMTA5Y2FkODFkYmI0MGY3M2MxYTc2MzI1MmRjMmYy
15
+ OGYxZmIwZDk5MzVhNWM4YjZkODFlOWNjODc2NWNiZDY5YmUzMzE=
data/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [0.2.0] - 2017-05-12
5
+ ### Added
6
+ - Method `link_contact_to_company`
7
+ - Methods for Products (add, update, delete, get one, get all)
8
+ - Methods for Invoice (add, update payment status, get PDF, get one, get all)
9
+ - Update `get_company` to accept an Hash instead of an id as parameter
10
+
4
11
  ## [0.1.1] - 2017-05-12
5
12
  ### Changed
6
13
  - Mark `json` dependency version as `>= 1`
@@ -41,8 +41,9 @@ module Teamleader
41
41
  request "/addCompany.php", params
42
42
  end
43
43
 
44
- def get_company(id)
45
- request "/getCompany.php", {:company_id => id}
44
+ def get_company(params={})
45
+ raise "company_id is required" if params[:company_id].nil?
46
+ request "/getCompany.php", params
46
47
  end
47
48
 
48
49
  def get_companies(params={})
@@ -52,14 +53,27 @@ module Teamleader
52
53
  end
53
54
 
54
55
  def add_invoice(params={})
55
- raise "contact_or_company" if params[:contact_or_company].nil?
56
- raise "contact_or_company_id" if params[:contact_or_company_id].nil?
57
- raise "sys_department_id" if params[:sys_department_id].nil?
56
+ raise "contact_or_company is required" if params[:contact_or_company].nil?
57
+ raise "contact_or_company_id is required" if params[:contact_or_company_id].nil?
58
+ raise "sys_department_id is required" if params[:sys_department_id].nil?
58
59
  request "/addInvoice.php", params
59
60
  end
60
61
 
61
- def get_invoice(id)
62
- request "/getInvoice.php", {:invoice_id => id}
62
+ def update_invoice_payment_status(params={})
63
+ raise "invoice_id is required" if params[:invoice_id].nil?
64
+ raise "status is required" if params[:status].nil?
65
+ raise "status must be 'paid' or 'not_paid'" unless ['paid', 'not_paid'].include?(params[:status])
66
+ request "/setInvoicePaymentStatus.php", params
67
+ end
68
+
69
+ def get_invoice(params={})
70
+ raise "invoice_id is required" if params[:invoice_id].nil?
71
+ request "/getInvoice.php", params
72
+ end
73
+
74
+ def download_invoice_pdf(params={})
75
+ raise "invoice_id is required" if params[:invoice_id].nil?
76
+ request "/downloadInvoicePDF.php", params
63
77
  end
64
78
 
65
79
  def get_invoices(params={})
@@ -68,6 +82,38 @@ module Teamleader
68
82
  request "/getInvoices.php", params
69
83
  end
70
84
 
85
+ def add_product(params={})
86
+ raise "name is required" if params[:name].nil?
87
+ raise "price is required" if params[:price].nil?
88
+ request "/addProduct.php", params
89
+ end
90
+
91
+ def update_product(params={})
92
+ raise "product_id is required" if params[:product_id].nil?
93
+ request "/updateProduct.php", params
94
+ end
95
+
96
+ def delete_product(params={})
97
+ raise "product_id is required" if params[:product_id].nil?
98
+ request "/deleteProduct.php", params
99
+ end
100
+
101
+ def get_product(params={})
102
+ raise "product_id is required" if params[:product_id].nil?
103
+ request "/getProduct.php", params
104
+ end
105
+
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
+ def get_products(params={})
112
+ raise "amount is required" if params[:amount].nil?
113
+ raise "pageno is required" if params[:pageno].nil?
114
+ request "/getProducts.php", params
115
+ end
116
+
71
117
  private
72
118
  def request(path, data={})
73
119
  headers = {
@@ -1,3 +1,3 @@
1
1
  module Teamleader
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.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.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre-Yves Orban