Module: Yookassa

Defined in:
lib/yookassarb.rb,
lib/yookassa/client.rb,
lib/yookassa/errors.rb,
lib/yookassa/version.rb,
lib/yookassa/configuration.rb,
lib/yookassa/entities/base.rb,
lib/yookassa/entities/deal.rb,
lib/yookassa/resources/base.rb,
lib/yookassa/resources/deal.rb,
lib/yookassa/entities/payout.rb,
lib/yookassa/entities/refund.rb,
lib/yookassa/entities/payment.rb,
lib/yookassa/entities/receipt.rb,
lib/yookassa/middleware/retry.rb,
lib/yookassa/resources/payout.rb,
lib/yookassa/resources/refund.rb,
lib/yookassa/resources/invoice.rb,
lib/yookassa/resources/payment.rb,
lib/yookassa/resources/receipt.rb,
lib/yookassa/resources/webhook.rb,
lib/yookassa/resources/settings.rb,
lib/yookassa/webhook/ip_checker.rb,
lib/yookassa/entities/collection.rb,
lib/yookassa/webhook/event_types.rb,
lib/yookassa/entities/webhook_obj.rb,
lib/yookassa/webhook/notification.rb,
lib/yookassa/middleware/idempotency.rb,
lib/yookassa/middleware/error_handler.rb

Overview

Ruby SDK for the YooKassa payment gateway API.

Defined Under Namespace

Modules: Entities, Middleware, Resources, Webhook Classes: ApiError, BadRequestError, Client, Configuration, ConnectionError, Deal, Error, ForbiddenError, InternalServerError, NotFoundError, Payment, Payout, Receipt, Refund, ResourceShortcut, TimeoutError, TooManyRequestsError, UnauthorizedError

Constant Summary collapse

VERSION =

Current gem version.

"0.1.1"

Class Method Summary collapse

Class Method Details

.configurationConfiguration

Returns the global Configuration instance, creating one if needed.

Returns:



78
79
80
# File 'lib/yookassarb.rb', line 78

def configuration
  @configuration ||= Configuration.new
end

.configure {|config| ... } ⇒ Configuration

Yields the global Configuration instance for setting credentials.

Examples:

Yookassa.configure do |config|
  config.shop_id = "123456"
  config.api_key = "live_..."
end

Yields:

  • (config)

    the configuration object

Yield Parameters:

Returns:



70
71
72
73
# File 'lib/yookassarb.rb', line 70

def configure
  yield(configuration) if block_given?
  configuration
end

.default_clientClient

Returns the shared Client built from the global configuration. Lazily initialized on first call.

Returns:



94
95
96
97
98
99
100
101
102
103
104
# File 'lib/yookassarb.rb', line 94

def default_client
  @default_client ||= Client.new(
    shop_id: configuration.shop_id,
    api_key: configuration.api_key,
    auth_token: configuration.auth_token,
    timeout: configuration.timeout,
    max_retries: configuration.max_retries,
    retry_delay: configuration.retry_delay,
    logger: configuration.logger
  )
end

.reset_configuration!void

This method returns an undefined value.

Resets global configuration and the default client to initial state.



85
86
87
88
# File 'lib/yookassarb.rb', line 85

def reset_configuration!
  @configuration = Configuration.new
  @default_client = nil
end