Sha256: 47e3bae60ec64ed4f3a9c6219d038b0208da2b3f05d0be83f4396f89248e01e4

Contents?: true

Size: 930 Bytes

Versions: 3

Compression:

Stored size: 930 Bytes

Contents

# frozen_string_literal: true

require 'mitake/version'
require 'mitake/credential'
require 'mitake/balance'
require 'mitake/message'

# The Mitake API Client
#
# @since 0.1.0
module Mitake
  # @since 0.1.0
  # @api private
  LOCK = Mutex.new

  # Switch credential
  #
  # @param credential [Mitake::Credential] the api credential
  # @param _block [Proc] the actions use specify credential
  #
  # @since 0.1.0
  def self.use(credential, &_block)
    temp = credential
    LOCK.synchronize do
      self.credential = credential
      yield
      self.credential = temp
    end
  end

  # The credential
  #
  # @return [Mitake::Credential] the current credential
  #
  # @since 0.1.0
  def self.credential
    @credential ||= Credential.new
  end

  # Set credential
  #
  # @param credential [Mitake::Credential] the new credential
  #
  # @since 0.1.0
  def self.credential=(credential)
    @credential = credential
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mitake-0.1.2 lib/mitake.rb
mitake-0.1.1 lib/mitake.rb
mitake-0.1.0 lib/mitake.rb