Sha256: f68ec5a3a2f85b073ae4c3f0d0cc19195ee5124ef362dc3fa31b7fe974732920

Contents?: true

Size: 623 Bytes

Versions: 1

Compression:

Stored size: 623 Bytes

Contents

# frozen_string_literal: true

require "dry-struct"
require "forwardable"
require "yookassa/version"
require "yookassa/config"
require "yookassa/client"

module Yookassa
  ConfigError = Class.new(StandardError)

  class << self
    extend Forwardable

    def configure
      yield(config)
    end

    def config
      @config ||= Config.new
    end

    def client
      raise ConfigError, "Specify `shop_id` and `api_key` settins in a `.configure` block" if @config.nil?

      @client ||= Client.new(shop_id: @config.shop_id, api_key: @config.api_key)
    end

    def_delegators :client, :payments, :refunds
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
yookassa-0.2.0 lib/yookassa.rb