repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/spec/lib/sbmt/outbox/v2/poll_throttler/redis_queue_size_spec.rb | spec/lib/sbmt/outbox/v2/poll_throttler/redis_queue_size_spec.rb | # frozen_string_literal: true
require "sbmt/outbox/v2/poller"
require "sbmt/outbox/v2/poll_throttler/redis_queue_size"
describe Sbmt::Outbox::V2::PollThrottler::RedisQueueSize do
let(:delay) { 0.1 }
let(:min_size) { -1 }
let(:max_size) { 10 }
let(:task) do
Sbmt::Outbox::V2::Tasks::Poll.new(
item_cl... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/spec/lib/sbmt/outbox/v2/poll_throttler/redis_queue_time_lag_spec.rb | spec/lib/sbmt/outbox/v2/poll_throttler/redis_queue_time_lag_spec.rb | # frozen_string_literal: true
require "sbmt/outbox/v2/poller"
require "sbmt/outbox/v2/poll_throttler/redis_queue_time_lag"
describe Sbmt::Outbox::V2::PollThrottler::RedisQueueTimeLag do
let(:delay) { 0.1 }
let(:min_lag) { 5 }
let(:task) do
Sbmt::Outbox::V2::Tasks::Poll.new(
item_class: InboxItem, wor... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/spec/lib/sbmt/outbox/v2/poll_throttler/composite_spec.rb | spec/lib/sbmt/outbox/v2/poll_throttler/composite_spec.rb | # frozen_string_literal: true
require "sbmt/outbox/v2/poller"
require "sbmt/outbox/v2/poll_throttler/composite"
require "sbmt/outbox/v2/poll_throttler/rate_limited"
require "sbmt/outbox/v2/poll_throttler/redis_queue_size"
describe Sbmt::Outbox::V2::PollThrottler::Composite do
let(:delay) { 0.1 }
let(:redis) { ins... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/spec/lib/sbmt/outbox/v2/poll_throttler/paused_box_spec.rb | spec/lib/sbmt/outbox/v2/poll_throttler/paused_box_spec.rb | # frozen_string_literal: true
require "sbmt/outbox/v2/poller"
require "sbmt/outbox/v2/poll_throttler/paused_box"
describe Sbmt::Outbox::V2::PollThrottler::PausedBox do
let(:throttler) { described_class.new }
let(:task) do
Sbmt::Outbox::V2::Tasks::Poll.new(
item_class: InboxItem, worker_name: "poller", p... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/spec/config/schked_spec.rb | spec/config/schked_spec.rb | # frozen_string_literal: true
require "rails_helper"
describe Schked do
let(:worker) { described_class.worker.tap(&:pause) }
let(:time_zone) { "UTC" }
around do |ex|
Time.use_zone(time_zone) do
travel_to(start_time, &ex)
end
end
describe "Sbmt::Outbox::DeleteStaleOutboxItemsJob" do
let(... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt-outbox.rb | lib/sbmt-outbox.rb | # frozen_string_literal: true
require_relative "sbmt/outbox"
| ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/generators/outbox.rb | lib/generators/outbox.rb | # frozen_string_literal: true
require "rails/generators"
require_relative "helpers"
module Outbox
module Generators
class Base < Rails::Generators::Base
include Helpers::Config
include Helpers::Initializer
include Helpers::Paas
end
class NamedBase < Rails::Generators::NamedBase
... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/generators/helpers.rb | lib/generators/helpers.rb | # frozen_string_literal: true
require_relative "helpers/config"
require_relative "helpers/initializer"
require_relative "helpers/items"
require_relative "helpers/migration"
require_relative "helpers/paas"
require_relative "helpers/values"
| ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/generators/outbox/item/item_generator.rb | lib/generators/outbox/item/item_generator.rb | # frozen_string_literal: true
require "generators/outbox"
module Outbox
module Generators
class ItemGenerator < NamedBase
source_root File.expand_path("templates", __dir__)
class_option :kind, type: :string, desc: "Either inbox or outbox", banner: "inbox/outbox", required: true
class_option :... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/generators/outbox/transport/transport_generator.rb | lib/generators/outbox/transport/transport_generator.rb | # frozen_string_literal: true
require "generators/outbox"
module Outbox
module Generators
class TransportGenerator < NamedBase
source_root File.expand_path("templates", __dir__)
argument :transport, required: true, type: :string, banner: "sbmt/kafka_producer"
class_option :kind, type: :strin... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/generators/outbox/install/install_generator.rb | lib/generators/outbox/install/install_generator.rb | # frozen_string_literal: true
require "generators/outbox"
module Outbox
module Generators
class InstallGenerator < Base
source_root File.expand_path("templates", __dir__)
class_option :skip_outboxfile, type: :boolean, default: false, desc: "Skip creating Outboxfile"
class_option :skip_initial... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/generators/outbox/install/templates/outbox.rb | lib/generators/outbox/install/templates/outbox.rb | # frozen_string_literal: true
Rails.application.config.outbox.tap do |config|
config.redis = {url: ENV.fetch("REDIS_URL", "redis://127.0.0.1:6379")}
end
| ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/generators/helpers/items.rb | lib/generators/helpers/items.rb | # frozen_string_literal: true
module Outbox
module Generators
module Helpers
module Items
def namespaced_item_class_name
file_path.camelize
end
def item_path
file_path
end
end
end
end
end
| ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/generators/helpers/initializer.rb | lib/generators/helpers/initializer.rb | # frozen_string_literal: true
module Outbox
module Generators
module Helpers
module Initializer
OUTBOX_INITIALIZER_PATH = "config/initializers/outbox.rb"
private
def add_item_to_initializer(attr_name)
template_data_with_push = <<~RUBY
"#{namespaced_item_class... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/generators/helpers/paas.rb | lib/generators/helpers/paas.rb | # frozen_string_literal: true
module Outbox
module Generators
module Helpers
module Paas
APP_MANIFEST_PATH = "configs/app.toml"
private
def paas_app?
File.exist?(APP_MANIFEST_PATH)
end
end
end
end
end
| ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/generators/helpers/values.rb | lib/generators/helpers/values.rb | # frozen_string_literal: true
module Outbox
module Generators
module Helpers
module Values
VALUES_PATH = "configs/values.yaml"
private
def add_item_to_values(deployment_name, item_path)
template_data = <<~RUBY
#{deployment_name}:
replicas:
... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/generators/helpers/config.rb | lib/generators/helpers/config.rb | # frozen_string_literal: true
module Outbox
module Generators
module Helpers
module Config
CONFIG_PATH = "config/outbox.yml"
private
def config_exists?
File.exist?(CONFIG_PATH)
end
def check_config!
return if config_exists?
if yes?("... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/generators/helpers/migration.rb | lib/generators/helpers/migration.rb | # frozen_string_literal: true
module Outbox
module Generators
module Helpers
module Migration
private
def create_migration_file(migration_class_name, migration_table_name)
return false if find_existing_migration(migration_class_name.tableize)
result = generate "rails:m... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox.rb | lib/sbmt/outbox.rb | # frozen_string_literal: true
require "rails"
require "active_job"
require "active_record"
require "dry-initializer"
require "dry-monads"
require "dry/monads/do"
require "yabeda"
require "exponential_backoff"
require "cutoff"
require "http_health_check"
require "redis-client"
require "connection_pool"
require "ostruct... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/version.rb | lib/sbmt/outbox/version.rb | # frozen_string_literal: true
module Sbmt
module Outbox
VERSION = "7.0.1"
end
end
| ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/logger.rb | lib/sbmt/outbox/logger.rb | # frozen_string_literal: true
module Sbmt
module Outbox
class Logger
delegate :logger, to: :Rails
def log_debug(message, **params)
with_tags(**params) do
logger.debug(message)
end
end
def log_info(message, **params)
with_tags(**params) do
logg... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/errors.rb | lib/sbmt/outbox/errors.rb | # frozen_string_literal: true
module Sbmt
module Outbox
class Error < StandardError
end
class ConfigError < Error
end
class DatabaseError < Error
end
end
end
| ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/error_tracker.rb | lib/sbmt/outbox/error_tracker.rb | # frozen_string_literal: true
module Sbmt
module Outbox
class ErrorTracker
class << self
def error(message, params = {})
unless defined?(Sentry)
Outbox.logger.log_error(message, **params)
return
end
Sentry.with_scope do |scope|
scop... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/redis_client_factory.rb | lib/sbmt/outbox/redis_client_factory.rb | # frozen_string_literal: true
module Sbmt
module Outbox
module RedisClientFactory
def self.build(options)
options = options.deep_symbolize_keys
unless options.key?(:reconnect_attempts)
options[:reconnect_attempts] = 3
end
if options.key?(:sentinels)
if ... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/enum_refinement.rb | lib/sbmt/outbox/enum_refinement.rb | # frozen_string_literal: true
module Sbmt
module Outbox
module EnumRefinement
refine ActiveRecord::Base.singleton_class do
def enum(name, values = nil)
if Rails::VERSION::MAJOR >= 7
super
else
super(name => values)
end
end
end
... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/ascii_art.rb | lib/sbmt/outbox/ascii_art.rb | # frozen_string_literal: true
module Sbmt
module Outbox
module AsciiArt
module_function
def logo
<<~'TEXT'
@@@@@@@ ... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/cli.rb | lib/sbmt/outbox/cli.rb | # frozen_string_literal: true
require "thor"
require "sbmt/outbox/ascii_art"
module Sbmt
module Outbox
class CLI < Thor
def self.exit_on_failure?
true
end
default_command :start
desc "start", "Start outbox worker"
option :box,
aliases: "-b",
repeatable: tr... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/database_switcher.rb | lib/sbmt/outbox/database_switcher.rb | # frozen_string_literal: true
module Sbmt
module Outbox
class DatabaseSwitcher
def self.use_slave
yield
end
def self.use_master
yield
end
end
end
end
| ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/engine.rb | lib/sbmt/outbox/engine.rb | # frozen_string_literal: true
require "rails/engine"
module Sbmt
module Outbox
class Engine < Rails::Engine
isolate_namespace Sbmt::Outbox
config.outbox = ActiveSupport::OrderedOptions.new.tap do |c|
c.active_record_base_class = "ApplicationRecord"
c.active_job_base_class = "Applica... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/middleware/runner.rb | lib/sbmt/outbox/middleware/runner.rb | # frozen_string_literal: true
module Sbmt
module Outbox
module Middleware
class Runner
attr_reader :stack
def initialize(stack)
@stack = stack
end
def call(*args)
return yield if stack.empty?
chain = stack.map { |i| i.new }
traverse... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/middleware/builder.rb | lib/sbmt/outbox/middleware/builder.rb | # frozen_string_literal: true
module Sbmt
module Outbox
module Middleware
class Builder
def initialize(middlewares)
middlewares.each { |middleware| stack << middleware }
end
def call(...)
Runner.new(stack.dup).call(...)
end
private
def ... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/middleware/sentry/transaction.rb | lib/sbmt/outbox/middleware/sentry/transaction.rb | # frozen_string_literal: true
module Sbmt
module Outbox
module Middleware
module Sentry
module Transaction
def start_sentry_transaction(scope, op, name, tags = {})
trace_id = SecureRandom.base58
scope&.set_tags(tags.merge(trace_id: trace_id))
transactio... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/middleware/sentry/tracing_batch_process_middleware.rb | lib/sbmt/outbox/middleware/sentry/tracing_batch_process_middleware.rb | # frozen_string_literal: true
require "sbmt/outbox/middleware/sentry/transaction"
module Sbmt
module Outbox
module Middleware
module Sentry
class TracingBatchProcessMiddleware
include Transaction
def call(job)
return yield unless ::Sentry.initialized?
... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/middleware/sentry/tracing_item_process_middleware.rb | lib/sbmt/outbox/middleware/sentry/tracing_item_process_middleware.rb | # frozen_string_literal: true
require "sbmt/outbox/middleware/sentry/transaction"
module Sbmt
module Outbox
module Middleware
module Sentry
class TracingItemProcessMiddleware
include Transaction
attr_reader :new_transaction
def call(item)
return yield un... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/middleware/open_telemetry/tracing_create_batch_middleware.rb | lib/sbmt/outbox/middleware/open_telemetry/tracing_create_batch_middleware.rb | # frozen_string_literal: true
module Sbmt
module Outbox
module Middleware
module OpenTelemetry
class TracingCreateBatchMiddleware
def call(item_class, batch_attributes)
return yield unless defined?(::OpenTelemetry)
span_attributes = {
"messaging.syst... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/middleware/open_telemetry/tracing_create_item_middleware.rb | lib/sbmt/outbox/middleware/open_telemetry/tracing_create_item_middleware.rb | # frozen_string_literal: true
module Sbmt
module Outbox
module Middleware
module OpenTelemetry
class TracingCreateItemMiddleware
def call(item_class, item_attributes)
return yield unless defined?(::OpenTelemetry)
span_attributes = {
"messaging.system... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/middleware/open_telemetry/tracing_item_process_middleware.rb | lib/sbmt/outbox/middleware/open_telemetry/tracing_item_process_middleware.rb | # frozen_string_literal: true
module Sbmt
module Outbox
module Middleware
module OpenTelemetry
class TracingItemProcessMiddleware
def call(item)
return yield unless defined?(::OpenTelemetry)
item_class = item.class
item_options = item.options || {}
... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/middleware/execution_context/context_item_process_middleware.rb | lib/sbmt/outbox/middleware/execution_context/context_item_process_middleware.rb | # frozen_string_literal: true
require "sbmt/outbox/middleware/execution_context/context_item_process_middleware"
module Sbmt
module Outbox
module Middleware
module ExecutionContext
class ContextItemProcessMiddleware
def call(item)
ActiveSupport::ExecutionContext[:box_item] = ... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/probes/probe.rb | lib/sbmt/outbox/probes/probe.rb | # frozen_string_literal: true
module Sbmt
module Outbox
module Probes
class Probe
DEFAULT_PROBE_PORT = 5555
class << self
def run_probes
return unless autostart_probe?
$stdout.puts "Starting probes..."
::HttpHealthCheck.run_server_async(
... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/probes/metrics.rb | lib/sbmt/outbox/probes/metrics.rb | # frozen_string_literal: true
require "rackup/handler/webrick" if Gem::Version.new(::Rack.release) >= Gem::Version.new("3")
module Sbmt
module Outbox
module Probes
class Metrics
DEFAULT_YABEDA_PORT = 9090
DEFAULT_YABEDA_PATH = "/metrics"
class << self
def run_metrics
... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/metrics/utils.rb | lib/sbmt/outbox/metrics/utils.rb | # frozen_string_literal: true
module Sbmt
module Outbox
module Metrics
module Utils
extend self
def metric_safe(str)
str.tr("/", "-")
end
end
end
end
end
| ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/v2/redis_item_meta.rb | lib/sbmt/outbox/v2/redis_item_meta.rb | # frozen_string_literal: true
module Sbmt
module Outbox
module V2
class RedisItemMeta
attr_reader :version, :timestamp, :errors_count, :error_msg
CURRENT_VERSION = 1
MAX_ERROR_LEN = 200
def initialize(errors_count:, error_msg:, timestamp: Time.current.to_i, version: CURREN... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/v2/poller.rb | lib/sbmt/outbox/v2/poller.rb | # frozen_string_literal: true
require "redlock"
require "sbmt/outbox/v2/box_processor"
require "sbmt/outbox/v2/redis_job"
require "sbmt/outbox/v2/poll_throttler"
require "sbmt/outbox/v2/tasks/poll"
module Sbmt
module Outbox
module V2
class Poller < BoxProcessor
delegate :poller_config, :polling_it... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/v2/processor.rb | lib/sbmt/outbox/v2/processor.rb | # frozen_string_literal: true
require "redlock"
require "sbmt/outbox/v2/box_processor"
require "sbmt/outbox/v2/redis_job"
require "sbmt/outbox/v2/tasks/process"
module Sbmt
module Outbox
module V2
class Processor < BoxProcessor
delegate :processor_config, :batch_process_middlewares, :logger, to: "... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/v2/throttler.rb | lib/sbmt/outbox/v2/throttler.rb | # frozen_string_literal: true
module Sbmt
module Outbox
module V2
module Throttler
THROTTLE_STATUS = "throttle"
SKIP_STATUS = "skip"
NOOP_STATUS = "noop"
end
end
end
end
| ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/v2/thread_pool.rb | lib/sbmt/outbox/v2/thread_pool.rb | # frozen_string_literal: true
module Sbmt
module Outbox
module V2
class ThreadPool
delegate :logger, to: "Sbmt::Outbox"
BREAK = Object.new.freeze
SKIPPED = Object.new.freeze
PROCESSED = Object.new.freeze
def initialize(concurrency:, name: "thread_pool", random_star... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/v2/worker.rb | lib/sbmt/outbox/v2/worker.rb | # frozen_string_literal: true
require "redlock"
require "sbmt/outbox/v2/poller"
require "sbmt/outbox/v2/processor"
module Sbmt
module Outbox
module V2
class Worker
def initialize(boxes:, poll_tactic: nil, processor_concurrency: nil, poller_partitions_count: nil, poller_threads_count: nil)
... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/v2/poll_throttler.rb | lib/sbmt/outbox/v2/poll_throttler.rb | # frozen_string_literal: true
require "sbmt/outbox/v2/poll_throttler/base"
require "sbmt/outbox/v2/poll_throttler/composite"
require "sbmt/outbox/v2/poll_throttler/rate_limited"
require "sbmt/outbox/v2/poll_throttler/fixed_delay"
require "sbmt/outbox/v2/poll_throttler/noop"
require "sbmt/outbox/v2/poll_throttler/redis... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/v2/redis_job.rb | lib/sbmt/outbox/v2/redis_job.rb | # frozen_string_literal: true
module Sbmt
module Outbox
module V2
class RedisJob
attr_reader :bucket, :timestamp, :ids
GENERIC_SEPARATOR = ":"
IDS_SEPARATOR = ","
def initialize(bucket, ids, timestamp = Time.current.to_i)
@bucket = bucket
@ids = ids
... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/v2/box_processor.rb | lib/sbmt/outbox/v2/box_processor.rb | # frozen_string_literal: true
require "sbmt/outbox/v2/throttler"
require "sbmt/outbox/v2/thread_pool"
require "sbmt/outbox/v2/tasks/default"
module Sbmt
module Outbox
module V2
class BoxProcessor
delegate :config, :logger, to: "Sbmt::Outbox"
delegate :box_worker, to: "Yabeda"
attr_... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/v2/tasks/default.rb | lib/sbmt/outbox/v2/tasks/default.rb | # frozen_string_literal: true
require "sbmt/outbox/v2/tasks/base"
module Sbmt
module Outbox
module V2
module Tasks
class Default < Base
def to_s
"#{item_class.box_type}/#{item_class.box_name}"
end
end
end
end
end
end
| ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/v2/tasks/poll.rb | lib/sbmt/outbox/v2/tasks/poll.rb | # frozen_string_literal: true
require "sbmt/outbox/v2/tasks/base"
module Sbmt
module Outbox
module V2
module Tasks
class Poll < Base
attr_reader :partition, :buckets, :resource_key, :resource_path, :redis_queue
def initialize(item_class:, worker_name:, partition:, buckets:)
... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/v2/tasks/base.rb | lib/sbmt/outbox/v2/tasks/base.rb | # frozen_string_literal: true
require "sbmt/outbox/metrics/utils"
module Sbmt
module Outbox
module V2
module Tasks
class Base
attr_reader :item_class, :worker_name, :worker_version, :log_tags, :yabeda_labels
delegate :owner, to: :item_class
def initialize(item_class... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/v2/tasks/process.rb | lib/sbmt/outbox/v2/tasks/process.rb | # frozen_string_literal: true
require "sbmt/outbox/v2/tasks/base"
module Sbmt
module Outbox
module V2
module Tasks
class Process < Base
attr_reader :partition, :bucket, :ids, :resource_key, :resource_path
def initialize(item_class:, worker_name:, bucket:, ids:)
sup... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/v2/poll_throttler/composite.rb | lib/sbmt/outbox/v2/poll_throttler/composite.rb | # frozen_string_literal: true
require "sbmt/outbox/v2/poll_throttler/base"
module Sbmt
module Outbox
module V2
module PollThrottler
class Composite < Base
attr_reader :throttlers
def initialize(throttlers:)
super()
@throttlers = throttlers
en... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/v2/poll_throttler/redis_queue_time_lag.rb | lib/sbmt/outbox/v2/poll_throttler/redis_queue_time_lag.rb | # frozen_string_literal: true
require "sbmt/outbox/v2/poll_throttler/base"
require "sbmt/outbox/v2/redis_job"
module Sbmt
module Outbox
module V2
module PollThrottler
class RedisQueueTimeLag < Base
delegate :redis_job_queue_time_lag, to: "Yabeda.box_worker"
def initialize(redi... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/v2/poll_throttler/fixed_delay.rb | lib/sbmt/outbox/v2/poll_throttler/fixed_delay.rb | # frozen_string_literal: true
require "sbmt/outbox/v2/poll_throttler/base"
require "sbmt/outbox/v2/thread_pool"
module Sbmt
module Outbox
module V2
module PollThrottler
class FixedDelay < Base
def initialize(delay:)
super()
@delay = delay
end
... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/v2/poll_throttler/noop.rb | lib/sbmt/outbox/v2/poll_throttler/noop.rb | # frozen_string_literal: true
require "sbmt/outbox/v2/poll_throttler/base"
module Sbmt
module Outbox
module V2
module PollThrottler
class Noop < Base
def wait(worker_num, poll_task, _task_result)
Success(Sbmt::Outbox::V2::Throttler::NOOP_STATUS)
end
end
... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/v2/poll_throttler/paused_box.rb | lib/sbmt/outbox/v2/poll_throttler/paused_box.rb | # frozen_string_literal: true
require "sbmt/outbox/v2/poll_throttler/base"
require "sbmt/outbox/v2/thread_pool"
module Sbmt
module Outbox
module V2
module PollThrottler
class PausedBox < Base
def initialize(delay: 0.1)
super()
@delay = delay
end
... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/v2/poll_throttler/redis_queue_size.rb | lib/sbmt/outbox/v2/poll_throttler/redis_queue_size.rb | # frozen_string_literal: true
require "sbmt/outbox/v2/poll_throttler/base"
module Sbmt
module Outbox
module V2
module PollThrottler
class RedisQueueSize < Base
delegate :redis_job_queue_size, to: "Yabeda.box_worker"
def initialize(redis:, min_size: -1, max_size: 100, delay: 0)... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/v2/poll_throttler/base.rb | lib/sbmt/outbox/v2/poll_throttler/base.rb | # frozen_string_literal: true
require "sbmt/outbox/v2/throttler"
module Sbmt
module Outbox
module V2
module PollThrottler
class Base < Outbox::DryInteractor
delegate :poll_throttling_counter, :poll_throttling_runtime, to: "Yabeda.box_worker"
def call(worker_num, poll_task, tas... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/v2/poll_throttler/rate_limited.rb | lib/sbmt/outbox/v2/poll_throttler/rate_limited.rb | # frozen_string_literal: true
require "sbmt/outbox/v2/poll_throttler/base"
require "ruby-limiter"
module Sbmt
module Outbox
module V2
module PollThrottler
class RateLimited < Base
attr_reader :queues
def initialize(limit: nil, interval: nil, balanced: true)
@limit ... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/lib/sbmt/outbox/instrumentation/open_telemetry_loader.rb | lib/sbmt/outbox/instrumentation/open_telemetry_loader.rb | # frozen_string_literal: true
require "opentelemetry"
require "opentelemetry-common"
require "opentelemetry-instrumentation-base"
require_relative "../middleware/open_telemetry/tracing_create_item_middleware"
require_relative "../middleware/open_telemetry/tracing_create_batch_middleware"
require_relative "../middlewa... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/config/routes.rb | config/routes.rb | # frozen_string_literal: true
Sbmt::Outbox::Engine.routes.draw do
root to: "root#index"
namespace :api, defaults: {format: :json} do
resources :outbox_classes, only: [:index, :show, :update, :destroy]
resources :inbox_classes, only: [:index, :show, :update, :destroy]
end
end
| ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/config/schedule.rb | config/schedule.rb | # frozen_string_literal: true
every "10m", as: "Sbmt::Outbox::DeleteStaleOutboxItemsJob", overlap: false, timeout: "60s" do
Sbmt::Outbox::DeleteStaleOutboxItemsJob.enqueue
end
every "10m", as: "Sbmt::Outbox::DeleteStaleInboxItemsJob", overlap: false, timeout: "60s" do
Sbmt::Outbox::DeleteStaleInboxItemsJob.enqueu... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/config/initializers/active_record.rb | config/initializers/active_record.rb | # frozen_string_literal: true
if ActiveRecord.version >= Gem::Version.new("7.0.0")
Rails.application.config.active_record.tap do |config|
config.query_log_tags << {
box_name: ->(context) { context[:box_item]&.class&.box_name },
box_item_id: ->(context) { context[:box_item]&.uuid }
}
end
end
| ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/config/initializers/schked.rb | config/initializers/schked.rb | # frozen_string_literal: true
begin
require "schked"
Schked.config.paths << Sbmt::Outbox::Engine.root.join("config", "schedule.rb")
rescue LoadError
# optional dependency
end
| ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
Kuper-Tech/sbmt-outbox | https://github.com/Kuper-Tech/sbmt-outbox/blob/6da9ae3ea0333ae3ad58983c035bc95bd739aaf4/config/initializers/yabeda.rb | config/initializers/yabeda.rb | # frozen_string_literal: true
Yabeda.configure do
# error_counter retry_counter sent_counter fetch_error_counter discarded_counter
group :outbox do
default_tag(:worker_version, 1)
counter :created_counter,
tags: %i[type name partition owner],
comment: "The total number of created messages"
... | ruby | MIT | 6da9ae3ea0333ae3ad58983c035bc95bd739aaf4 | 2026-01-04T17:51:44.997823Z | false |
heycarsten/email-veracity | https://github.com/heycarsten/email-veracity/blob/1a7db8ca81a72d8102f31d65a1ca7814e806a506/test/test_domain.rb | test/test_domain.rb | require 'helper'
class TestDomain < Test::Unit::TestCase
def test_blacklisted_domain
assert EmailVeracity::Domain.blacklisted?('dodgeit.com'),
'Should match a blacklisted domain.'
assert EmailVeracity::Domain.blacklisted?('DoDgEiT.cOm'),
'Should match a blacklisted domain regardless of case.'
... | ruby | MIT | 1a7db8ca81a72d8102f31d65a1ca7814e806a506 | 2026-01-04T17:52:16.554329Z | false |
heycarsten/email-veracity | https://github.com/heycarsten/email-veracity/blob/1a7db8ca81a72d8102f31d65a1ca7814e806a506/test/test_validatability.rb | test/test_validatability.rb | require 'helper'
class TestValidatability < Test::Unit::TestCase
def test_includes_proper_methods
%w[ valid? validate! clear_errors! add_error errors ].each do |method_name|
assert_respond_to ClassWithValidationMock.new, method_name
end
end
def test_add_error
mock = ClassWithValidationMock.ne... | ruby | MIT | 1a7db8ca81a72d8102f31d65a1ca7814e806a506 | 2026-01-04T17:52:16.554329Z | false |
heycarsten/email-veracity | https://github.com/heycarsten/email-veracity/blob/1a7db8ca81a72d8102f31d65a1ca7814e806a506/test/test_resolver.rb | test/test_resolver.rb | require 'helper'
class TestResolver < Test::Unit::TestCase
DOMAIN_NAMES = %w[
viarails.net heycarsten.com yahoo.com gmail.com savvica.com
okayfail.com github.com google.com rogers.com amd.com adobe.com
unspace.ca xerox.com webkit.org cooltown.net aiderss.com delicious.com ]
def test_consecutive_queri... | ruby | MIT | 1a7db8ca81a72d8102f31d65a1ca7814e806a506 | 2026-01-04T17:52:16.554329Z | false |
heycarsten/email-veracity | https://github.com/heycarsten/email-veracity/blob/1a7db8ca81a72d8102f31d65a1ca7814e806a506/test/test_server.rb | test/test_server.rb | require 'helper'
class TestServer < Test::Unit::TestCase
def test_creating_a_new_blank_server_object
new_server = EmailVeracity::Server.new
assert_equal '', new_server.to_s,
'Should yield a blank string on call to to_s.'
assert_equal '', new_server.name,
'Should yield a blank string on call ... | ruby | MIT | 1a7db8ca81a72d8102f31d65a1ca7814e806a506 | 2026-01-04T17:52:16.554329Z | false |
heycarsten/email-veracity | https://github.com/heycarsten/email-veracity/blob/1a7db8ca81a72d8102f31d65a1ca7814e806a506/test/test_config.rb | test/test_config.rb | # coding: utf-8
require 'helper'
class TestConfig < Test::Unit::TestCase
VALID_EMAIL_ADDRESS_EXAMPLES = %w[
goto@rubyfringe.ca
went.to@futureruby.com
heyd00d+stuff@gmail.com
carsten_nielsen@gmail.com
carsten-nielsen@gmail.com
goodoldemail@address.ca
old-skool@mail.mysite.on.ca
heyca... | ruby | MIT | 1a7db8ca81a72d8102f31d65a1ca7814e806a506 | 2026-01-04T17:52:16.554329Z | false |
heycarsten/email-veracity | https://github.com/heycarsten/email-veracity/blob/1a7db8ca81a72d8102f31d65a1ca7814e806a506/test/test_address.rb | test/test_address.rb | require 'helper'
class TestAddress < Test::Unit::TestCase
def test_initialize
assert_instance_of EmailVeracity::Address,
EmailVeracity::Address.new('heycarsten@gmail.com'),
'Should create a new Address object.'
assert_instance_of Array,
EmailVeracity::Address.new('heycarsten@gmail.com').e... | ruby | MIT | 1a7db8ca81a72d8102f31d65a1ca7814e806a506 | 2026-01-04T17:52:16.554329Z | false |
heycarsten/email-veracity | https://github.com/heycarsten/email-veracity/blob/1a7db8ca81a72d8102f31d65a1ca7814e806a506/test/test_utils.rb | test/test_utils.rb | require 'helper'
class TestUtils < Test::Unit::TestCase
def test_blank
assert EmailVeracity::Utils.blank?([]), '[] should be blank.'
assert EmailVeracity::Utils.blank?(''), '"" should be blank.'
assert EmailVeracity::Utils.blank?(Hash.new), '{} should be blank.'
assert EmailVeracity::Utils.blank?(ni... | ruby | MIT | 1a7db8ca81a72d8102f31d65a1ca7814e806a506 | 2026-01-04T17:52:16.554329Z | false |
heycarsten/email-veracity | https://github.com/heycarsten/email-veracity/blob/1a7db8ca81a72d8102f31d65a1ca7814e806a506/test/helper.rb | test/helper.rb | require 'rubygems'
require 'test/unit'
require 'shoulda'
require 'mocha'
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$:.unshift(File.dirname(__FILE__))
require 'email_veracity'
class ClassWithValidationMock
include EmailVeracity::Validatability
attr_accessor :give_error
attr_accessor :give_er... | ruby | MIT | 1a7db8ca81a72d8102f31d65a1ca7814e806a506 | 2026-01-04T17:52:16.554329Z | false |
heycarsten/email-veracity | https://github.com/heycarsten/email-veracity/blob/1a7db8ca81a72d8102f31d65a1ca7814e806a506/lib/email_veracity.rb | lib/email_veracity.rb | require 'resolv'
require 'timeout'
require 'email_veracity/utils'
require 'email_veracity/validatability'
require 'email_veracity/config'
require 'email_veracity/server'
require 'email_veracity/resolver'
require 'email_veracity/domain'
require 'email_veracity/address'
module EmailVeracity
class Error < StandardEr... | ruby | MIT | 1a7db8ca81a72d8102f31d65a1ca7814e806a506 | 2026-01-04T17:52:16.554329Z | false |
heycarsten/email-veracity | https://github.com/heycarsten/email-veracity/blob/1a7db8ca81a72d8102f31d65a1ca7814e806a506/lib/email_veracity/validatability.rb | lib/email_veracity/validatability.rb | module EmailVeracity
module Validatability
def valid?
self.errors.empty?
end
def errors
self.clear_errors!
self.validate!
@errors
end
protected
def validate!
# Adds errors to the object.
end
def clear_errors!
@errors = []
end
def add_er... | ruby | MIT | 1a7db8ca81a72d8102f31d65a1ca7814e806a506 | 2026-01-04T17:52:16.554329Z | false |
heycarsten/email-veracity | https://github.com/heycarsten/email-veracity/blob/1a7db8ca81a72d8102f31d65a1ca7814e806a506/lib/email_veracity/utils.rb | lib/email_veracity/utils.rb | module EmailVeracity
module Utils
def blank?(obj)
obj.respond_to?(:empty?) ? obj.empty? : !obj
end
module_function :blank?
end
end
| ruby | MIT | 1a7db8ca81a72d8102f31d65a1ca7814e806a506 | 2026-01-04T17:52:16.554329Z | false |
heycarsten/email-veracity | https://github.com/heycarsten/email-veracity/blob/1a7db8ca81a72d8102f31d65a1ca7814e806a506/lib/email_veracity/domain.rb | lib/email_veracity/domain.rb | module EmailVeracity
class Domain
include Validatability
def self.whitelisted?(name)
Config[:whitelist].include?(name.downcase.strip)
end
def self.blacklisted?(name)
Config[:blacklist].include?(name.downcase.strip)
end
def initialize(name = '')
@name = name
end
d... | ruby | MIT | 1a7db8ca81a72d8102f31d65a1ca7814e806a506 | 2026-01-04T17:52:16.554329Z | false |
heycarsten/email-veracity | https://github.com/heycarsten/email-veracity/blob/1a7db8ca81a72d8102f31d65a1ca7814e806a506/lib/email_veracity/address.rb | lib/email_veracity/address.rb | module EmailVeracity
class Address
include Validatability
attr_reader :domain
def initialize(email = '')
self.email_address = email
end
def to_s
email_address
end
def email_address
@email_address.to_s.strip
end
def email_address=(new_email_address)
@em... | ruby | MIT | 1a7db8ca81a72d8102f31d65a1ca7814e806a506 | 2026-01-04T17:52:16.554329Z | false |
heycarsten/email-veracity | https://github.com/heycarsten/email-veracity/blob/1a7db8ca81a72d8102f31d65a1ca7814e806a506/lib/email_veracity/resolver.rb | lib/email_veracity/resolver.rb | module EmailVeracity
module Resolver
RECORD_NAMES_TO_RESOLVE_MAP = {
:a => {
:method => 'address',
:type => AddressServer,
:constant => Resolv::DNS::Resource::IN::A },
:mx => {
:method => 'exchange',
:type => ExchangeServer,
:constant => Resolv::DNS::Re... | ruby | MIT | 1a7db8ca81a72d8102f31d65a1ca7814e806a506 | 2026-01-04T17:52:16.554329Z | false |
heycarsten/email-veracity | https://github.com/heycarsten/email-veracity/blob/1a7db8ca81a72d8102f31d65a1ca7814e806a506/lib/email_veracity/config.rb | lib/email_veracity/config.rb | module EmailVeracity
module Config
DEFAULT_OPTIONS = {
:whitelist => %w[
aol.com
gmail.com
hotmail.com
me.com
mac.com
msn.com
rogers.com
sympatico.ca
yahoo.com
telus.com
sprint.com
sprint.ca ],
:blacklist ... | ruby | MIT | 1a7db8ca81a72d8102f31d65a1ca7814e806a506 | 2026-01-04T17:52:16.554329Z | false |
heycarsten/email-veracity | https://github.com/heycarsten/email-veracity/blob/1a7db8ca81a72d8102f31d65a1ca7814e806a506/lib/email_veracity/server.rb | lib/email_veracity/server.rb | module EmailVeracity
class Server
attr_reader :name
alias_method :to_s, :name
def initialize(name = '')
@name = name
end
end
class AddressServer < Server; end
class ExchangeServer < Server; end
end
| ruby | MIT | 1a7db8ca81a72d8102f31d65a1ca7814e806a506 | 2026-01-04T17:52:16.554329Z | false |
adammck/ruby-icloud | https://github.com/adammck/ruby-icloud/blob/8a9418a4260dc4faf9dd0b23599cab341443e5ef/test/test_helpers.rb | test/test_helpers.rb | #!/usr/bin/env ruby
# vim: et ts=2 sw=2
# Totally arbitrary GUID for this library
TEST_CLIENT_ID = "61384E90-4A30-4F2A-89C3-E031E77B4B78"
# Consistent for a single test run, otherwise unique.
prefix = "Test #{Time.now.to_i}"
TEST_TITLE_A = "#{prefix}A"
TEST_TITLE_B = "#{prefix}B"
TEST_DATE = DateTime.new(2013, 2, 1,... | ruby | MIT | 8a9418a4260dc4faf9dd0b23599cab341443e5ef | 2026-01-04T17:52:21.382901Z | false |
adammck/ruby-icloud | https://github.com/adammck/ruby-icloud/blob/8a9418a4260dc4faf9dd0b23599cab341443e5ef/test/integration/test_session.rb | test/integration/test_session.rb | #!/usr/bin/env ruby
# vim: et ts=2 sw=2
class TestSession < MiniTest::Unit::TestCase
i_suck_and_my_tests_are_order_dependent!
def assert_equal_unordered(expected, actual)
assert_equal(expected.sort, actual.sort)
end
def find(title)
$session.reminders.find do |reminder|
reminder.title == title
... | ruby | MIT | 8a9418a4260dc4faf9dd0b23599cab341443e5ef | 2026-01-04T17:52:21.382901Z | false |
adammck/ruby-icloud | https://github.com/adammck/ruby-icloud/blob/8a9418a4260dc4faf9dd0b23599cab341443e5ef/test/unit/test_date_helpers.rb | test/unit/test_date_helpers.rb | #!/usr/bin/env ruby
# vim: et ts=2 sw=2
require "date"
class TestDateHelpers < MiniTest::Unit::TestCase
def setup
@dt = DateTime.new 1984, 6, 13, 18, 30, 0
@ic = [19840613, 1984, 6, 13, 18, 30, 1110]
end
def test_can_read_icloud_dates
assert_equal ICloud::date_from_icloud(@ic), @dt
end
def tes... | ruby | MIT | 8a9418a4260dc4faf9dd0b23599cab341443e5ef | 2026-01-04T17:52:21.382901Z | false |
adammck/ruby-icloud | https://github.com/adammck/ruby-icloud/blob/8a9418a4260dc4faf9dd0b23599cab341443e5ef/test/unit/test_proxy.rb | test/unit/test_proxy.rb | #!/usr/bin/env ruby
# vim: et ts=2 sw=2
require "minitest/mock"
class TestProxy < MiniTest::Unit::TestCase
def setup
@cls = Class.new
@cls.send(:include, ICloud::Proxy)
@obj = @cls.new
end
def test_returns_nil_when_no_proxy_is_configured
@obj.stub(:env, { }) do
assert_nil @obj.proxy
e... | ruby | MIT | 8a9418a4260dc4faf9dd0b23599cab341443e5ef | 2026-01-04T17:52:21.382901Z | false |
adammck/ruby-icloud | https://github.com/adammck/ruby-icloud/blob/8a9418a4260dc4faf9dd0b23599cab341443e5ef/test/unit/porcelain/test_reminder.rb | test/unit/porcelain/test_reminder.rb | #!/usr/bin/env ruby
# vim: et ts=2 sw=2
class TestPorcelainReminder < MiniTest::Unit::TestCase
def setup
end
# test_finds_existing_reminder
# test_updates_existing_reminder
# test_deletes_existing_reminder
# test_creates_new_reminder
end
| ruby | MIT | 8a9418a4260dc4faf9dd0b23599cab341443e5ef | 2026-01-04T17:52:21.382901Z | false |
adammck/ruby-icloud | https://github.com/adammck/ruby-icloud/blob/8a9418a4260dc4faf9dd0b23599cab341443e5ef/test/unit/record/test_nested_record.rb | test/unit/record/test_nested_record.rb | #!/usr/bin/env ruby
# vim: et ts=2 sw=2
class TestNestedRecord < MiniTest::Unit::TestCase
def setup
@pet_cls = Class.new do
include ICloud::Record
has_fields :name
end
# The block passed to Class.new is instance_evalled in the new class (where
# @pet_cls is nil), so we must alias this to... | ruby | MIT | 8a9418a4260dc4faf9dd0b23599cab341443e5ef | 2026-01-04T17:52:21.382901Z | false |
adammck/ruby-icloud | https://github.com/adammck/ruby-icloud/blob/8a9418a4260dc4faf9dd0b23599cab341443e5ef/test/unit/record/test_simple_record.rb | test/unit/record/test_simple_record.rb | #!/usr/bin/env ruby
# vim: et ts=2 sw=2
class TestSimpleRecord < MiniTest::Unit::TestCase
def setup
@cls = Class.new do
include ICloud::Record
has_fields :first_name, :last_name
end
end
def test_serialization
record = @cls.new.tap do |r|
r.first_name = "Adam"
r.last_name = "... | ruby | MIT | 8a9418a4260dc4faf9dd0b23599cab341443e5ef | 2026-01-04T17:52:21.382901Z | false |
adammck/ruby-icloud | https://github.com/adammck/ruby-icloud/blob/8a9418a4260dc4faf9dd0b23599cab341443e5ef/test/unit/records/test_alarm.rb | test/unit/records/test_alarm.rb | #!/usr/bin/env ruby
# vim: et ts=2 sw=2
class TestAlarm < MiniTest::Unit::TestCase
def setup
@cls = ICloud::Records::Alarm
end
def test_on_date_from_icloud
assert_equal DateTime.new(2013, 6, 13, 7, 45), @cls.on_date_from_icloud([20130613, 2013, 6, 13, 7, 45, 465])
assert_nil @cls.on_date_from_icloud... | ruby | MIT | 8a9418a4260dc4faf9dd0b23599cab341443e5ef | 2026-01-04T17:52:21.382901Z | false |
adammck/ruby-icloud | https://github.com/adammck/ruby-icloud/blob/8a9418a4260dc4faf9dd0b23599cab341443e5ef/test/unit/records/test_reminder.rb | test/unit/records/test_reminder.rb | #!/usr/bin/env ruby
# vim: et ts=2 sw=2
class TestReminder < MiniTest::Unit::TestCase
def setup
@cls = ICloud::Records::Reminder
end
def test_complete?
incomplete = @cls.new
complete = @cls.new.tap { |r| r.completed_date = DateTime.now }
refute incomplete.complete?
assert complete.complete?
... | ruby | MIT | 8a9418a4260dc4faf9dd0b23599cab341443e5ef | 2026-01-04T17:52:21.382901Z | false |
adammck/ruby-icloud | https://github.com/adammck/ruby-icloud/blob/8a9418a4260dc4faf9dd0b23599cab341443e5ef/lib/icloud.rb | lib/icloud.rb | #!/usr/bin/env ruby
# vim: et ts=2 sw=2
module ICloud
end
require "icloud/core_ext/array"
require "icloud/core_ext/date_time"
require "icloud/core_ext/object"
require "icloud/helpers/date_helpers"
require "icloud/helpers/guid"
require "icloud/helpers/inflections"
require "icloud/helpers/proxy"
require "icloud/recor... | ruby | MIT | 8a9418a4260dc4faf9dd0b23599cab341443e5ef | 2026-01-04T17:52:21.382901Z | false |
adammck/ruby-icloud | https://github.com/adammck/ruby-icloud/blob/8a9418a4260dc4faf9dd0b23599cab341443e5ef/lib/icloud/record.rb | lib/icloud/record.rb | #!/usr/bin/env ruby
# vim: et ts=2 sw=2
module ICloud
# Public: Mixin to allow a class to be serialized and unserialized into the
# format spoken by the icloud.com private JSON API.
module Record
def self.included base
base.extend ClassMethods
end
# Public: Serialize this record's fields int... | ruby | MIT | 8a9418a4260dc4faf9dd0b23599cab341443e5ef | 2026-01-04T17:52:21.382901Z | false |
adammck/ruby-icloud | https://github.com/adammck/ruby-icloud/blob/8a9418a4260dc4faf9dd0b23599cab341443e5ef/lib/icloud/session.rb | lib/icloud/session.rb | #!/usr/bin/env ruby
# vim: et ts=2 sw=2
require "cgi"
require "uri"
require "net/https"
require "json/pure"
module ICloud
class Session
include Proxy
def initialize apple_id, pass, client_id=nil
@apple_id = apple_id
@pass = pass
@user = nil
@services = nil
@http = {}
@... | ruby | MIT | 8a9418a4260dc4faf9dd0b23599cab341443e5ef | 2026-01-04T17:52:21.382901Z | false |
adammck/ruby-icloud | https://github.com/adammck/ruby-icloud/blob/8a9418a4260dc4faf9dd0b23599cab341443e5ef/lib/icloud/version.rb | lib/icloud/version.rb | #!/usr/bin/env ruby
# vim: et ts=2 sw=2
unless defined?(ICloud::VERSION)
module ICloud
VERSION = "0.0.1"
end
end
| ruby | MIT | 8a9418a4260dc4faf9dd0b23599cab341443e5ef | 2026-01-04T17:52:21.382901Z | false |
adammck/ruby-icloud | https://github.com/adammck/ruby-icloud/blob/8a9418a4260dc4faf9dd0b23599cab341443e5ef/lib/icloud/errors.rb | lib/icloud/errors.rb | #!/usr/bin/env ruby
# vim: et ts=2 sw=2
module ICloud
class Error < StandardError; end
class LoginFailed < Error; end
#
# This error should be raised when a request to icloud.com fails. The server
# usually responds with something helpful.
#
class RequestError < Error
def initialize(status, message)... | ruby | MIT | 8a9418a4260dc4faf9dd0b23599cab341443e5ef | 2026-01-04T17:52:21.382901Z | false |
adammck/ruby-icloud | https://github.com/adammck/ruby-icloud/blob/8a9418a4260dc4faf9dd0b23599cab341443e5ef/lib/icloud/pool.rb | lib/icloud/pool.rb | #!/usr/bin/env ruby
# vim: et ts=2 sw=2
module ICloud
class Pool
def initialize
@objects = {}
end
def add obj
@objects[obj.guid] = obj
end
def get guid
@objects[guid]
end
def find hsh
@objects.values.select do |obj|
hsh.all? do |k, v|
obj.send(... | ruby | MIT | 8a9418a4260dc4faf9dd0b23599cab341443e5ef | 2026-01-04T17:52:21.382901Z | false |
adammck/ruby-icloud | https://github.com/adammck/ruby-icloud/blob/8a9418a4260dc4faf9dd0b23599cab341443e5ef/lib/icloud/porcelain/reminder.rb | lib/icloud/porcelain/reminder.rb | #!/usr/bin/env ruby
# vim: et ts=2 sw=2
module ICloud
class Reminder
end
end
| ruby | MIT | 8a9418a4260dc4faf9dd0b23599cab341443e5ef | 2026-01-04T17:52:21.382901Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.