Sha256: d14a301355d719b897afbc38c9c3489257c0571c0c86ed3ee70afb09e0e6544e
Contents?: true
Size: 1.22 KB
Versions: 3
Compression:
Stored size: 1.22 KB
Contents
# frozen_string_literal: true require 'fractal_api/version' require 'fractal_api/authenticate' require 'fractal_api/client' require 'fractal_api/configuration' require 'fractal_api/company' require 'fractal_api/bank' require 'fractal_api/consent' require 'fractal_api/bank_account' require 'fractal_api/balance' require 'fractal_api/transaction' require 'fractal_api/forecasting/forecast' require 'fractal_api/forecasting/balance' require 'fractal_api/forecasting/transaction' require 'fractal_api/webhook_notification' module FractalApi module_function def configure yield(configuration) end def client @client ||= Client.new end def configuration @configuration ||= Configuration.new end # Sets global token for the duration of the block # Token is set in Thread local variable, # so it's usable in the current Thread only (sidekiq job, rails request, etc.) # # MUST not be nested in another +with_global_token+ block def with_global_token Thread.current[:fractal_api_token] = Authenticate.new.call( configuration.api_key, configuration.partner_id ) yield ensure Thread.current[:fractal_api_token] = nil end def global_token Thread.current[:fractal_api_token] end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fractal_api-0.1.6 | lib/fractal_api.rb |
fractal_api-0.1.5 | lib/fractal_api.rb |
fractal_api-0.1.4 | lib/fractal_api.rb |