teamleader 0.16.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fe8a0c9461b19848e4ac64e19937c65951435ebd
4
- data.tar.gz: f469750c1ffb54cfaf5f46eca34ea044e060a0b8
3
+ metadata.gz: e19b86af8da9c3bb702b39d9d7a237756a633040
4
+ data.tar.gz: 6922099520faa620154c4c56f490b1ca19d53733
5
5
  SHA512:
6
- metadata.gz: 17521b7288b35701004fba5da4d20ed068de81088485dde20736308b652ebfbf0f1929daa21a97d55cf718c9c7138030759cec30e8c6684fc0fe4e5763c4ed29
7
- data.tar.gz: 0a5bcaca3b174db050711cede6f5c78a7915aa7ab082f3a326842a4c0fc00faee9a48dd028deac7835ef99a4168a622512d7d29114e50b7b15ca2dbe033a0969
6
+ metadata.gz: 9118e9d7cbf51857b42eb42f523a08c5e2294d67c5dceb9eedadb9e66aa2a284bd89721a95b68df13c9f0496c402dfa7203b435082367b1d15df5e677f06c856
7
+ data.tar.gz: a89b64ee641eb1133c6886496040e45cd6a4ae83cb6760c8c3a81cf9a1a18a1667b54e4ced25d9e999b5a1116c659d6f72ddaa3e31633dfc976cd34c69da00c3
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.17.0] - 2020-04-09
5
+ - `get_all_subscriptions` method accepts optional parameters (like `selected_customfields` or `searchby`)
6
+ - New methods related to subscriptions: `add_subscription`, `update_subscription`, `delete_subscription`, `get_subscription`, `get_invoices_by_subscription`, `get_related_subscriptions_by_invoice`, `get_subscriptions_by_deal`, `get_subscriptions_by_contact_or_company`
7
+
4
8
  ## [0.16.0] - 2019-05-10
5
9
  - New method related to custom fields: `get_custom_fields`, `get_custom_field_info`, `add_custom_field_option`
6
10
 
data/README.md CHANGED
@@ -2,7 +2,9 @@
2
2
 
3
3
  A ruby wrapper around Teamleader.eu API v1.
4
4
 
5
- **Some endpoints are still missing. Don't hesitate to open an issue or a PR if you need one of them.**
5
+ **Please note that this gem is linked to the [deprecated Teamleader API](https://apidocs.teamleader.be/). Teamleader recommends to use the [new Teamleader API](https://developer.teamleader.eu/).**
6
+
7
+ Some endpoints are still missing. Don't hesitate to open an issue or a PR if you need one of them.
6
8
 
7
9
  ## Installation
8
10
 
@@ -189,7 +191,7 @@ teamleader.get_call(call_id: '123456')
189
191
  ```
190
192
 
191
193
  ### Subscriptions
192
- Available methods are: `get_subscriptions`, `get_all_subscriptions`
194
+ Available methods are: `get_subscriptions`, `get_all_subscriptions`, `add_subscription`, `update_subscription`, `delete_subscription`, `get_subscription`, `get_invoices_by_subscription`, `get_related_subscriptions_by_invoice`, `get_subscriptions_by_deal`, `get_subscriptions_by_contact_or_company`
193
195
 
194
196
  ### Custom Fields
195
197
  Available methods are: `get_custom_fields`, `get_custom_field_info`, `add_custom_field_option`
@@ -375,12 +375,6 @@ module Teamleader
375
375
  request "/getBusinessTypes.php", params
376
376
  end
377
377
 
378
- def get_subscriptions(params={})
379
- raise "amount is required" if params[:amount].nil?
380
- raise "pageno is required" if params[:pageno].nil?
381
- request "/getSubscriptions.php", params
382
- end
383
-
384
378
  private
385
379
 
386
380
  def request(path, data={})
@@ -0,0 +1,48 @@
1
+ module Teamleader
2
+ module Subscriptions
3
+ def add_subscription(params={})
4
+ required_params(%i[contact_or_company contact_or_company_id sys_department_id date_start repeat_after title], params)
5
+ request '/addSubscription.php', params
6
+ end
7
+
8
+ def update_subscription(params={})
9
+ required_params(%i[subscription_id], params)
10
+ request '/updateSubscription.php', params
11
+ end
12
+
13
+ def delete_subscription(params={})
14
+ required_params(%i[subscription_id], params)
15
+ request '/deleteSubscription.php', params
16
+ end
17
+
18
+ def get_subscriptions(params={})
19
+ required_params(%i[amount pageno], params)
20
+ request "/getSubscriptions.php", params
21
+ end
22
+
23
+ def get_subscription(params={})
24
+ required_params(%i[subscription_id], params)
25
+ request '/getSubscription.php', params
26
+ end
27
+
28
+ def get_invoices_by_subscription(params={})
29
+ required_params(%i[subscription_id], params)
30
+ request '/getInvoicesBySubscription.php', params
31
+ end
32
+
33
+ def get_related_subscriptions_by_invoice(params={})
34
+ required_params(%i[invoice_id], params)
35
+ request '/getRelatedSubscriptionsByInvoice.php', params
36
+ end
37
+
38
+ def get_subscriptions_by_deal(params={})
39
+ required_params(%i[deal_id], params)
40
+ request '/getSubscriptionsByDeal.php', params
41
+ end
42
+
43
+ def get_subscriptions_by_contact_or_company(params={})
44
+ required_params(%i[contact_or_company contact_or_company_id], params)
45
+ request '/getSubscriptionsByContactOrCompany.php', params
46
+ end
47
+ end
48
+ end
@@ -3,11 +3,11 @@ module Teamleader
3
3
  # The Api class is a 1-1 mapping with Teamleader API v1
4
4
  # The ExtendedApi adds some utility methods
5
5
  class ExtendedApi < Api
6
- def get_all_subscriptions
6
+ def get_all_subscriptions(**args)
7
7
  subscriptions = []
8
8
  pageno = 0
9
9
  loop do
10
- results = self.get_subscriptions(pageno: pageno, amount: 100)
10
+ results = self.get_subscriptions((args || {}).merge({pageno: pageno, amount: 100}))
11
11
  subscriptions.concat(results)
12
12
  pageno += 1
13
13
  break if results.length == 0
@@ -15,4 +15,4 @@ module Teamleader
15
15
  subscriptions
16
16
  end
17
17
  end
18
- end
18
+ end
@@ -1,3 +1,3 @@
1
1
  module Teamleader
2
- VERSION = "0.16.0"
2
+ VERSION = "0.17.0"
3
3
  end
data/teamleader.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.require_paths = ["lib"]
21
21
 
22
22
  spec.add_development_dependency "bundler", "~> 1.8"
23
- spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "rake", ">= 12.3.3"
24
24
  spec.add_development_dependency 'rspec', "~> 3.6"
25
25
  spec.add_development_dependency "vcr", "~> 3.0"
26
26
  spec.add_development_dependency "typhoeus", "~> 1.1"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teamleader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre-Yves Orban
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-10 00:00:00.000000000 Z
11
+ date: 2020-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: 12.3.3
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: 12.3.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -117,6 +117,7 @@ files:
117
117
  - lib/teamleader/api/custom_fields.rb
118
118
  - lib/teamleader/api/files.rb
119
119
  - lib/teamleader/api/projects.rb
120
+ - lib/teamleader/api/subscriptions.rb
120
121
  - lib/teamleader/configuration.rb
121
122
  - lib/teamleader/extended_api.rb
122
123
  - lib/teamleader/version.rb