зеркало из
https://github.com/glebtv/yookassa.git
synced 2026-09-07 03:15:50 +03:00
Preparing clients for partner api (#25)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
6072b2ae0f
Коммит
7f79ffa4b4
@@ -4,11 +4,11 @@ require "dry-struct"
|
||||
require "forwardable"
|
||||
require "yookassa/version"
|
||||
require "yookassa/config"
|
||||
require "yookassa/client"
|
||||
require "yookassa/payments"
|
||||
require "yookassa/refunds"
|
||||
require "yookassa/receipts"
|
||||
|
||||
module Yookassa
|
||||
ConfigError = Class.new(StandardError)
|
||||
|
||||
class << self
|
||||
extend Forwardable
|
||||
|
||||
@@ -20,18 +20,16 @@ module Yookassa
|
||||
@config ||= Config.new
|
||||
end
|
||||
|
||||
def client
|
||||
raise ConfigError, "Specify `shop_id` and `api_key` settings in a `.configure` block" if @config.nil?
|
||||
|
||||
@client ||= Client.new(shop_id: @config.shop_id, api_key: @config.api_key)
|
||||
def payments
|
||||
@payments ||= Payments.new
|
||||
end
|
||||
|
||||
def partner_api
|
||||
@partner_api ||= PartnerAPI.new
|
||||
def refunds
|
||||
@refunds ||= Refunds.new
|
||||
end
|
||||
|
||||
def_delegators :client, :payments, :refunds, :receipts
|
||||
|
||||
def_delegators :partner_api, :stores, :webhooks
|
||||
def receipts
|
||||
@receipts ||= Receipts.new
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Ссылка в новой задаче
Block a user