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
- #business_intelligence ⇒ 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.
15 16 17 18 19 20 21 |
# File 'lib/papierkram_api/client.rb', line 15 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
40 41 42 43 |
# File 'lib/papierkram_api/client.rb', line 40 def banking_bank_connections @banking_bank_connections ||= PapierkramApi::V1::Endpoints::Banking::BankConnections.new(@client) end |
#banking_transactions ⇒ Object
45 46 47 48 |
# File 'lib/papierkram_api/client.rb', line 45 def banking_transactions @banking_transactions ||= PapierkramApi::V1::Endpoints::Banking::Transactions.new(@client) end |
#build_client! ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/papierkram_api/client.rb', line 23 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 |
#business_intelligence ⇒ Object
35 36 37 38 |
# File 'lib/papierkram_api/client.rb', line 35 def business_intelligence @business_intelligence ||= PapierkramApi::V1::BusinessIntelligence::Base.new end |
#contact_companies ⇒ Object
50 51 52 53 |
# File 'lib/papierkram_api/client.rb', line 50 def contact_companies @contact_companies ||= PapierkramApi::V1::Endpoints::Contact::Companies.new(@client) end |
#contact_companies_persons ⇒ Object
55 56 57 58 |
# File 'lib/papierkram_api/client.rb', line 55 def contact_companies_persons @contact_companies_persons ||= PapierkramApi::V1::Endpoints::Contact::CompaniesPersons.new(@client) end |
#expense_vouchers ⇒ Object
60 61 62 63 |
# File 'lib/papierkram_api/client.rb', line 60 def expense_vouchers @expense_vouchers ||= PapierkramApi::V1::Endpoints::Expense::Vouchers.new(@client) end |
#income_estimates ⇒ Object
65 66 67 68 |
# File 'lib/papierkram_api/client.rb', line 65 def income_estimates @income_estimates ||= PapierkramApi::V1::Endpoints::Income::Estimates.new(@client) end |
#income_invoices ⇒ Object
70 71 72 73 |
# File 'lib/papierkram_api/client.rb', line 70 def income_invoices @income_invoices ||= PapierkramApi::V1::Endpoints::Income::Invoices.new(@client) end |
#income_payment_terms ⇒ Object
75 76 77 78 |
# File 'lib/papierkram_api/client.rb', line 75 def income_payment_terms @income_payment_terms ||= PapierkramApi::V1::Endpoints::Income::PaymentTerms.new(@client) end |
#income_propositions ⇒ Object
80 81 82 83 |
# File 'lib/papierkram_api/client.rb', line 80 def income_propositions @income_propositions ||= PapierkramApi::V1::Endpoints::Income::Propositions.new(@client) end |
#info ⇒ Object
85 86 87 88 |
# File 'lib/papierkram_api/client.rb', line 85 def info @info ||= PapierkramApi::V1::Endpoints::Info.new(@client) end |
#projects ⇒ Object
90 91 92 93 |
# File 'lib/papierkram_api/client.rb', line 90 def projects @projects ||= PapierkramApi::V1::Endpoints::Projects.new(@client) end |
#tracker_tasks ⇒ Object
95 96 97 98 |
# File 'lib/papierkram_api/client.rb', line 95 def tracker_tasks @tracker_tasks ||= PapierkramApi::V1::Endpoints::Tracker::Tasks.new(@client) end |
#tracker_time_entries ⇒ Object
100 101 102 103 |
# File 'lib/papierkram_api/client.rb', line 100 def tracker_time_entries @tracker_time_entries ||= PapierkramApi::V1::Endpoints::Tracker::TimeEntries.new(@client) end |