Sha256: 6710cc5b4b6215c7b40aca35ec939a7c16f3e113d8d0d2337fdcfabfa2a41344

Contents?: true

Size: 774 Bytes

Versions: 4

Compression:

Stored size: 774 Bytes

Contents

# frozen_string_literal: true

require 'capital_on_tap/version'
require 'capital_on_tap/configuration'
require 'capital_on_tap/connection'
require 'capital_on_tap/auth'
require 'capital_on_tap/application'

module CapitalOnTap
  module_function

  def configuration
    @configuration ||= Configuration.new
  end

  def connection
    @connection ||= setup_connection!
  end

  def configure
    yield(configuration)
  end

  def setup_connection!
    token_params = CapitalOnTap::Auth.obtain_token

    raise "ERROR: #{token_params[:error_description]}" if token_params[:error]

    @connection = Connection.new(
      access_token: token_params[:access_token],
      expires_in: token_params[:expires_in],
      refresh_token: token_params[:refresh_token]
    )
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
capital_on_tap-1.0.1 lib/capital_on_tap.rb
capital_on_tap-1.0.0 lib/capital_on_tap.rb
capital_on_tap-0.2.1 lib/capital_on_tap.rb
capital_on_tap-0.2.0 lib/capital_on_tap.rb