Class: PapierkramApi::Client
- Inherits:
-
Object
- Object
- PapierkramApi::Client
- Extended by:
- Forwardable
- Defined in:
- lib/papierkram_api/client.rb
Overview
The Client class is the main entry point for the Papierkram API Client.
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#client ⇒ Object
Returns the value of attribute client.
-
#remaining_quota ⇒ Object
Returns the value of attribute remaining_quota.
-
#subdomain ⇒ Object
Returns the value of attribute subdomain.
Instance Method Summary collapse
- #banking_bank_connections ⇒ Object
- #banking_transactions ⇒ Object
- #build_client! ⇒ Object
- #contact_companies ⇒ Object
- #contact_companies_persons ⇒ Object
- #expense_vouchers ⇒ Object
- #income_estimates ⇒ Object
- #income_invoices ⇒ Object
- #income_payment_terms ⇒ Object
- #income_propositions ⇒ Object
- #info ⇒ Object
-
#initialize(subdomain = nil, api_key = nil) ⇒ Client
constructor
A new instance of Client.
- #projects ⇒ Object
- #tracker_tasks ⇒ Object
- #tracker_time_entries ⇒ Object
Constructor Details
#initialize(subdomain = nil, api_key = nil) ⇒ Client
Returns a new instance of Client.
16 17 18 19 20 21 22 |
# File 'lib/papierkram_api/client.rb', line 16 def initialize(subdomain = nil, api_key = nil) @subdomain = subdomain || ENV.fetch('PAPIERKRAM_API_SUBDOMAIN', nil) @api_key = api_key || ENV.fetch('PAPIERKRAM_API_KEY', nil) @base_url = base_url_env @remaining_quota = nil build_client! end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
6 7 8 |
# File 'lib/papierkram_api/client.rb', line 6 def api_key @api_key end |
#base_url ⇒ Object
Returns the value of attribute base_url.
6 7 8 |
# File 'lib/papierkram_api/client.rb', line 6 def base_url @base_url end |
#client ⇒ Object
Returns the value of attribute client.
6 7 8 |
# File 'lib/papierkram_api/client.rb', line 6 def client @client end |
#remaining_quota ⇒ Object
Returns the value of attribute remaining_quota.
6 7 8 |
# File 'lib/papierkram_api/client.rb', line 6 def remaining_quota @remaining_quota end |
#subdomain ⇒ Object
Returns the value of attribute subdomain.
6 7 8 |
# File 'lib/papierkram_api/client.rb', line 6 def subdomain @subdomain end |
Instance Method Details
#banking_bank_connections ⇒ Object
36 37 38 39 |
# File 'lib/papierkram_api/client.rb', line 36 def banking_bank_connections @banking_bank_connections ||= PapierkramApi::V1::Endpoints::Banking::BankConnections.new(@client) end |
#banking_transactions ⇒ Object
41 42 43 44 |
# File 'lib/papierkram_api/client.rb', line 41 def banking_transactions @banking_transactions ||= PapierkramApi::V1::Endpoints::Banking::Transactions.new(@client) end |
#build_client! ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/papierkram_api/client.rb', line 24 def build_client! @client = Faraday.new(url: @base_url) do |config| config.request :authorization, 'Bearer', @api_key config.request :multipart config.request :json config.response :json config.adapter :httpx yield(config) if block_given? end end |
#contact_companies ⇒ Object
46 47 48 49 |
# File 'lib/papierkram_api/client.rb', line 46 def contact_companies @contact_companies ||= PapierkramApi::V1::Endpoints::Contact::Companies.new(@client) end |
#contact_companies_persons ⇒ Object
51 52 53 54 |
# File 'lib/papierkram_api/client.rb', line 51 def contact_companies_persons @contact_companies_persons ||= PapierkramApi::V1::Endpoints::Contact::CompaniesPersons.new(@client) end |
#expense_vouchers ⇒ Object
56 57 58 59 |
# File 'lib/papierkram_api/client.rb', line 56 def expense_vouchers @expense_vouchers ||= PapierkramApi::V1::Endpoints::Expense::Vouchers.new(@client) end |
#income_estimates ⇒ Object
61 62 63 64 |
# File 'lib/papierkram_api/client.rb', line 61 def income_estimates @income_estimates ||= PapierkramApi::V1::Endpoints::Income::Estimates.new(@client) end |
#income_invoices ⇒ Object
66 67 68 69 |
# File 'lib/papierkram_api/client.rb', line 66 def income_invoices @income_invoices ||= PapierkramApi::V1::Endpoints::Income::Invoices.new(@client) end |
#income_payment_terms ⇒ Object
71 72 73 74 |
# File 'lib/papierkram_api/client.rb', line 71 def income_payment_terms @income_payment_terms ||= PapierkramApi::V1::Endpoints::Income::PaymentTerms.new(@client) end |
#income_propositions ⇒ Object
76 77 78 79 |
# File 'lib/papierkram_api/client.rb', line 76 def income_propositions @income_propositions ||= PapierkramApi::V1::Endpoints::Income::Propositions.new(@client) end |
#info ⇒ Object
81 82 83 84 |
# File 'lib/papierkram_api/client.rb', line 81 def info @info ||= PapierkramApi::V1::Endpoints::Info.new(@client) end |
#projects ⇒ Object
86 87 88 89 |
# File 'lib/papierkram_api/client.rb', line 86 def projects @projects ||= PapierkramApi::V1::Endpoints::Projects.new(@client) end |
#tracker_tasks ⇒ Object
91 92 93 94 |
# File 'lib/papierkram_api/client.rb', line 91 def tracker_tasks @tracker_tasks ||= PapierkramApi::V1::Endpoints::Tracker::Tasks.new(@client) end |
#tracker_time_entries ⇒ Object
96 97 98 99 |
# File 'lib/papierkram_api/client.rb', line 96 def tracker_time_entries @tracker_time_entries ||= PapierkramApi::V1::Endpoints::Tracker::TimeEntries.new(@client) end |