Sha256: c0cb4a9eb3beb4c502f258b4cf6a3bb3606416c9ddcebc3726767a25f249d62f
Contents?: true
Size: 1.18 KB
Versions: 1
Compression:
Stored size: 1.18 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' 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fractal_api-0.1.3 | lib/fractal_api.rb |