Sha256: 083581a17e5f83f4bca52c5ea47fdc7d652e91e1501c941eb1123ad17a3e5e64
Contents?: true
Size: 946 Bytes
Versions: 7
Compression:
Stored size: 946 Bytes
Contents
# frozen_string_literal: true module Stripe class Instrumentation class RequestEvent attr_reader :duration attr_reader :http_status attr_reader :method attr_reader :num_retries attr_reader :path def initialize(duration:, http_status:, method:, num_retries:, path:) @duration = duration @http_status = http_status @method = method @num_retries = num_retries @path = path freeze end end def self.subscribe(topic, name = rand, &block) subscribers[topic][name] = block name end def self.unsubscribe(topic, name) subscribers[topic].delete(name) end def self.notify(topic, event) subscribers[topic].each_value { |subscriber| subscriber.call(event) } end def self.subscribers @subscribers ||= Hash.new { |hash, key| hash[key] = {} } end private_class_method :subscribers end end
Version data entries
7 entries across 7 versions & 1 rubygems