papierkram_api_client 0.1.3 → 0.2.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 +4 -4
- data/.rubocop.yml +5 -0
- data/CHANGELOG.md +13 -0
- data/Gemfile.lock +3 -3
- data/README.md +155 -55
- data/lib/papierkram_api/client.rb +92 -0
- data/lib/papierkram_api/v1/business_intelligence/base.rb +23 -0
- data/lib/papierkram_api/v1/business_intelligence/expenses_by_category.rb +98 -0
- data/lib/papierkram_api/v1/business_intelligence/smart_queries/expense_vouchers_for_month_in_year.rb +58 -0
- data/lib/papierkram_api/v1/endpoints/banking/bank_connections.rb +30 -0
- data/lib/papierkram_api/v1/endpoints/banking/transactions.rb +20 -0
- data/lib/papierkram_api/v1/endpoints/base.rb +77 -0
- data/lib/papierkram_api/v1/endpoints/contact/companies.rb +30 -0
- data/lib/papierkram_api/v1/endpoints/contact/companies_persons.rb +28 -0
- data/lib/papierkram_api/v1/endpoints/expense/vouchers.rb +45 -0
- data/lib/papierkram_api/v1/endpoints/income/estimates.rb +46 -0
- data/lib/papierkram_api/v1/endpoints/income/invoices.rb +46 -0
- data/lib/papierkram_api/v1/endpoints/income/propositions.rb +20 -0
- data/lib/papierkram_api/v1/endpoints/info.rb +14 -0
- data/lib/papierkram_api/v1/endpoints/projects.rb +26 -0
- data/lib/papierkram_api/v1/endpoints/tracker/tasks.rb +33 -0
- data/lib/papierkram_api/v1/endpoints/tracker/time_entries.rb +62 -0
- data/lib/papierkram_api/v1/helper/date_helper.rb +14 -0
- data/lib/{api → papierkram_api}/v1/helper/pdf_from_response.rb +1 -1
- data/lib/papierkram_api/v1/validators/expense_voucher.rb +105 -0
- data/lib/papierkram_api_client/version.rb +1 -1
- data/lib/papierkram_api_client.rb +21 -102
- metadata +22 -16
- data/lib/api/v1/banking/bank_connections.rb +0 -28
- data/lib/api/v1/banking/transactions.rb +0 -18
- data/lib/api/v1/base.rb +0 -75
- data/lib/api/v1/contact/companies.rb +0 -28
- data/lib/api/v1/contact/companies_persons.rb +0 -26
- data/lib/api/v1/expense/vouchers.rb +0 -43
- data/lib/api/v1/income/estimates.rb +0 -44
- data/lib/api/v1/income/invoices.rb +0 -44
- data/lib/api/v1/income/propositions.rb +0 -18
- data/lib/api/v1/info.rb +0 -12
- data/lib/api/v1/projects.rb +0 -24
- data/lib/api/v1/tracker/tasks.rb +0 -31
- data/lib/api/v1/tracker/time_entries.rb +0 -59
data/lib/api/v1/tracker/tasks.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Api
|
4
|
-
module V1
|
5
|
-
module Tracker
|
6
|
-
# This class is responsible for all the API calls related to tracker tasks connections.
|
7
|
-
class Tasks < Api::V1::Base
|
8
|
-
def by(id:)
|
9
|
-
get("#{@url_api_path}/tracker/tasks/#{id}")
|
10
|
-
end
|
11
|
-
|
12
|
-
def all(page: 1,
|
13
|
-
page_size: 100,
|
14
|
-
order_by: nil,
|
15
|
-
order_direction: nil,
|
16
|
-
project_id: nil,
|
17
|
-
proposition_id: nil)
|
18
|
-
query = {
|
19
|
-
page: page,
|
20
|
-
page_size: page_size
|
21
|
-
}
|
22
|
-
query[:order_by] = order_by if order_by
|
23
|
-
query[:order_direction] = order_direction if order_direction
|
24
|
-
query[:project_id] = project_id if project_id
|
25
|
-
query[:proposition_id] = proposition_id if proposition_id
|
26
|
-
get("#{@url_api_path}/tracker/tasks", query)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Api
|
4
|
-
module V1
|
5
|
-
module Tracker
|
6
|
-
# This class is responsible for all the API calls related to tracker time entries connections.
|
7
|
-
class TimeEntries < Api::V1::Base
|
8
|
-
def by(id:)
|
9
|
-
get("#{@url_api_path}/tracker/time_entries/#{id}")
|
10
|
-
end
|
11
|
-
|
12
|
-
def all(page: 1, # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/MethodLength
|
13
|
-
page_size: 100,
|
14
|
-
order_by: nil,
|
15
|
-
order_direction: nil,
|
16
|
-
project_id: nil,
|
17
|
-
task_id: nil,
|
18
|
-
invoice_id: nil,
|
19
|
-
user_id: nil,
|
20
|
-
billing_state: nil,
|
21
|
-
start_time_range_start: nil,
|
22
|
-
start_time_range_end: nil)
|
23
|
-
validate!(billing_state: billing_state,
|
24
|
-
start_time_range_start: start_time_range_start,
|
25
|
-
start_time_range_end: start_time_range_end)
|
26
|
-
|
27
|
-
query = {
|
28
|
-
page: page,
|
29
|
-
page_size: page_size
|
30
|
-
}
|
31
|
-
query[:order_by] = order_by if order_by
|
32
|
-
query[:order_direction] = order_direction if order_direction
|
33
|
-
query[:project_id] = project_id if project_id
|
34
|
-
query[:task_id] = task_id if task_id
|
35
|
-
query[:invoice_id] = invoice_id if invoice_id
|
36
|
-
query[:user_id] = user_id if user_id
|
37
|
-
query[:billing_state] = billing_state if billing_state
|
38
|
-
query[:start_time_range_start] = start_time_range_start if start_time_range_start
|
39
|
-
query[:start_time_range_end] = start_time_range_end if start_time_range_end
|
40
|
-
get("#{@url_api_path}/tracker/time_entries", query)
|
41
|
-
end
|
42
|
-
|
43
|
-
private
|
44
|
-
|
45
|
-
def validate!(billing_state:, start_time_range_start:, start_time_range_end:)
|
46
|
-
if billing_state && !%w[billed unbilled billable unbillable archived].include?(billing_state)
|
47
|
-
raise ArgumentError, 'billing_state must be one of: "billed" "unbilled"" billable" "unbillable" "archived"'
|
48
|
-
end
|
49
|
-
if start_time_range_start && !start_time_range_start.is_a?(Time)
|
50
|
-
raise ArgumentError, 'start_time_range_start must be a Time object'
|
51
|
-
end
|
52
|
-
return unless start_time_range_end && !start_time_range_end.is_a?(Time)
|
53
|
-
|
54
|
-
raise ArgumentError, 'start_time_range_end must be a Time object'
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|