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 |
|---|---|---|---|---|---|---|---|---|
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/storage/scp.rb | lib/backup/storage/scp.rb | require "net/scp"
module Backup
module Storage
class SCP < Base
include Storage::Cycler
class Error < Backup::Error; end
##
# Server credentials
attr_accessor :username, :password, :ssh_options
##
# Server IP Address and SCP port
attr_accessor :ip, :port
d... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/storage/qiniu.rb | lib/backup/storage/qiniu.rb | require "qiniu"
module Backup
module Storage
class Qiniu < Base
include Storage::Cycler
class Error < Backup::Error; end
##
# Qiniu API credentials
attr_accessor :access_key, :secret_key
##
# Qiniu bucket name
attr_accessor :bucket
def initialize(model, st... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/storage/cycler.rb | lib/backup/storage/cycler.rb | module Backup
module Storage
module Cycler
class Error < Backup::Error; end
private
# Adds the current package being stored to the YAML cycle data file
# and will remove any old package file(s) when the storage limit
# set by #keep is exceeded.
def cycle!
Logger.info ... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/storage/cloud_files.rb | lib/backup/storage/cloud_files.rb | require "backup/cloud_io/cloud_files"
module Backup
module Storage
class CloudFiles < Base
include Storage::Cycler
class Error < Backup::Error; end
##
# Rackspace CloudFiles Credentials
attr_accessor :username, :api_key
##
# Rackspace Auth URL (optional)
attr_acc... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/notifier/hipchat.rb | lib/backup/notifier/hipchat.rb | require "hipchat"
module Backup
module Notifier
class Hipchat < Base
##
# The Hipchat API token
attr_accessor :token
##
# The Hipchat API version
# Either 'v1' or 'v2' (default is 'v1')
attr_accessor :api_version
##
# Who the notification should appear from... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/notifier/command.rb | lib/backup/notifier/command.rb | module Backup
module Notifier
class Command < Base
##
# Command to execute.
#
# Make sure it is accessible from your $PATH, or provide
# the absolute path to the command.
attr_accessor :command
##
# Arguments to pass to the command.
#
# Must be an array... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/notifier/http_post.rb | lib/backup/notifier/http_post.rb | require "uri"
module Backup
module Notifier
class HttpPost < Base
##
# URI to post notification to.
#
# URI scheme may be `http` or `https`.
#
# If Basic Authentication is needed, supply the `user:password` in the URI.
# e.g. 'https://user:pass@www.example.com/path'
... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/notifier/ses.rb | lib/backup/notifier/ses.rb | require "aws-sdk"
require "mail"
module Backup
module Notifier
class Ses < Base
##
# Amazon Simple Email Service (SES) Credentials
attr_accessor :access_key_id, :secret_access_key, :use_iam_profile
##
# SES Region
attr_accessor :region
##
# Sender Email Address
... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/notifier/datadog.rb | lib/backup/notifier/datadog.rb | require "dogapi"
module Backup
module Notifier
class DataDog < Base
##
# The DataDog API key
attr_accessor :api_key
##
# The title of the event
attr_accessor :title
attr_deprecate :text,
version: "4.2",
message: "Please use the `message` attribute. For ... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/notifier/pagerduty.rb | lib/backup/notifier/pagerduty.rb | require "pagerduty"
module Backup
module Notifier
class PagerDuty < Base
##
# PagerDuty Service API Key. Should be a 32 character hex string.
attr_accessor :service_key
##
# Determines if a backup with a warning should resolve an incident rather
# than trigger one.
#
... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/notifier/pushover.rb | lib/backup/notifier/pushover.rb | require "uri"
module Backup
module Notifier
class Pushover < Base
##
# The API User Token
attr_accessor :user
##
# The API Application Token
attr_accessor :token
##
# The user's device identifier to sent the message directly to,
# rather than all of the use... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/notifier/twitter.rb | lib/backup/notifier/twitter.rb | require "twitter"
module Backup
module Notifier
class Twitter < Base
##
# Twitter consumer key credentials
attr_accessor :consumer_key, :consumer_secret
##
# OAuth credentials
attr_accessor :oauth_token, :oauth_token_secret
def initialize(model, &block)
super
... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/notifier/flowdock.rb | lib/backup/notifier/flowdock.rb | require "flowdock"
module Backup
module Notifier
class FlowDock < Base
##
# The Flowdock API token
attr_accessor :token
##
# Who the notification should appear from
attr_accessor :from_name
# Which email the notification should appear from
attr_accessor :from_ema... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/notifier/prowl.rb | lib/backup/notifier/prowl.rb | require "uri"
module Backup
module Notifier
class Prowl < Base
##
# Application name
# Tell something like your server name. Example: "Server1 Backup"
attr_accessor :application
##
# API-Key
# Create a Prowl account and request an API key on prowlapp.com.
attr_acc... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/notifier/zabbix.rb | lib/backup/notifier/zabbix.rb | module Backup
module Notifier
class Zabbix < Base
attr_accessor :zabbix_host
attr_accessor :zabbix_port
attr_accessor :service_name
attr_accessor :service_host
attr_accessor :item_key
def initialize(model, &block)
super
instance_eval(&block) if block_given?... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/notifier/slack.rb | lib/backup/notifier/slack.rb | require "uri"
require "json"
module Backup
module Notifier
class Slack < Base
##
# The incoming webhook url
attr_accessor :webhook_url
##
# The channel to send messages to
attr_accessor :channel
##
# The username to display along with the notification
attr_... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/notifier/base.rb | lib/backup/notifier/base.rb | module Backup
module Notifier
class Error < Backup::Error; end
class Base
include Utilities::Helpers
include Config::Helpers
##
# When set to true, the user will be notified by email
# when a backup process ends without raising any exceptions
attr_accessor :on_success
... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/notifier/campfire.rb | lib/backup/notifier/campfire.rb | require "json"
module Backup
module Notifier
class Campfire < Base
##
# Campfire api authentication token
attr_accessor :api_token
##
# Campfire account's subdomain
attr_accessor :subdomain
##
# Campfire account's room id
attr_accessor :room_id
def i... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/notifier/mail.rb | lib/backup/notifier/mail.rb | require "mail"
module Backup
module Notifier
class Mail < Base
##
# Mail delivery method to be used by the Mail gem.
#
# Supported methods:
#
# [:smtp - ::Mail::SMTP (default)]
# Settings used by this method:
# {#address}, {#port}, {#domain}, {#user_name}, {#pa... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/notifier/nagios.rb | lib/backup/notifier/nagios.rb | module Backup
module Notifier
class Nagios < Base
##
# Host of Nagios server to notify on backup completion.
attr_accessor :nagios_host
##
# Port of Nagios server to notify on backup completion.
attr_accessor :nagios_port
##
# Nagios nrpe configuration file.
... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/logger/logfile.rb | lib/backup/logger/logfile.rb | module Backup
class Logger
class Logfile
class Error < Backup::Error; end
class Options
##
# Enable the use of Backup's log file.
#
# While not necessary, as this is +true+ by default,
# this may also be set on the command line using +--logfile+.
#
... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/logger/console.rb | lib/backup/logger/console.rb | module Backup
class Logger
class Console
class Options
##
# Disables all console output.
#
# This may also be set on the command line using +--quiet+.
#
# If +--no-quiet+ is used on the command line, console output
# will be enabled and any setting her... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/logger/syslog.rb | lib/backup/logger/syslog.rb | module Backup
class Logger
class Syslog
class Options
##
# Enables logging to the system's Syslog compatible logger.
#
# This may also be enabled using +--syslog+ on the command line.
#
# If +--no-syslog+ is used on the command line, this will be
# dis... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/logger/fog_adapter.rb | lib/backup/logger/fog_adapter.rb | # require only the logger
require "formatador"
require "fog/core/logger"
module Backup
class Logger
module FogAdapter
class << self
# Logged as :info so these won't generate warnings.
# This is mostly to keep STDOUT clean and to provide
# supplemental messages for our own warnings.
... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/cloud_io/base.rb | lib/backup/cloud_io/base.rb | module Backup
module CloudIO
class Error < Backup::Error; end
class FileSizeError < Backup::Error; end
class Base
attr_reader :max_retries, :retry_waitsec
def initialize(options = {})
@max_retries = options[:max_retries]
@retry_waitsec = options[:retry_waitsec]
end
... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/cloud_io/s3.rb | lib/backup/cloud_io/s3.rb | require "backup/cloud_io/base"
require "fog"
require "digest/md5"
require "base64"
require "stringio"
module Backup
module CloudIO
class S3 < Base
class Error < Backup::Error; end
MAX_FILE_SIZE = 1024**3 * 5 # 5 GiB
MAX_MULTIPART_SIZE = 1024**4 * 5 # 5 TiB
attr_reader :access... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/cloud_io/cloud_files.rb | lib/backup/cloud_io/cloud_files.rb | require "backup/cloud_io/base"
require "fog"
require "digest/md5"
module Backup
module CloudIO
class CloudFiles < Base
class Error < Backup::Error; end
MAX_FILE_SIZE = 1024**3 * 5 # 5 GiB
MAX_SLO_SIZE = 1024**3 * 5000 # 1000 segments @ 5 GiB
SEGMENT_BUFFER = 1024**2 # ... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/compressor/bzip2.rb | lib/backup/compressor/bzip2.rb | module Backup
module Compressor
class Bzip2 < Base
##
# Specify the level of compression to use.
#
# Values should be a single digit from 1 to 9.
# Note that setting the level to either extreme may or may not
# give the desired result. Be sure to check the documentation
#... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/compressor/base.rb | lib/backup/compressor/base.rb | module Backup
module Compressor
class Base
include Utilities::Helpers
include Config::Helpers
##
# Yields to the block the compressor command and filename extension.
def compress_with
log!
yield @cmd, @ext
end
private
##
# Return the compres... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/compressor/gzip.rb | lib/backup/compressor/gzip.rb | module Backup
module Compressor
class Gzip < Base
class Error < Backup::Error; end
extend Utilities::Helpers
##
# Specify the level of compression to use.
#
# Values should be a single digit from 1 to 9.
# Note that setting the level to either extreme may or may not
... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/compressor/custom.rb | lib/backup/compressor/custom.rb | module Backup
module Compressor
class Custom < Base
##
# Specify the system command to invoke a compressor,
# including any command-line arguments.
# e.g. @compressor.command = 'pbzip2 -p2 -4'
#
# The data to be compressed will be piped to the command's STDIN,
# and it sh... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/config/helpers.rb | lib/backup/config/helpers.rb | require "ostruct"
module Backup
module Config
module Helpers
def self.included(klass)
klass.extend ClassMethods
end
module ClassMethods
def defaults
@defaults ||= Config::Defaults.new
if block_given?
yield @defaults
else
@d... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/config/dsl.rb | lib/backup/config/dsl.rb | module Backup
module Config
# Context for loading user config.rb and model files.
class DSL
class Error < Backup::Error; end
Model = Backup::Model
class << self
private
# List the available database, storage, syncer, compressor, encryptor
# and notifier constants. T... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/database/mysql.rb | lib/backup/database/mysql.rb | module Backup
module Database
class MySQL < Base
class Error < Backup::Error; end
##
# Name of the database that needs to get dumped
# To dump all databases, set this to `:all` or leave blank.
attr_accessor :name
##
# Credentials for the specified database
attr_ac... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/database/openldap.rb | lib/backup/database/openldap.rb | module Backup
module Database
class OpenLDAP < Base
class Error < Backup::Error; end
##
# Name of the ldap backup
attr_accessor :name
##
# run slapcat under sudo if needed
# make sure to set SUID on a file, to let you run the file with permissions of file owner
# ... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/database/riak.rb | lib/backup/database/riak.rb | module Backup
module Database
class Riak < Base
##
# Node is the node from which to perform the backup.
# Default: riak@127.0.0.1
attr_accessor :node
##
# Cookie is the Erlang cookie/shared secret used to connect to the node.
# Default: riak
attr_accessor :cookie
... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/database/redis.rb | lib/backup/database/redis.rb | module Backup
module Database
class Redis < Base
class Error < Backup::Error; end
MODES = [:copy, :sync]
##
# Mode of operation.
#
# [:copy]
# Copies the redis dump file specified by {#rdb_path}.
# This data will be current as of the last RDB Snapshot
# ... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/database/base.rb | lib/backup/database/base.rb | module Backup
module Database
class Error < Backup::Error; end
class Base
include Utilities::Helpers
include Config::Helpers
attr_reader :model, :database_id, :dump_path
##
# If given, +database_id+ will be appended to the #dump_filename.
# This is required if multiple D... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/database/mongodb.rb | lib/backup/database/mongodb.rb | module Backup
module Database
class MongoDB < Base
class Error < Backup::Error; end
##
# Name of the database that needs to get dumped
attr_accessor :name
##
# Credentials for the specified database
attr_accessor :username, :password, :authdb
##
# Connectiv... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/database/postgresql.rb | lib/backup/database/postgresql.rb | module Backup
module Database
class PostgreSQL < Base
class Error < Backup::Error; end
##
# Name of the database that needs to get dumped.
# To dump all databases, set this to `:all` or leave blank.
# +username+ must be a PostgreSQL superuser to run `pg_dumpall`.
attr_accessor... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/database/sqlite.rb | lib/backup/database/sqlite.rb | module Backup
module Database
class SQLite < Base
class Error < Backup::Error; end
##
# Path to the sqlite3 file
attr_accessor :path
##
# Path to sqlite utility (optional)
attr_accessor :sqlitedump_utility
##
# Creates a new instance of the SQLite adapter o... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/syncer/base.rb | lib/backup/syncer/base.rb | module Backup
module Syncer
class Base
include Utilities::Helpers
include Config::Helpers
##
# Path to store the synced files/directories to
attr_accessor :path
##
# Flag for mirroring the files/directories
attr_accessor :mirror
##
# Optional user-def... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/syncer/rsync/local.rb | lib/backup/syncer/rsync/local.rb | module Backup
module Syncer
module RSync
class Local < Base
def perform!
log!(:started)
create_dest_path!
run("#{rsync_command} #{paths_to_push} '#{dest_path}'")
log!(:finished)
end
private
# Expand path, since this is local and she... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/syncer/rsync/base.rb | lib/backup/syncer/rsync/base.rb | module Backup
module Syncer
module RSync
class Base < Syncer::Base
##
# Additional String or Array of options for the rsync cli
attr_accessor :additional_rsync_options
attr_accessor :archive
def initialize(syncer_id = nil, &block)
super
instance_e... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/syncer/rsync/push.rb | lib/backup/syncer/rsync/push.rb | module Backup
module Syncer
module RSync
class Push < Base
##
# Mode of operation
#
# [:ssh (default)]
# Connects to the remote via SSH.
# Does not use an rsync daemon on the remote.
#
# [:ssh_daemon]
# Connects to the remote via ... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/syncer/rsync/pull.rb | lib/backup/syncer/rsync/pull.rb | module Backup
module Syncer
module RSync
class Pull < Push
def perform!
log!(:started)
write_password_file!
create_dest_path!
run("#{rsync_command} #{host_options}#{paths_to_pull} " \
"'#{dest_path}'")
log!(:finished)
ensure
... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/syncer/cloud/base.rb | lib/backup/syncer/cloud/base.rb | module Backup
module Syncer
module Cloud
class Error < Backup::Error; end
class Base < Syncer::Base
MUTEX = Mutex.new
##
# Number of threads to use for concurrency.
#
# Default: 0 (no concurrency)
attr_accessor :thread_count
##
# Numbe... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/syncer/cloud/s3.rb | lib/backup/syncer/cloud/s3.rb | require "backup/cloud_io/s3"
module Backup
module Syncer
module Cloud
class S3 < Base
class Error < Backup::Error; end
##
# Amazon Simple Storage Service (S3) Credentials
attr_accessor :access_key_id, :secret_access_key, :use_iam_profile
##
# Amazon S3 buck... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/syncer/cloud/cloud_files.rb | lib/backup/syncer/cloud/cloud_files.rb | require "backup/cloud_io/cloud_files"
module Backup
module Syncer
module Cloud
class CloudFiles < Base
class Error < Backup::Error; end
##
# Rackspace CloudFiles Credentials
attr_accessor :username, :api_key
##
# Rackspace CloudFiles Container
attr_... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/syncer/cloud/local_file.rb | lib/backup/syncer/cloud/local_file.rb | require "digest/md5"
module Backup
module Syncer
module Cloud
class LocalFile
attr_reader :path
attr_accessor :md5
class << self
# Returns a Hash of LocalFile objects for each file within +dir+,
# except those matching any of the +excludes+.
# Hash key... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/encryptor/base.rb | lib/backup/encryptor/base.rb | module Backup
module Encryptor
class Base
include Utilities::Helpers
include Config::Helpers
def initialize
load_defaults!
end
private
##
# Return the encryptor name, with Backup namespace removed
def encryptor_name
self.class.to_s.sub("Backup::",... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/encryptor/open_ssl.rb | lib/backup/encryptor/open_ssl.rb | module Backup
module Encryptor
class OpenSSL < Base
BASE_OPTIONS = [
"aes-256-cbc",
"-pbkdf2",
"-iter", "310000" # As per OWASP "Password Storage Cheat Sheet"
].freeze
##
# The password that'll be used to encrypt the backup. This
# password will be required t... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
backup/backup | https://github.com/backup/backup/blob/86c9b07c2a2974376888b1506001f77792d6359a/lib/backup/encryptor/gpg.rb | lib/backup/encryptor/gpg.rb | module Backup
module Encryptor
##
# The GPG Encryptor allows you to encrypt your final archive using GnuPG,
# using one of three {#mode modes} of operation.
#
# == First, setup defaults in your +config.rb+ file
#
# Configure the {#keys} Hash using {.defaults} in your +config.rb+
# to s... | ruby | MIT | 86c9b07c2a2974376888b1506001f77792d6359a | 2026-01-04T15:45:04.712671Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/observers/email_delivery_observer.rb | app/observers/email_delivery_observer.rb | # frozen_string_literal: true
class EmailDeliveryObserver
def self.delivered_email(message)
EmailDeliveryObserver::HandleEmailEvent.perform(message)
EmailDeliveryObserver::HandleCustomerEmailInfo.perform(message)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/observers/email_delivery_observer/handle_customer_email_info.rb | app/observers/email_delivery_observer/handle_customer_email_info.rb | # frozen_string_literal: true
module EmailDeliveryObserver::HandleCustomerEmailInfo
class InvalidHeaderError < StandardError
attr_reader :metadata
def initialize(message, metadata)
super(message)
@metadata = metadata
end
def bugsnag_meta_data
{ debug: metadata }
end
end
e... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/observers/email_delivery_observer/handle_email_event.rb | app/observers/email_delivery_observer/handle_email_event.rb | # frozen_string_literal: true
module EmailDeliveryObserver::HandleEmailEvent
extend self
def perform(message)
message.to.each do |email|
EmailEvent.log_send_events(email, message.date)
rescue => e
Rails.logger.error "Error logging email event - #{email} - #{e.message}"
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/jobs/delete_unused_public_files_job.rb | app/jobs/delete_unused_public_files_job.rb | # frozen_string_literal: true
class DeleteUnusedPublicFilesJob
include Sidekiq::Job
sidekiq_options queue: :low, retry: 3
def perform
PublicFile
.alive
.with_attached_file
.where("scheduled_for_deletion_at < ?", Time.current)
.find_in_batches do |batch|
ReplicaLagWatcher.wat... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/subdomain_redirector_service.rb | app/services/subdomain_redirector_service.rb | # frozen_string_literal: true
class SubdomainRedirectorService
CACHE_KEY = "subdomain_redirects_cache_key"
private_constant :CACHE_KEY
REDIS_KEY = "subdomain_redirects_config"
private_constant :REDIS_KEY
PROTECTED_HOSTS = VALID_API_REQUEST_HOSTS + VALID_REQUEST_HOSTS
private_constant :PROTECTED_HOSTS
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/admin_funds_csv_report_service.rb | app/services/admin_funds_csv_report_service.rb | # frozen_string_literal: true
class AdminFundsCsvReportService
attr_reader :report
def initialize(report)
@report = report
end
def generate
CSV.generate do |csv|
report.each do |(type, data)|
data.each do |payment_method|
transaction_type_key = type == "Purchases" ? "Sales" : ... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/sitemap_service.rb | app/services/sitemap_service.rb | # frozen_string_literal: true
class SitemapService
HOST = UrlService.root_domain_with_protocol
MAX_SITEMAP_LINKS = 50_000
SITEMAP_PATH_MONTHLY = "sitemap/products/monthly"
def generate(date = Date.current)
# Parse date from Sidekiq job argument
date = Date.parse(date) if date.is_a?(String)
period... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/subscribe_preview_generator_service.rb | app/services/subscribe_preview_generator_service.rb | # frozen_string_literal: true
# Used for OpenGraph consumers like: https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/summary-card-with-large-image
class SubscribePreviewGeneratorService
RETINA_PIXEL_RATIO = 2
ASPECT_RATIO = 128/67r
WIDTH = 512
HEIGHT = WIDTH / ASPECT_RATIO
CHROME_ARGS... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/save_installment_service.rb | app/services/save_installment_service.rb | # frozen_string_literal: true
class SaveInstallmentService
attr_reader :seller, :params, :installment, :product, :preview_email_recipient, :error
def initialize(seller:, params:, installment: nil, preview_email_recipient:)
@seller = seller
@params = params
@installment = installment
@preview_email... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/notion_api.rb | app/services/notion_api.rb | # frozen_string_literal: true
class NotionApi
include HTTParty
base_uri "https://api.notion.com/v1"
def get_bot_token(code:, user:)
body = {
code:,
grant_type: "authorization_code",
external_account: {
key: user.external_id,
name: user.email
}
}
self.class.po... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/update_payout_method.rb | app/services/update_payout_method.rb | # frozen_string_literal: true
class UpdatePayoutMethod
attr_reader :params, :user
BANK_ACCOUNT_TYPES = {
AchAccount.name => { class: AchAccount, permitted_params: [:routing_number] },
CanadianBankAccount.name => { class: CanadianBankAccount, permitted_params: %i[institution_number transit_number] },
A... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/tra_tin_validation_service.rb | app/services/tra_tin_validation_service.rb | # frozen_string_literal: true
class TraTinValidationService
attr_reader :tra_tin
def initialize(tra_tin)
@tra_tin = tra_tin
end
def process
return false if tra_tin.blank?
tra_tin.match?(/\A\d{2}-\d{6}-[A-Z]\z/)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/abn_validation_service.rb | app/services/abn_validation_service.rb | # frozen_string_literal: true
class AbnValidationService
attr_reader :abn_id
def initialize(abn_id)
@abn_id = abn_id
end
def process
return false if abn_id.blank?
response = Rails.cache.fetch("vatstack_validation_#{abn_id}", expires_in: 10.minutes) do
url = "https://api.vatstack.com/v1/val... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/update_user_compliance_info.rb | app/services/update_user_compliance_info.rb | # frozen_string_literal: true
class UpdateUserComplianceInfo
attr_reader :compliance_params, :user
def initialize(compliance_params:, user:)
@compliance_params = compliance_params
@user = user
end
def process
if compliance_params.present?
old_compliance_info = user.fetch_or_build_user_compl... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/mva_validation_service.rb | app/services/mva_validation_service.rb | # frozen_string_literal: true
class MvaValidationService
attr_reader :mva_id
def initialize(mva_id)
@mva_id = mva_id
end
def process
return false if mva_id.blank?
response = Rails.cache.fetch("vatstack_validation_#{mva_id}", expires_in: 10.minutes) do
url = "https://api.vatstack.com/v1/val... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/oman_vat_number_validation_service.rb | app/services/oman_vat_number_validation_service.rb | # frozen_string_literal: true
class OmanVatNumberValidationService
attr_reader :vat_number
def initialize(vat_number)
@vat_number = vat_number
end
def process
return false if vat_number.blank?
vat_number.match?(/\AOM\d{10}\z/)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/stripe_tax_forms_api.rb | app/services/stripe_tax_forms_api.rb | # frozen_string_literal: true
class StripeTaxFormsApi
include HTTParty
def initialize(stripe_account_id:, form_type:, year:)
@stripe_account_id = stripe_account_id
@form_type = form_type
@year = year
end
def download_tax_form
tax_form = tax_forms_by_year[year]
return if tax_form.nil?
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/qst_validation_service.rb | app/services/qst_validation_service.rb | # frozen_string_literal: true
class QstValidationService
attr_reader :qst_id
def initialize(qst_id)
@qst_id = qst_id
end
def process
return false if qst_id.blank?
Rails.cache.fetch("revenu_quebec_validation_#{qst_id}", expires_in: 10.minutes) do
valid_qst?
end
end
private
QST_... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/suo_semaphore.rb | app/services/suo_semaphore.rb | # frozen_string_literal: true
class SuoSemaphore
class << self
def recurring_charge(subscription_id)
Suo::Client::Redis.new("locks:recurring_charge:#{subscription_id}", default_options)
end
def product_inventory(product_id, extra_options = {})
options = default_options.merge(stale_lock_expir... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/expiring_s3_file_service.rb | app/services/expiring_s3_file_service.rb | # frozen_string_literal: true
class ExpiringS3FileService
DEFAULT_FILE_EXPIRY = 7.days
def initialize(file:,
filename: nil,
path: nil,
prefix: "File",
extension: nil,
expiry: DEFAULT_FILE_EXPIRY,
bucket: S3_BUCKE... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/save_files_service.rb | app/services/save_files_service.rb | # frozen_string_literal: true
class SaveFilesService
delegate :product_files, to: :owner
attr_reader :owner, :params, :rich_content_params
def self.perform(*args)
new(*args).perform
end
# Params:
# +owner+ - an object of a model having the WithProductFiles mixin
# +params+ - a nested hash of produc... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/recommended_wishlists_service.rb | app/services/recommended_wishlists_service.rb | # frozen_string_literal: true
class RecommendedWishlistsService
def self.fetch(limit:, current_seller:, curated_product_ids: [], taxonomy_id: nil)
scope = Wishlist.where(recommendable: true).order(recent_follower_count: :desc)
scope = scope.where.not(user_id: current_seller.id) if current_seller.present?
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/product_duplicator_service.rb | app/services/product_duplicator_service.rb | # frozen_string_literal: true
class ProductDuplicatorService
REDIS_STORAGE_NS = Redis::Namespace.new(:product_duplicator_service, redis: $redis)
private_constant :REDIS_STORAGE_NS
TIMEOUT_FOR_DUPLICATE_PRODUCT_CACHE = 10.minutes
private_constant :TIMEOUT_FOR_DUPLICATE_PRODUCT_CACHE
DUPLICATING = "product_d... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/save_public_files_service.rb | app/services/save_public_files_service.rb | # frozen_string_literal: true
class SavePublicFilesService
attr_reader :resource, :files_params, :content
def initialize(resource:, files_params:, content:)
@resource = resource
@files_params = files_params.presence || []
@content = content.to_s
end
def process
ActiveRecord::Base.transaction ... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/url_service.rb | app/services/url_service.rb | # frozen_string_literal: true
class UrlService
class << self
def domain_with_protocol
"#{PROTOCOL}://#{DOMAIN}"
end
def root_domain_with_protocol
"#{PROTOCOL}://#{ROOT_DOMAIN}"
end
def discover_domain_with_protocol
"#{PROTOCOL}://#{DISCOVER_DOMAIN}"
end
def api_domain... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/trn_validation_service.rb | app/services/trn_validation_service.rb | # frozen_string_literal: true
class TrnValidationService
attr_reader :trn
def initialize(trn)
@trn = trn
end
def process
return false if trn.blank?
trn.length == 15
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/purchase_search_service.rb | app/services/purchase_search_service.rb | # frozen_string_literal: true
class PurchaseSearchService
DEFAULT_OPTIONS = {
# There must not be any active filters by default: calling .search without any options should return all purchases.
# Values - They can be an ActiveRecord object, an id, or an Array of both
seller: nil,
purchaser: nil,
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/secure_encrypt_service.rb | app/services/secure_encrypt_service.rb | # frozen_string_literal: true
class SecureEncryptService
class Error < StandardError; end
class MissingKeyError < Error; end
class InvalidKeyError < Error; end
class << self
# Encrypts the given text.
#
# @param text [String] The text to encrypt.
# @return [String] The encrypted text.
def ... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/gst_validation_service.rb | app/services/gst_validation_service.rb | # frozen_string_literal: true
class GstValidationService
attr_reader :gst_id
def initialize(gst_id)
@gst_id = gst_id
end
def process
return false if gst_id.blank?
Rails.cache.fetch("iras_validation_#{gst_id}", expires_in: 10.minutes) do
headers = {
"X-IBM-Client-Id" => IRAS_API_ID,... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/forfeit_balance_service.rb | app/services/forfeit_balance_service.rb | # frozen_string_literal: true
class ForfeitBalanceService
include CurrencyHelper
attr_reader :user, :reason
def initialize(user:, reason:)
@user = user
@reason = reason
end
def process
return unless balance_amount_cents_to_forfeit > 0
balances_to_forfeit.each(&:mark_forfeited!)
balan... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/email_suppression_manager.rb | app/services/email_suppression_manager.rb | # frozen_string_literal: true
class EmailSuppressionManager
SUPPRESSION_LISTS = [:bounces, :spam_reports]
private_constant :SUPPRESSION_LISTS
def initialize(email)
@email = email
end
def reasons_for_suppression
# Scan all subusers for the email and note the reasons for suppressions
sendgrid_sub... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/payout_users_service.rb | app/services/payout_users_service.rb | # frozen_string_literal: true
class PayoutUsersService
attr_reader :date, :processor_type, :user_ids, :payout_type
def initialize(date_string:, processor_type:, user_ids:, payout_type: Payouts::PAYOUT_TYPE_STANDARD)
@date = date_string
@processor_type = processor_type
@user_ids = Array.wrap(user_ids)
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/post_sendgrid_api.rb | app/services/post_sendgrid_api.rb | # frozen_string_literal: true
class PostSendgridApi
include Rails.application.routes.url_helpers
include ActionView::Helpers::SanitizeHelper
include MailerHelper, CustomMailerRouteBuilder
_routes.default_url_options = Rails.application.config.action_mailer.default_url_options
MAX_RECIPIENTS = 1_000 # SendGri... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/user_custom_domain_request_service.rb | app/services/user_custom_domain_request_service.rb | # frozen_string_literal: true
class UserCustomDomainRequestService
class << self
def valid?(request)
!GumroadDomainConstraint.matches?(request) && !DiscoverDomainConstraint.matches?(request) && CustomDomain.find_by_host(request.host)&.product.nil?
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/tip_options_service.rb | app/services/tip_options_service.rb | # frozen_string_literal: true
class TipOptionsService
DEFAULT_TIP_OPTIONS = [0, 10, 20]
DEFAULT_DEFAULT_TIP_OPTION = 0
def self.get_tip_options
options = $redis.get(RedisKey.tip_options)
parsed_options = options ? JSON.parse(options) : DEFAULT_TIP_OPTIONS
are_tip_options_valid?(parsed_options) ? par... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/adult_keyword_detector.rb | app/services/adult_keyword_detector.rb | # frozen_string_literal: true
class AdultKeywordDetector
# TODO: Add "pin-up" and "AB/DL". We may have to revisit our approach so we can include non-alphabet characters in the
# list of adult keywords
ADULT_KEYWORD_REGEX = Regexp.new(
"\\b(" +
["futa", "pussy", "bondage", "bdsm", "lewd", "ahegao", "nu... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/custom_domain_verification_service.rb | app/services/custom_domain_verification_service.rb | # frozen_string_literal: true
class CustomDomainVerificationService
RESOLVER_TIMEOUT_IN_SECONDS = 5
SSL_CERT_CHECK_CACHE_EXPIRY = 10.days
attr_reader :domain
def initialize(domain:)
@domain = domain
@dns_resolver = Resolv::DNS.new
dns_resolver.timeouts = RESOLVER_TIMEOUT_IN_SECONDS
end
def ... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/mailer_attachment_or_link_service.rb | app/services/mailer_attachment_or_link_service.rb | # frozen_string_literal: true
# Given a file:
# - Check if file size is acceptable for direct attachment
# - Yes: Return file
# - No: Return temporary expiring S3 link
class MailerAttachmentOrLinkService
# https://sendgrid.com/docs/ui/sending-email/attachments-with-digioh/
# Can send upto 30 MB, but recommended is... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/recommended_products_service.rb | app/services/recommended_products_service.rb | # frozen_string_literal: true
class RecommendedProductsService
MODELS = ["sales"]
MODELS.each do |key|
const_set("MODEL_#{key.upcase}", key)
end
# Returns a ActiveRecord::Relation of ordered products records.
#
# NOTES:
# 1- Because it returns an ActiveRecord::Relation, the result can be used to pre... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/community_chat_recap_generator_service.rb | app/services/community_chat_recap_generator_service.rb | # frozen_string_literal: true
class CommunityChatRecapGeneratorService
MAX_MESSAGES_TO_SUMMARIZE = 1000
MAX_SUMMARY_LENGTH = 500
MIN_SUMMARY_BULLET_POINTS = 1
MAX_SUMMARY_BULLET_POINTS = 5
OPENAI_REQUEST_TIMEOUT_IN_SECONDS = 10
DAILY_SUMMARY_SYSTEM_PROMPT = <<~PROMPT
You are an AI assistant that create... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/pdf_stamping_service.rb | app/services/pdf_stamping_service.rb | # frozen_string_literal: true
module PdfStampingService
class Error < StandardError; end
extend self
ERRORS_TO_RESCUE = [
PdfStampingService::Stamp::Error,
PDF::Reader::MalformedPDFError
].freeze
def can_stamp_file?(product_file:)
PdfStampingService::Stamp.can_stamp_file?(product_file:)
end
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/kra_pin_validation_service.rb | app/services/kra_pin_validation_service.rb | # frozen_string_literal: true
class KraPinValidationService
attr_reader :kra_pin
def initialize(kra_pin)
@kra_pin = kra_pin
end
def process
return false if kra_pin.blank?
kra_pin.match?(/\A[A-Z]\d{9}[A-Z]\z/)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/save_utm_link_service.rb | app/services/save_utm_link_service.rb | # frozen_string_literal: true
class SaveUtmLinkService
def initialize(seller:, params:, utm_link: nil)
@seller = seller
@params = params
@utm_link = utm_link
end
def perform
if utm_link.present?
utm_link.update!(params_permitted_for_update)
else
seller.utm_links.create!(params_pe... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/post_resend_api.rb | app/services/post_resend_api.rb | # frozen_string_literal: true
class PostResendApi
include Rails.application.routes.url_helpers
include ActionView::Helpers::SanitizeHelper
include MailerHelper, CustomMailerRouteBuilder
_routes.default_url_options = Rails.application.config.action_mailer.default_url_options
MAX_RECIPIENTS = 100 # Resend's ba... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/tax_id_validation_service.rb | app/services/tax_id_validation_service.rb | # frozen_string_literal: true
class TaxIdValidationService
attr_reader :tax_id, :country_code
def initialize(tax_id, country_code)
@tax_id = tax_id
@country_code = country_code
end
def process
return false if tax_id.blank?
return false if country_code.blank?
Rails.cache.fetch("tax_id_va... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/zoom_api.rb | app/services/zoom_api.rb | # frozen_string_literal: true
class ZoomApi
include HTTParty
ZOOM_OAUTH_URL = "https://zoom.us/oauth/token"
base_uri "https://api.zoom.us/v2"
def oauth_token(code, redirect_uri)
body = {
grant_type: "authorization_code",
code:,
redirect_uri:
}
HTTParty.post(ZOOM_OAUTH_URL, body... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/username_generator_service.rb | app/services/username_generator_service.rb | # frozen_string_literal: true
class UsernameGeneratorService
attr_reader :user
def initialize(user)
@user = user
end
def username
return if user_data.nil?
name = ensure_valid_username(openai_completion)
name += random_digit while User.exists?(username: name)
return if name.length > 20
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.