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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +5 -0
  3. data/CHANGELOG.md +13 -0
  4. data/Gemfile.lock +3 -3
  5. data/README.md +155 -55
  6. data/lib/papierkram_api/client.rb +92 -0
  7. data/lib/papierkram_api/v1/business_intelligence/base.rb +23 -0
  8. data/lib/papierkram_api/v1/business_intelligence/expenses_by_category.rb +98 -0
  9. data/lib/papierkram_api/v1/business_intelligence/smart_queries/expense_vouchers_for_month_in_year.rb +58 -0
  10. data/lib/papierkram_api/v1/endpoints/banking/bank_connections.rb +30 -0
  11. data/lib/papierkram_api/v1/endpoints/banking/transactions.rb +20 -0
  12. data/lib/papierkram_api/v1/endpoints/base.rb +77 -0
  13. data/lib/papierkram_api/v1/endpoints/contact/companies.rb +30 -0
  14. data/lib/papierkram_api/v1/endpoints/contact/companies_persons.rb +28 -0
  15. data/lib/papierkram_api/v1/endpoints/expense/vouchers.rb +45 -0
  16. data/lib/papierkram_api/v1/endpoints/income/estimates.rb +46 -0
  17. data/lib/papierkram_api/v1/endpoints/income/invoices.rb +46 -0
  18. data/lib/papierkram_api/v1/endpoints/income/propositions.rb +20 -0
  19. data/lib/papierkram_api/v1/endpoints/info.rb +14 -0
  20. data/lib/papierkram_api/v1/endpoints/projects.rb +26 -0
  21. data/lib/papierkram_api/v1/endpoints/tracker/tasks.rb +33 -0
  22. data/lib/papierkram_api/v1/endpoints/tracker/time_entries.rb +62 -0
  23. data/lib/papierkram_api/v1/helper/date_helper.rb +14 -0
  24. data/lib/{api → papierkram_api}/v1/helper/pdf_from_response.rb +1 -1
  25. data/lib/papierkram_api/v1/validators/expense_voucher.rb +105 -0
  26. data/lib/papierkram_api_client/version.rb +1 -1
  27. data/lib/papierkram_api_client.rb +21 -102
  28. metadata +22 -16
  29. data/lib/api/v1/banking/bank_connections.rb +0 -28
  30. data/lib/api/v1/banking/transactions.rb +0 -18
  31. data/lib/api/v1/base.rb +0 -75
  32. data/lib/api/v1/contact/companies.rb +0 -28
  33. data/lib/api/v1/contact/companies_persons.rb +0 -26
  34. data/lib/api/v1/expense/vouchers.rb +0 -43
  35. data/lib/api/v1/income/estimates.rb +0 -44
  36. data/lib/api/v1/income/invoices.rb +0 -44
  37. data/lib/api/v1/income/propositions.rb +0 -18
  38. data/lib/api/v1/info.rb +0 -12
  39. data/lib/api/v1/projects.rb +0 -24
  40. data/lib/api/v1/tracker/tasks.rb +0 -31
  41. data/lib/api/v1/tracker/time_entries.rb +0 -59
@@ -0,0 +1,105 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PapierkramApi
4
+ module V1
5
+ module Validators
6
+ # ExpenseVoucher Validator
7
+ class ExpenseVoucher
8
+ # Copied from https://simonneutert.papierkram.de/api/v1/api-docs/index.html
9
+ SWAGGER_SAMPLE = {
10
+ type: 'expense_voucher',
11
+ id: 385,
12
+ name: 'Restaurant visit',
13
+ due_date: '2020-06-30',
14
+ document_date: '2020-06-14',
15
+ description: 'Took customer for dinner.',
16
+ entertainment_reason: 'sales meeting',
17
+ flagged: true,
18
+ provenance: 'domestic',
19
+ voucher_no: 'B-EXP-0001',
20
+ state: 'unpaid',
21
+ record_state: 'active',
22
+ amount: 165.8,
23
+ invoice_amount: 0,
24
+ entertainment_persons: [],
25
+ creditor: {
26
+ type: 'company',
27
+ id: 4814,
28
+ name: 'Ristorante Il Porcino',
29
+ contact_type: 'supplier',
30
+ supplier_no: 'L-00001',
31
+ customer_no: nil,
32
+ email: nil,
33
+ phone: nil,
34
+ website: nil,
35
+ twitter: nil,
36
+ fax: nil,
37
+ postal_street: 'Dotzheimer Str. 36',
38
+ postal_zip: '65185',
39
+ postal_city: 'Wiesbaden',
40
+ postal_country: 'Deutschland',
41
+ physical_street: nil,
42
+ physical_zip: nil,
43
+ physical_city: nil,
44
+ physical_country: 'Deutschland',
45
+ delivery_method: nil,
46
+ ust_idnr: 'BE0999999999',
47
+ logo_file_name: nil,
48
+ logo_content_type: nil,
49
+ logo_file_size: nil,
50
+ logo_updated_at: nil,
51
+ bank_blz: '79351010',
52
+ bank_institute: 'Sparkasse Bad Kissingen',
53
+ bank_account_no: '789456123',
54
+ bank_bic: 'MARKDEFFXXX',
55
+ bank_sepa_mandate_reference: 'SEPAMRL00001RIP',
56
+ bank_sepa_mandate_accepted: nil,
57
+ bank_iban: 'DE68210501700012345678',
58
+ inbound_address: 'emkx',
59
+ notes: nil,
60
+ record_state: 'active',
61
+ flagged: nil,
62
+ created_at: '2023-04-04T10:14:16.000+02:00',
63
+ updated_at: '2023-04-04T10:14:16.000+02:00',
64
+ color: nil
65
+ },
66
+ line_items: [
67
+ {
68
+ name: 'restaurant bill',
69
+ amount: 150.8,
70
+ category: 'Bewirtungskosten',
71
+ vat_rate: '19%',
72
+ billing: nil,
73
+ depreciation: nil
74
+ },
75
+ {
76
+ name: 'tip',
77
+ amount: 15,
78
+ category: 'Bewirtungskosten',
79
+ vat_rate: '19%',
80
+ billing: nil,
81
+ depreciation: nil
82
+ }
83
+ ],
84
+ documents: [
85
+ {
86
+ type: 'document',
87
+ id: 30,
88
+ uri: 'http://test.odacer.com/system/attachments/1/documents/30/7e6274cdeac3ecfdd1e5c746f6378e5229ddfd0d/data/original/sample.pdf?1680596056'
89
+ }
90
+ ]
91
+ }.freeze
92
+ SWAGGER_SAMPLE_KEYS_STRINGIFIED = SWAGGER_SAMPLE.keys.map(&:to_s).sort.freeze
93
+
94
+ def validate!(expense_voucher)
95
+ unless expense_voucher['type'] == 'expense_voucher' &&
96
+ expense_voucher.keys.sort == SWAGGER_SAMPLE_KEYS_STRINGIFIED
97
+ raise ArgumentError, 'expense_voucher does not match the expected format'
98
+ end
99
+
100
+ true
101
+ end
102
+ end
103
+ end
104
+ end
105
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PapierkramApiClient
4
- VERSION = '0.1.3'
4
+ VERSION = '0.2.0'
5
5
  end
@@ -6,105 +6,24 @@ require 'forwardable'
6
6
  require 'tempfile'
7
7
 
8
8
  require_relative 'papierkram_api_client/version'
9
- require_relative 'api/v1/base'
10
- require_relative 'api/v1/banking/bank_connections'
11
- require_relative 'api/v1/banking/transactions'
12
- require_relative 'api/v1/contact/companies'
13
- require_relative 'api/v1/contact/companies_persons'
14
- require_relative 'api/v1/expense/vouchers'
15
- require_relative 'api/v1/income/estimates'
16
- require_relative 'api/v1/income/invoices'
17
- require_relative 'api/v1/income/propositions'
18
- require_relative 'api/v1/info'
19
- require_relative 'api/v1/projects'
20
- require_relative 'api/v1/tracker/tasks'
21
- require_relative 'api/v1/tracker/time_entries'
22
-
23
- module PapierkramApiClient
24
- class Error < StandardError; end
25
-
26
- # The Client class is the main entry point for the Papierkram API Client.
27
- class Client
28
- attr_accessor :client,
29
- :subdomain,
30
- :api_key,
31
- :base_url,
32
- :remaining_quota
33
-
34
- extend Forwardable
35
- def_delegators :@client, :get, :post, :put, :patch, :delete
36
-
37
- def initialize(subdomain = nil, api_key = nil)
38
- @subdomain = subdomain || ENV.fetch('PAPIERKRAM_API_SUBDOMAIN', nil)
39
- @api_key = api_key || ENV.fetch('PAPIERKRAM_API_KEY', nil)
40
- @base_url = base_url_env
41
- @remaining_quota = nil
42
- build_client!
43
- end
44
-
45
- def build_client!
46
- @client = Faraday.new(url: @base_url) do |config|
47
- config.request :authorization, 'Bearer', @api_key
48
- config.request :json
49
- config.response :json
50
- config.adapter :httpx
51
- yield(config) if block_given?
52
- end
53
- end
54
-
55
- def banking_bank_connections
56
- @banking_bank_connections ||= Api::V1::Banking::BankConnections.new(@client)
57
- end
58
-
59
- def banking_transactions
60
- raise ArgumentError, 'not implemented'
61
- # @banking_transactions ||= Api::V1::Banking::Transactions.new(@client)
62
- end
63
-
64
- def contact_companies
65
- @contact_companies ||= Api::V1::Contact::Companies.new(@client)
66
- end
67
-
68
- def contact_companies_persons
69
- @contact_companies_persons ||= Api::V1::Contact::CompaniesPersons.new(@client)
70
- end
71
-
72
- def expense_vouchers
73
- @expense_vouchers ||= Api::V1::Expense::Vouchers.new(@client)
74
- end
75
-
76
- def income_estimates
77
- @income_estimates ||= Api::V1::Income::Estimates.new(@client)
78
- end
79
-
80
- def income_invoices
81
- @income_invoices ||= Api::V1::Income::Invoices.new(@client)
82
- end
83
-
84
- def income_propositions
85
- @income_propositions ||= Api::V1::Income::Propositions.new(@client)
86
- end
87
-
88
- def info
89
- @info ||= Api::V1::Info.new(@client)
90
- end
91
-
92
- def projects
93
- @projects ||= Api::V1::Projects.new(@client)
94
- end
95
-
96
- def tracker_tasks
97
- @tracker_tasks ||= Api::V1::Tracker::Tasks.new(@client)
98
- end
99
-
100
- def tracker_time_entries
101
- @tracker_time_entries ||= Api::V1::Tracker::TimeEntries.new(@client)
102
- end
103
-
104
- private
105
-
106
- def base_url_env
107
- "https://#{@subdomain}.papierkram.de"
108
- end
109
- end
110
- end
9
+ require_relative 'papierkram_api/v1/helper/pdf_from_response'
10
+ require_relative 'papierkram_api/v1/helper/date_helper'
11
+ require_relative 'papierkram_api/v1/validators/expense_voucher'
12
+ require_relative 'papierkram_api/v1/endpoints/base'
13
+ require_relative 'papierkram_api/v1/endpoints/banking/bank_connections'
14
+ require_relative 'papierkram_api/v1/endpoints/banking/transactions'
15
+ require_relative 'papierkram_api/v1/endpoints/contact/companies'
16
+ require_relative 'papierkram_api/v1/endpoints/contact/companies_persons'
17
+ require_relative 'papierkram_api/v1/endpoints/expense/vouchers'
18
+ require_relative 'papierkram_api/v1/endpoints/income/estimates'
19
+ require_relative 'papierkram_api/v1/endpoints/income/invoices'
20
+ require_relative 'papierkram_api/v1/endpoints/income/propositions'
21
+ require_relative 'papierkram_api/v1/endpoints/info'
22
+ require_relative 'papierkram_api/v1/endpoints/projects'
23
+ require_relative 'papierkram_api/v1/endpoints/tracker/tasks'
24
+ require_relative 'papierkram_api/v1/endpoints/tracker/time_entries'
25
+ require_relative 'papierkram_api/v1/business_intelligence/base'
26
+ require_relative 'papierkram_api/v1/business_intelligence/expenses_by_category'
27
+ require_relative 'papierkram_api/v1/business_intelligence/smart_queries/expense_vouchers_for_month_in_year'
28
+
29
+ require_relative 'papierkram_api/client'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: papierkram_api_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Neutert
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-04-15 00:00:00.000000000 Z
11
+ date: 2023-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -56,20 +56,26 @@ files:
56
56
  - LICENSE.txt
57
57
  - README.md
58
58
  - Rakefile
59
- - lib/api/v1/banking/bank_connections.rb
60
- - lib/api/v1/banking/transactions.rb
61
- - lib/api/v1/base.rb
62
- - lib/api/v1/contact/companies.rb
63
- - lib/api/v1/contact/companies_persons.rb
64
- - lib/api/v1/expense/vouchers.rb
65
- - lib/api/v1/helper/pdf_from_response.rb
66
- - lib/api/v1/income/estimates.rb
67
- - lib/api/v1/income/invoices.rb
68
- - lib/api/v1/income/propositions.rb
69
- - lib/api/v1/info.rb
70
- - lib/api/v1/projects.rb
71
- - lib/api/v1/tracker/tasks.rb
72
- - lib/api/v1/tracker/time_entries.rb
59
+ - lib/papierkram_api/client.rb
60
+ - lib/papierkram_api/v1/business_intelligence/base.rb
61
+ - lib/papierkram_api/v1/business_intelligence/expenses_by_category.rb
62
+ - lib/papierkram_api/v1/business_intelligence/smart_queries/expense_vouchers_for_month_in_year.rb
63
+ - lib/papierkram_api/v1/endpoints/banking/bank_connections.rb
64
+ - lib/papierkram_api/v1/endpoints/banking/transactions.rb
65
+ - lib/papierkram_api/v1/endpoints/base.rb
66
+ - lib/papierkram_api/v1/endpoints/contact/companies.rb
67
+ - lib/papierkram_api/v1/endpoints/contact/companies_persons.rb
68
+ - lib/papierkram_api/v1/endpoints/expense/vouchers.rb
69
+ - lib/papierkram_api/v1/endpoints/income/estimates.rb
70
+ - lib/papierkram_api/v1/endpoints/income/invoices.rb
71
+ - lib/papierkram_api/v1/endpoints/income/propositions.rb
72
+ - lib/papierkram_api/v1/endpoints/info.rb
73
+ - lib/papierkram_api/v1/endpoints/projects.rb
74
+ - lib/papierkram_api/v1/endpoints/tracker/tasks.rb
75
+ - lib/papierkram_api/v1/endpoints/tracker/time_entries.rb
76
+ - lib/papierkram_api/v1/helper/date_helper.rb
77
+ - lib/papierkram_api/v1/helper/pdf_from_response.rb
78
+ - lib/papierkram_api/v1/validators/expense_voucher.rb
73
79
  - lib/papierkram_api_client.rb
74
80
  - lib/papierkram_api_client/version.rb
75
81
  - pac.svg
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Api
4
- module V1
5
- module Banking
6
- # This class is responsible for all the API calls related to banking bank connections.
7
- class BankConnections < Api::V1::Base
8
- def by(id:)
9
- get("#{@url_api_path}/banking/bank_connections/#{id}")
10
- end
11
-
12
- def all(page: 1,
13
- page_size: 100,
14
- order_by: nil,
15
- order_direction: nil)
16
- query = {
17
- page: page,
18
- page_size: page_size
19
- }
20
- query[:order_by] = order_by if order_by
21
- query[:order_direction] = order_direction if order_direction
22
-
23
- get("#{@url_api_path}/banking/bank_connections", query)
24
- end
25
- end
26
- end
27
- end
28
- end
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Api
4
- module V1
5
- module Banking
6
- # This class is responsible for all the API calls related to banking transactions.
7
- class Transactions
8
- def by(id:)
9
- # wip
10
- end
11
-
12
- def all
13
- # wip
14
- end
15
- end
16
- end
17
- end
18
- end
data/lib/api/v1/base.rb DELETED
@@ -1,75 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Api
4
- module V1
5
- # This class is the base class for all the API calls.
6
- class Base
7
- attr_reader :client, :url_api_path
8
-
9
- def initialize(client)
10
- @client = client
11
- @url_api_path = '/api/v1'
12
- end
13
-
14
- def remaining_quota(response)
15
- return response.headers['x-remaining-quota'].to_i if response.is_a?(Faraday::Response)
16
- raise ArgumentError, 'Invalid response object' unless response.is_a?(Hash)
17
-
18
- quota = response.dig('headers', 'x-remaining-quota') || response['x-remaining-quota']
19
- return Integer(quota) if quota
20
-
21
- raise ArgumentError, "No remaining quota found in response: #{response}"
22
- end
23
-
24
- def get(url, params = {}, headers = {})
25
- validate_get!(params)
26
- call_wrapper!(:get, url, params, headers)
27
- end
28
-
29
- def post(url, params = {}, headers = {})
30
- call_wrapper!(:post, url, params, headers)
31
- end
32
-
33
- def put(url, params = {}, headers = {})
34
- call_wrapper!(:put, url, params, headers)
35
- end
36
-
37
- def patch(url, params = {}, headers = {})
38
- call_wrapper!(:patch, url, params, headers)
39
- end
40
-
41
- def delete(url, params = {}, headers = {})
42
- call_wrapper!(:delete, url, params, headers)
43
- end
44
-
45
- private
46
-
47
- def call_wrapper!(method, url, params = {}, headers = {})
48
- @client.send(method, url, params, headers)
49
- end
50
-
51
- def validate_order_direction!(order_direction)
52
- return if order_direction.nil?
53
-
54
- raise ArgumentError, 'Invalid order direction' unless %w[asc desc].include?(order_direction)
55
- end
56
-
57
- def validate_billing_state!(billing_state)
58
- return if billing_state.nil?
59
-
60
- raise ArgumentError, 'Invalid billing state' unless %w[billed
61
- unbilled
62
- billable
63
- unbillable
64
- archived].include?(billing_state)
65
- end
66
-
67
- def validate_get!(params)
68
- return unless params
69
-
70
- validate_order_direction!(params[:order_direction])
71
- validate_billing_state!(params[:billing_state])
72
- end
73
- end
74
- end
75
- end
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Api
4
- module V1
5
- module Contact
6
- # This class is responsible for all the API calls related to banking bank connections.
7
- class Companies < Api::V1::Base
8
- def by(id:)
9
- get("#{@url_api_path}/contact/companies/#{id}")
10
- end
11
-
12
- def all(page: 1,
13
- page_size: 100,
14
- order_by: nil,
15
- order_direction: nil)
16
- query = {
17
- page: page,
18
- page_size: page_size
19
- }
20
- query[:order_by] = order_by if order_by
21
- query[:order_direction] = order_direction if order_direction
22
-
23
- get("#{@url_api_path}/contact/companies", query)
24
- end
25
- end
26
- end
27
- end
28
- end
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Api
4
- module V1
5
- module Contact
6
- # This class is responsible for all the API calls related to companies' persons connections.
7
- class CompaniesPersons < Api::V1::Base
8
- def by(company_id:, id:)
9
- get("#{@url_api_path}/contact/companies/#{company_id}/persons/#{id}")
10
- end
11
-
12
- def all(company_id:, page: 1, page_size: 100, order_by: nil, order_direction: nil)
13
- query = {
14
- company_id: company_id,
15
- page: page,
16
- page_size: page_size
17
- }
18
- query[:order_by] = order_by if order_by
19
- query[:order_direction] = order_direction if order_direction
20
-
21
- get("#{@url_api_path}/contact/companies/#{company_id}/persons", query)
22
- end
23
- end
24
- end
25
- end
26
- end
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Api
4
- module V1
5
- module Expense
6
- # This class is responsible for all the API calls related to expense vouchers.
7
- class Vouchers < Api::V1::Base
8
- def by(id:, pdf: false)
9
- if pdf == true
10
- return get("#{@url_api_path}/expense/vouchers/#{id}/pdf", nil,
11
- { headers: { 'Content-Type' => 'application/pdf' } })
12
- end
13
- get("#{@url_api_path}/expense/vouchers/#{id}")
14
- end
15
-
16
- def all(page: 1, # rubocop:disable Metrics/CyclomaticComplexity
17
- page_size: 100,
18
- order_by: nil,
19
- order_direction: nil,
20
- creditor_id: nil,
21
- project_id: nil,
22
- document_date_range_start: nil,
23
- document_date_range_end: nil)
24
- query = {
25
- page: page,
26
- page_size: page_size
27
- }
28
- query[:order_by] = order_by if order_by
29
- query[:order_direction] = order_direction if order_direction
30
- query[:creditor_id] = creditor_id if creditor_id
31
- query[:project_id] = project_id if project_id
32
- query[:document_date_range_start] = document_date_range_start if document_date_range_start
33
- if document_date_range_end && document_date_range_start
34
- query[:document_date_range_end] =
35
- document_date_range_end
36
- end
37
-
38
- get("#{@url_api_path}/expense/vouchers", query)
39
- end
40
- end
41
- end
42
- end
43
- end
@@ -1,44 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Api
4
- module V1
5
- module Income
6
- # This class is responsible for all the API calls related to income estimates.
7
- class Estimates < Api::V1::Base
8
- def by(id:, pdf: false)
9
- if pdf == true
10
- return get("#{@url_api_path}/income/estimates/#{id}/pdf", nil,
11
- { headers: { 'Content-Type' => 'application/pdf' } })
12
- end
13
-
14
- get("#{@url_api_path}/income/estimates/#{id}")
15
- end
16
-
17
- def all(page: 1, # rubocop:disable Metrics/CyclomaticComplexity
18
- page_size: 100,
19
- order_by: nil,
20
- order_direction: nil,
21
- creditor_id: nil,
22
- project_id: nil,
23
- document_date_range_start: nil,
24
- document_date_range_end: nil)
25
- query = {
26
- page: page,
27
- page_size: page_size
28
- }
29
- query[:order_by] = order_by if order_by
30
- query[:order_direction] = order_direction if order_direction
31
- query[:creditor_id] = creditor_id if creditor_id
32
- query[:project_id] = project_id if project_id
33
- query[:document_date_range_start] = document_date_range_start if document_date_range_start
34
- if document_date_range_end && document_date_range_start
35
- query[:document_date_range_end] =
36
- document_date_range_end
37
- end
38
-
39
- get("#{@url_api_path}/income/estimates", query)
40
- end
41
- end
42
- end
43
- end
44
- end
@@ -1,44 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Api
4
- module V1
5
- module Income
6
- # This class is responsible for all the API calls related to income invoices.
7
- class Invoices < Api::V1::Base
8
- def by(id:, pdf: false)
9
- if pdf == true
10
- return get("#{@url_api_path}/income/invoices/#{id}/pdf", nil,
11
- { headers: { 'Content-Type' => 'application/pdf' } })
12
- end
13
-
14
- get("#{@url_api_path}/income/invoices/#{id}")
15
- end
16
-
17
- def all(page: 1, # rubocop:disable Metrics/CyclomaticComplexity
18
- page_size: 100,
19
- order_by: nil,
20
- order_direction: nil,
21
- creditor_id: nil,
22
- project_id: nil,
23
- document_date_range_start: nil,
24
- document_date_range_end: nil)
25
- query = {
26
- page: page,
27
- page_size: page_size
28
- }
29
- query[:order_by] = order_by if order_by
30
- query[:order_direction] = order_direction if order_direction
31
- query[:creditor_id] = creditor_id if creditor_id
32
- query[:project_id] = project_id if project_id
33
- query[:document_date_range_start] = document_date_range_start if document_date_range_start
34
- if document_date_range_end && document_date_range_start
35
- query[:document_date_range_end] =
36
- document_date_range_end
37
- end
38
-
39
- get("#{@url_api_path}/income/invoices", query)
40
- end
41
- end
42
- end
43
- end
44
- end
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Api
4
- module V1
5
- module Income
6
- # This class is responsible for all the API calls related to income propositions.
7
- class Propositions < Api::V1::Base
8
- def by(id:)
9
- get("#{@url_api_path}/income/propositions/#{id}")
10
- end
11
-
12
- def all
13
- get("#{@url_api_path}/income/propositions")
14
- end
15
- end
16
- end
17
- end
18
- end
data/lib/api/v1/info.rb DELETED
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Api
4
- module V1
5
- # This class is responsible for all the API calls related to info connections.
6
- class Info < Api::V1::Base
7
- def details
8
- get("#{@url_api_path}/info")
9
- end
10
- end
11
- end
12
- end
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Api
4
- module V1
5
- # This class is responsible for all the API calls related to projects connections.
6
- class Projects < Api::V1::Base
7
- def by(id:)
8
- get("#{@url_api_path}/projects/#{id}")
9
- end
10
-
11
- def all(page: 1, per_page: 100, order_by: nil, order_direction: nil, company_id: nil)
12
- query = {
13
- page: page,
14
- per_page: per_page
15
- }
16
- query[:order_by] = order_by if order_by
17
- query[:order_direction] = order_direction if order_direction
18
- query[:company_id] = company_id if company_id
19
-
20
- get("#{@url_api_path}/projects", query)
21
- end
22
- end
23
- end
24
- end