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 |
|---|---|---|---|---|---|---|---|---|
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/wishlists/followers_controller.rb | app/controllers/wishlists/followers_controller.rb | # frozen_string_literal: true
class Wishlists::FollowersController < ApplicationController
before_action :authenticate_user!, except: :unsubscribe
after_action :verify_authorized, except: :unsubscribe
before_action { e404 if Feature.inactive?(:follow_wishlists, current_seller) }
def create
wishlist = Wish... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/wishlists/products_controller.rb | app/controllers/wishlists/products_controller.rb | # frozen_string_literal: true
class Wishlists::ProductsController < ApplicationController
before_action :authenticate_user!, except: :index
after_action :verify_authorized, except: :index
def index
wishlist = Wishlist.find_by_external_id!(params[:wishlist_id])
render json: WishlistPresenter.new(wishlis... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/wishlists/following_controller.rb | app/controllers/wishlists/following_controller.rb | # frozen_string_literal: true
class Wishlists::FollowingController < ApplicationController
before_action :authenticate_user!
after_action :verify_authorized
before_action { e404 if Feature.inactive?(:follow_wishlists, current_seller) }
layout "inertia"
def index
authorize Wishlist
@title = "Follow... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/product_affiliate.rb | app/models/product_affiliate.rb | # frozen_string_literal: true
class ProductAffiliate < ApplicationRecord
include FlagShihTzu
self.table_name = "affiliates_links"
belongs_to :affiliate
belongs_to :product, class_name: "Link", foreign_key: :link_id
validates :affiliate, uniqueness: { scope: :product }
validates :affiliate_basis_points, ... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/pakistan_bank_account.rb | app/models/pakistan_bank_account.rb | # frozen_string_literal: true
class PakistanBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "PK"
BANK_CODE_FORMAT_REGEX = /^([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?$/
private_constant :BANK_CODE_FORMAT_REGEX
alias_attribute :bank_code, :bank_number
validate :validate_bank_code
validate ... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/mozambique_bank_account.rb | app/models/mozambique_bank_account.rb | # frozen_string_literal: true
class MozambiqueBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "MZ"
BANK_CODE_FORMAT_REGEX = /^([0-9a-zA-Z]){8,11}$/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /^([0-9a-zA-Z]){21}$/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :ba... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/turkey_bank_account.rb | app/models/turkey_bank_account.rb | # frozen_string_literal: true
class TurkeyBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "TR"
BANK_CODE_FORMAT_REGEX = /^([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?$/
private_constant :BANK_CODE_FORMAT_REGEX
alias_attribute :bank_code, :bank_number
validate :validate_bank_code
validate :v... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/oman_bank_account.rb | app/models/oman_bank_account.rb | # frozen_string_literal: true
class OmanBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "OM"
BANK_CODE_FORMAT_REGEX = /^[A-Z]{4}OM[A-Z0-9]{2,5}\z/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /^[0-9]{6,16}$/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/recurring_service.rb | app/models/recurring_service.rb | # frozen_string_literal: true
class RecurringService < ApplicationRecord
include ExternalId
include JsonData
include DiscountCode
include RecurringService::Recurrence
include RecurringService::Tiers
belongs_to :user, optional: true
has_many :charges, class_name: "ServiceCharge"
has_one :latest_charge,... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/tag.rb | app/models/tag.rb | # frozen_string_literal: true
class Tag < ApplicationRecord
before_validation :clean_name, if: :name_changed?
has_many :product_taggings, dependent: :destroy
has_many :products, through: :product_taggings, class_name: "Link"
validates :name,
presence: true,
uniqueness: { case_sensitive... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/liechtenstein_bank_account.rb | app/models/liechtenstein_bank_account.rb | # frozen_string_literal: true
class LiechtensteinBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "LI"
validate :validate_account_number, if: -> { Rails.env.production? }
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance::Countries::LIE.alpha2
end
def currency
Currency::CHF
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/user_compliance_info.rb | app/models/user_compliance_info.rb | # frozen_string_literal: true
class UserComplianceInfo < ApplicationRecord
self.table_name = "user_compliance_info"
include ExternalId
include Immutable
include UserComplianceInfo::BusinessTypes
include JsonData
stripped_fields :first_name, :last_name, :street_address, :city, :zip_code, :business_name, :... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/self_service_affiliate_product.rb | app/models/self_service_affiliate_product.rb | # frozen_string_literal: true
class SelfServiceAffiliateProduct < ApplicationRecord
include Affiliate::BasisPointsValidations
include Affiliate::DestinationUrlValidations
belongs_to :seller, class_name: "User", optional: true
belongs_to :product, class_name: "Link", optional: true
validates :seller, :produ... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/subscription.rb | app/models/subscription.rb | # frozen_string_literal: true
class Subscription < ApplicationRecord
class DoubleChargeAttemptError < GumroadRuntimeError
def initialize(subscription_id, purchase_id)
super("Attempted to double charge subscription: #{subscription_id}, while purchase #{purchase_id} was in progress")
end
end
class U... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | true |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/mexico_bank_account.rb | app/models/mexico_bank_account.rb | # frozen_string_literal: true
class MexicoBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "MX"
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[0-9]{18}\z/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
validate :validate_account_number
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance::Countr... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/call_availability.rb | app/models/call_availability.rb | # frozen_string_literal: true
class CallAvailability < ApplicationRecord
include ExternalId
belongs_to :call, class_name: "Link"
normalizes :start_time, :end_time, with: -> { _1.change(sec: 0) }
validates_presence_of :call, :start_time, :end_time
validate :start_time_is_before_end_time
scope :upcoming... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/price.rb | app/models/price.rb | # frozen_string_literal: true
class Price < BasePrice
belongs_to :link, optional: true
validates :link, presence: true
validate :recurrence_validation
after_commit :invalidate_product_cache
def as_json(*)
json = {
id: external_id,
price_cents:,
recurrence:
}
if recurrence.pre... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/public_file.rb | app/models/public_file.rb | # frozen_string_literal: true
class PublicFile < ApplicationRecord
include Deletable
DELETE_UNUSED_FILES_AFTER_DAYS = 10
belongs_to :seller, optional: true, class_name: "User"
belongs_to :resource, polymorphic: true
has_one_attached :file
validates :public_id, presence: true, format: { with: /\A[a-z0-9... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/charge_purchase.rb | app/models/charge_purchase.rb | # frozen_string_literal: true
class ChargePurchase < ApplicationRecord
belongs_to :charge
belongs_to :purchase
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/purchasing_power_parity_info.rb | app/models/purchasing_power_parity_info.rb | # frozen_string_literal: true
class PurchasingPowerParityInfo < ApplicationRecord
belongs_to :purchase
validates :purchase, presence: true, uniqueness: true
def factor
super / 100.0
end
def factor=(new_factor)
super(new_factor * 100)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/japan_bank_account.rb | app/models/japan_bank_account.rb | # frozen_string_literal: true
class JapanBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "JP"
BANK_CODE_FORMAT_REGEX = /\A[0-9]{4}\z/
private_constant :BANK_CODE_FORMAT_REGEX
BRANCH_CODE_FORMAT_REGEX = /\A[0-9]{3}\z/
private_constant :BRANCH_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[0-9]{4,8}\z/... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/merchant_account.rb | app/models/merchant_account.rb | # frozen_string_literal: true
class MerchantAccount < ApplicationRecord
include Deletable
include ExternalId
include JsonData
include ChargeProcessable
belongs_to :user, optional: true
has_many :purchases
has_many :credits
has_many :balances
has_many :balance_transactions
has_many :charges
attr... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/panama_bank_account.rb | app/models/panama_bank_account.rb | # frozen_string_literal: true
class PanamaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "PA"
BANK_CODE_FORMAT_REGEX = /^[A-Z]{4}PAPA[A-Z0-9]{3}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^\d{1,18}$/
private_constant :BANK_CODE_FORMAT_REGEX, :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code, :bank_number
val... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/australian_bank_account.rb | app/models/australian_bank_account.rb | # frozen_string_literal: true
class AustralianBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "AUSTRALIAN"
# BSB Number Format:
# • 2 digits to identify bank
# • 1 digit to identify state
# • 3 digits to identify branch
BSB_NUMBER_FORMAT_REGEX = /^[0-9]{6}$/
private_constant :BSB_NUMBER_FORMAT_REGEX
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/albania_bank_account.rb | app/models/albania_bank_account.rb | # frozen_string_literal: true
class AlbaniaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "AL"
BANK_CODE_FORMAT_REGEX = /^([0-9a-zA-Z]){8,11}$/
private_constant :BANK_CODE_FORMAT_REGEX
alias_attribute :bank_code, :bank_number
validate :validate_bank_code
validate :validate_account_number, if: -> { Rails.... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/bangladesh_bank_account.rb | app/models/bangladesh_bank_account.rb | # frozen_string_literal: true
class BangladeshBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "BD"
BANK_CODE_FORMAT_REGEX = /^([0-9a-zA-Z]){9}$/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /^([0-9a-zA-Z]){13,17}$/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :ba... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/follower.rb | app/models/follower.rb | # frozen_string_literal: true
class Follower < ApplicationRecord
include ExternalId
include TimestampScopes
include Follower::From
include Deletable
include ConfirmedFollowerEvent::FollowerCallbacks
include Follower::AudienceMember
has_paper_trail
belongs_to :user, foreign_key: "followed_id", optiona... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/thumbnail.rb | app/models/thumbnail.rb | # frozen_string_literal: true
class Thumbnail < ApplicationRecord
include Deletable
include CdnUrlHelper
DISPLAY_THUMBNAIL_DIMENSION = 600
MAX_FILE_SIZE = 5.megabytes
ALLOW_CONTENT_TYPES = /jpeg|gif|png|jpg/i
belongs_to :product, class_name: "Link", optional: true
has_one_attached :file
before_crea... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/affiliate.rb | app/models/affiliate.rb | # frozen_string_literal: true
class Affiliate < ApplicationRecord
include ExternalId
include Deletable
include CurrencyHelper
include FlagShihTzu
include AudienceMember, Cookies
self.ignored_columns = %w(archived_at)
QUERY_PARAM = "affiliate_id"
SHORT_QUERY_PARAM = "a"
QUERY_PARAMS = [QUERY_PARAM,... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/singaporean_bank_account.rb | app/models/singaporean_bank_account.rb | # frozen_string_literal: true
class SingaporeanBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "SG"
BANK_CODE_FORMAT_REGEX = /\A[0-9]{4}\z/
private_constant :BANK_CODE_FORMAT_REGEX
BRANCH_CODE_FORMAT_REGEX = /\A[0-9]{3}\z/
private_constant :BRANCH_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[0-9]{6... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/seller_profile_wishlists_section.rb | app/models/seller_profile_wishlists_section.rb | # frozen_string_literal: true
class SellerProfileWishlistsSection < SellerProfileSection
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/subtitle_file.rb | app/models/subtitle_file.rb | # frozen_string_literal: true
class SubtitleFile < ApplicationRecord
include S3Retrievable, ExternalId, JsonData, Deletable, CdnDeletable
VALID_FILE_TYPE_REGEX = /\A.+\.(srt|sub|sbv|vtt)\z/
has_paper_trail
belongs_to :product_file, optional: true
validates_presence_of :product_file, :url
validate :ens... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/product_page_view.rb | app/models/product_page_view.rb | # frozen_string_literal: true
class ProductPageView
include Elasticsearch::Model
index_name "product_page_views"
def self.index_name_from_body(body)
USE_ES_ALIASES ? "#{index_name}-#{body["timestamp"].first(7)}" : index_name
end
settings number_of_shards: 1, number_of_replicas: 0
mapping dynamic: :... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/computed_sales_analytics_day.rb | app/models/computed_sales_analytics_day.rb | # frozen_string_literal: true
class ComputedSalesAnalyticsDay < ApplicationRecord
def self.read_data_from_keys(keys)
with_empty_values = keys.zip([nil]).to_h
with_existing_values = where(key: keys).order(:key).pluck(:key, :data).to_h do |(key, data)|
[key, JSON.parse(data)]
end
with_empty_value... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/third_party_analytic.rb | app/models/third_party_analytic.rb | # frozen_string_literal: true
class ThirdPartyAnalytic < ApplicationRecord
include ExternalId
include Deletable
belongs_to :user, optional: true
belongs_to :link, optional: true
validates :user, presence: true
after_commit :clear_related_products_cache
scope :universal, -> { where("link_id is null") ... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/event.rb | app/models/event.rb | # frozen_string_literal: true
class Event < ApplicationRecord
include TimestampScopes
include FlagShihTzu
# Events with names listed below are created and kept forever.
# We also create events that aren't in this list if they have a user_id (see Events#created_event),
# but they're automatically deleted aft... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/direct_affiliate.rb | app/models/direct_affiliate.rb | # frozen_string_literal: true
class DirectAffiliate < Affiliate
include Affiliate::BasisPointsValidations
include Affiliate::DestinationUrlValidations
include Affiliate::Sorting
AFFILIATE_COOKIE_LIFETIME_DAYS = 30
attr_accessor :prevent_sending_invitation_email, :prevent_sending_invitation_email_to_seller
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/saint_lucia_bank_account.rb | app/models/saint_lucia_bank_account.rb | # frozen_string_literal: true
class SaintLuciaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "LC"
BANK_CODE_FORMAT_REGEX = /^[a-zA-Z0-9]{8,11}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^[a-zA-Z0-9]{1,32}$/
private_constant :BANK_CODE_FORMAT_REGEX, :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code, :bank_number... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/moldova_bank_account.rb | app/models/moldova_bank_account.rb | # frozen_string_literal: true
class MoldovaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "MD"
BANK_CODE_FORMAT_REGEX = /^[A-Z0-9]{4}MD[A-Z0-9]{5}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^MD\d{2}[A-Z0-9]{20}$/
private_constant :BANK_CODE_FORMAT_REGEX, :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code, :bank_... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/variant_price.rb | app/models/variant_price.rb | # frozen_string_literal: true
class VariantPrice < BasePrice
belongs_to :variant, optional: true
validates :variant, presence: true
validate :recurrence_validation
validate :price_cents_validation
delegate :link, to: :variant
def price_formatted_without_symbol
return "" if price_cents.blank?
di... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/czech_republic_bank_account.rb | app/models/czech_republic_bank_account.rb | # frozen_string_literal: true
class CzechRepublicBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "CZ"
validate :validate_account_number, if: -> { Rails.env.production? }
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance::Countries::CZE.alpha2
end
def currency
Currency::CZK
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/malaysia_bank_account.rb | app/models/malaysia_bank_account.rb | # frozen_string_literal: true
class MalaysiaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "MY"
BANK_CODE_FORMAT_REGEX = /^([0-9a-zA-Z]){8,11}$/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /^([0-9]){5,17}$/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_cod... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/subscription_event.rb | app/models/subscription_event.rb | # frozen_string_literal: true
class SubscriptionEvent < ApplicationRecord
belongs_to :subscription
belongs_to :seller, class_name: "User"
before_validation :assign_seller, on: :create
validates :event_type, :occurred_at, presence: true
validate :consecutive_event_type_not_duplicated
enum event_type: %i[... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/ecuador_bank_account.rb | app/models/ecuador_bank_account.rb | # frozen_string_literal: true
class EcuadorBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "EC"
BANK_CODE_FORMAT_REGEX = /^[a-zA-Z0-9]{8,11}\z/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[0-9]{5,18}\z/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code,... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/tos_agreement.rb | app/models/tos_agreement.rb | # frozen_string_literal: true
class TosAgreement < ApplicationRecord
include ExternalId
belongs_to :user, optional: true
validates :user, presence: true
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/uzbekistan_bank_account.rb | app/models/uzbekistan_bank_account.rb | # frozen_string_literal: true
class UzbekistanBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "UZ"
BANK_CODE_FORMAT_REGEX = /^([a-zA-Z0-9]){8,11}$/
BRANCH_CODE_FORMAT_REGEX = /^([0-9]){5}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^\d{5,20}$/
private_constant :BANK_CODE_FORMAT_REGEX, :BRANCH_CODE_FORMAT_REGEX, :ACCOUNT... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/order.rb | app/models/order.rb | # frozen_string_literal: true
class Order < ApplicationRecord
include ExternalId, Orderable, FlagShihTzu
belongs_to :purchaser, class_name: "User", optional: true
has_many :order_purchases, dependent: :destroy
has_many :purchases, through: :order_purchases, dependent: :destroy
has_many :charges, dependent:... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/blocked_object.rb | app/models/blocked_object.rb | # frozen_string_literal: true
class BlockedObject
include Mongoid::Document
include Mongoid::Timestamps
# Block the IP for 6 months so that if the IP gets reallocated can be used again
# Also prevents the list of blocked IPs to grow indefinitely
IP_ADDRESS_BLOCKING_DURATION_IN_MONTHS = 6
field :object_ty... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/indonesia_bank_account.rb | app/models/indonesia_bank_account.rb | # frozen_string_literal: true
class IndonesiaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "ID"
BANK_CODE_FORMAT_REGEX = /\A[0-9a-zA-Z]{3,4}\z/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[0-9]{1,35}\z/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_cod... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/north_macedonia_bank_account.rb | app/models/north_macedonia_bank_account.rb | # frozen_string_literal: true
class NorthMacedoniaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "MK"
BANK_CODE_FORMAT_REGEX = /\A[a-zA-Z0-9]{8,11}\z/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[a-zA-Z0-9]{19}\z/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/korea_bank_account.rb | app/models/korea_bank_account.rb | # frozen_string_literal: true
class KoreaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "KR"
BANK_CODE_FORMAT_REGEX = /\A[A-Za-z]{4}KR[A-Za-z0-9]{2,5}\z/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[0-9]{11,15}\z/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/order_purchase.rb | app/models/order_purchase.rb | # frozen_string_literal: true
class OrderPurchase < ApplicationRecord
belongs_to :order
belongs_to :purchase
validates_presence_of :order
validates_presence_of :purchase
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/algeria_bank_account.rb | app/models/algeria_bank_account.rb | # frozen_string_literal: true
class AlgeriaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "DZ"
BANK_CODE_FORMAT_REGEX = /^([0-9a-zA-Z]){8,11}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^\d{20}$/
private_constant :BANK_CODE_FORMAT_REGEX, :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code, :bank_number
validate... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/uk_bank_account.rb | app/models/uk_bank_account.rb | # frozen_string_literal: true
class UkBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "UK"
SORT_CODE_FORMAT_REGEX = /^\d{2}-\d{2}-\d{2}$/
private_constant :SORT_CODE_FORMAT_REGEX
alias_attribute :sort_code, :bank_number
validate :validate_sort_code
def routing_number
sort_code
end
def bank_acco... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/utm_link.rb | app/models/utm_link.rb | # frozen_string_literal: true
class UtmLink < ApplicationRecord
include Deletable, ExternalId
MAX_UTM_PARAM_LENGTH = 200
has_paper_trail
belongs_to :seller, class_name: "User"
belongs_to :target_resource, polymorphic: true, optional: true
has_many :utm_link_visits, dependent: :destroy
has_many :utm_l... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/product_folder.rb | app/models/product_folder.rb | # frozen_string_literal: true
class ProductFolder < ApplicationRecord
include ExternalId
include Deletable
scope :in_order, -> { order(position: :asc) }
belongs_to :link, foreign_key: "product_id", optional: true
validates_presence_of :name
def as_json(options = {})
{
id: external_id,
nam... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/seller_profile_posts_section.rb | app/models/seller_profile_posts_section.rb | # frozen_string_literal: true
class SellerProfilePostsSection < SellerProfileSection
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/bahamas_bank_account.rb | app/models/bahamas_bank_account.rb | # frozen_string_literal: true
class BahamasBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "BS"
BANK_CODE_FORMAT_REGEX = /^[a-z0-9A-Z]{8,11}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^\d{1,10}$/
private_constant :BANK_CODE_FORMAT_REGEX, :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code, :bank_number
validate... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/community_chat_message.rb | app/models/community_chat_message.rb | # frozen_string_literal: true
class CommunityChatMessage < ApplicationRecord
include Deletable
include ExternalId
belongs_to :community
belongs_to :user
has_many :last_read_community_chat_messages, dependent: :destroy
validates :content, presence: true, length: { minimum: 1, maximum: 20_000 }
scope :... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/credit_card.rb | app/models/credit_card.rb | # frozen_string_literal: true
class CreditCard < ApplicationRecord
include PurchaseErrorCode
include ChargeProcessable
has_many :users
has_one :purchase
has_one :subscription
belongs_to :preorder, optional: true
has_one :bank_account
attr_accessor :error_code, :stripe_error_code
validates :stripe... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/audience_member.rb | app/models/audience_member.rb | # frozen_string_literal: true
class AudienceMember < ApplicationRecord
VALID_FILTER_TYPES = %w[customer follower affiliate].freeze
belongs_to :seller, class_name: "User"
after_initialize :assign_default_details_value
before_validation :compact_details
before_validation :normalize_email, if: :email?
valida... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/license.rb | app/models/license.rb | # frozen_string_literal: true
class License < ApplicationRecord
has_paper_trail only: %i[disabled_at serial]
include FlagShihTzu
include ExternalId
validates_numericality_of :uses, greater_than_or_equal_to: 0
validates_presence_of :serial
belongs_to :link, optional: true
belongs_to :purchase, optional... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/south_africa_bank_account.rb | app/models/south_africa_bank_account.rb | # frozen_string_literal: true
class SouthAfricaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "ZA"
BANK_CODE_FORMAT_REGEX = /^([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?$/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[0-9a-zA-Z]{1,16}\z/
private_constant :ACCOUNT... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/installment_plan_snapshot.rb | app/models/installment_plan_snapshot.rb | # frozen_string_literal: true
class InstallmentPlanSnapshot < ApplicationRecord
belongs_to :payment_option
validates :payment_option, uniqueness: true
validates :number_of_installments, presence: true, numericality: { greater_than: 0, only_integer: true }
validates :recurrence, presence: true
validates :tot... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/rwanda_bank_account.rb | app/models/rwanda_bank_account.rb | # frozen_string_literal: true
class RwandaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "RW"
BANK_CODE_FORMAT_REGEX = /^[A-Za-z0-9]{8,11}$/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /^[0-9]{1,15}$/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code, :ba... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/seller_profile_products_section.rb | app/models/seller_profile_products_section.rb | # frozen_string_literal: true
class SellerProfileProductsSection < SellerProfileSection
def product_names
# Prevents a full table scan (see https://github.com/gumroad/web/pull/26855)
Link.where(user_id: seller_id, id: shown_products).pluck(:name)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/antigua_and_barbuda_bank_account.rb | app/models/antigua_and_barbuda_bank_account.rb | # frozen_string_literal: true
class AntiguaAndBarbudaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "AG"
BANK_CODE_FORMAT_REGEX = /^[a-zA-Z0-9]{8,11}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^[a-zA-Z0-9]{1,32}$/
private_constant :BANK_CODE_FORMAT_REGEX, :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code, :bank... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/wishlist_product.rb | app/models/wishlist_product.rb | # frozen_string_literal: true
class WishlistProduct < ApplicationRecord
include ExternalId
include Deletable
WISHLIST_PRODUCT_LIMIT = 100
belongs_to :wishlist
belongs_to :product, class_name: "Link"
belongs_to :variant, class_name: "BaseVariant", optional: true
scope :available_to_buy, -> { joins(prod... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/product_review_response.rb | app/models/product_review_response.rb | # frozen_string_literal: true
class ProductReviewResponse < ApplicationRecord
belongs_to :user
belongs_to :product_review
validates :message, presence: true
after_create_commit :notify_reviewer_via_email
private
def notify_reviewer_via_email
CustomerMailer.review_response(self).deliver_later
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/commission.rb | app/models/commission.rb | # frozen_string_literal: true
class Commission < ApplicationRecord
include ExternalId
COMMISSION_DEPOSIT_PROPORTION = 0.5
STATUSES = ["in_progress", "completed", "cancelled"].freeze
STATUSES.each do |status|
const_set("STATUS_#{status.upcase}", status)
end
STATUSES.each do |status|
define_method... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/indian_bank_account.rb | app/models/indian_bank_account.rb | # frozen_string_literal: true
class IndianBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "IN"
# IFSC Format:
# • 4 chars to identify bank
# • 1 reserved digit, always 0
# • 6 chars to identify branch
IFSC_FORMAT_REGEX = /^[A-Za-z]{4}0[A-Z0-9a-z]{6}$/
private_constant :IFSC_FORMAT_REGEX
alias_attrib... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/payment_option.rb | app/models/payment_option.rb | # frozen_string_literal: true
class PaymentOption < ApplicationRecord
include Deletable
belongs_to :subscription
belongs_to :price
belongs_to :installment_plan,
foreign_key: :product_installment_plan_id, class_name: "ProductInstallmentPlan",
optional: true
has_one :installment_plan... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/zoom_integration.rb | app/models/zoom_integration.rb | # frozen_string_literal: true
class ZoomIntegration < Integration
INTEGRATION_DETAILS = %w[user_id email access_token refresh_token]
INTEGRATION_DETAILS.each { |detail| attr_json_data_accessor detail }
def self.is_enabled_for(purchase)
purchase.find_enabled_integration(Integration::ZOOM).present?
end
d... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/sales_export.rb | app/models/sales_export.rb | # frozen_string_literal: true
class SalesExport < ApplicationRecord
belongs_to :recipient, class_name: "User"
# We use :delete_all instead of :destroy to prevent needlessly loading
# a lot of data in memory (column `purchases_data`).
has_many :chunks, class_name: "SalesExportChunk", foreign_key: :export_id, de... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/workflow.rb | app/models/workflow.rb | # frozen_string_literal: true
class Workflow < ApplicationRecord
has_paper_trail
include ActionView::Helpers::NumberHelper, ExternalId, Deletable, JsonData, WithFiltering, FlagShihTzu,
Workflow::AbandonedCartProducts
has_flags 1 => :send_to_past_customers,
column: "flags",
fla... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/benin_bank_account.rb | app/models/benin_bank_account.rb | # frozen_string_literal: true
class BeninBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "BJ"
validate :validate_account_number, if: -> { Rails.env.production? }
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance::Countries::BEN.alpha2
end
def currency
Currency::XOF
end
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/jamaica_bank_account.rb | app/models/jamaica_bank_account.rb | # frozen_string_literal: true
class JamaicaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "JM"
BANK_CODE_FORMAT_REGEX = /^\d{3}$/
BRANCH_CODE_FORMAT_REGEX = /^\d{5}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^\d{1,18}$/
private_constant :BANK_CODE_FORMAT_REGEX, :BRANCH_CODE_FORMAT_REGEX, :ACCOUNT_NUMBER_FORMAT_REGEX
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/tip.rb | app/models/tip.rb | # frozen_string_literal: true
class Tip < ApplicationRecord
belongs_to :purchase
validates :value_cents, numericality: { greater_than: 0 }
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/base_price.rb | app/models/base_price.rb | # frozen_string_literal: true
class BasePrice < ApplicationRecord
has_paper_trail
self.table_name = "prices"
include BasePrice::Recurrence
include ExternalId
include ProductsHelper
include Deletable
include FlagShihTzu
validates :price_cents, :currency, presence: true
has_flags 1 => :is_rental,
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/offer_code.rb | app/models/offer_code.rb | # frozen_string_literal: true
class OfferCode < ApplicationRecord
has_paper_trail
include FlagShihTzu
include ExternalId
include CurrencyHelper
include Mongoable
include Deletable
include MaxPurchaseCount
include OfferCode::Sorting
has_flags 1 => :is_cancellation_discount,
:column => "f... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/discover_search.rb | app/models/discover_search.rb | # frozen_string_literal: true
class DiscoverSearch < ApplicationRecord
belongs_to :user, optional: true
belongs_to :taxonomy, optional: true
belongs_to :clicked_resource, polymorphic: true, optional: true
has_one :discover_search_suggestion
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/refund.rb | app/models/refund.rb | # frozen_string_literal: true
class Refund < ApplicationRecord
FRAUD = "fraud"
include JsonData, FlagShihTzu
belongs_to :user, foreign_key: :refunding_user_id, optional: true
belongs_to :purchase
belongs_to :product, class_name: "Link", foreign_key: :link_id
belongs_to :seller, class_name: "User"
has_m... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/call_limitation_info.rb | app/models/call_limitation_info.rb | # frozen_string_literal: true
class CallLimitationInfo < ApplicationRecord
DEFAULT_MINIMUM_NOTICE_IN_MINUTES = 180
CHECKOUT_GRACE_PERIOD = 3.minutes
belongs_to :call, class_name: "Link"
validate :belongs_to_call
attribute :minimum_notice_in_minutes, default: DEFAULT_MINIMUM_NOTICE_IN_MINUTES
def allows... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/upsell_variant.rb | app/models/upsell_variant.rb | # frozen_string_literal: true
class UpsellVariant < ApplicationRecord
include Deletable, ExternalId
belongs_to :upsell
belongs_to :selected_variant, class_name: "BaseVariant"
belongs_to :offered_variant, class_name: "BaseVariant"
validates_presence_of :upsell, :selected_variant, :offered_variant
validat... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/variant_category.rb | app/models/variant_category.rb | # frozen_string_literal: true
class VariantCategory < ApplicationRecord
include ExternalId
include Deletable
include FlagShihTzu
has_many :variants
has_many :alive_variants, -> { alive }, class_name: "Variant"
belongs_to :link, optional: true
# For tiered membership products, variants are "tiers"
has... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/balance.rb | app/models/balance.rb | # frozen_string_literal: true
class Balance < ApplicationRecord
include ExternalId
include Balance::Searchable
include Balance::RefundEligibilityUnderwriter
belongs_to :user, optional: true
belongs_to :merchant_account, optional: true
has_many :balance_transactions
has_many :successful_sales, class_na... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/macao_bank_account.rb | app/models/macao_bank_account.rb | # frozen_string_literal: true
class MacaoBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "MO"
BANK_CODE_FORMAT_REGEX = /^[A-Za-z0-9]{8,11}$/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /^\d{1,19}$/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code, :bank_n... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/post_email_blast.rb | app/models/post_email_blast.rb | # frozen_string_literal: true
class PostEmailBlast < ApplicationRecord
# requested_at:
# Time when a user clicked on "Publish now".
# For a scheduled post, it is when the post was scheduled for.
# started_at:
# Time when we start the process of finding recipients to send the emails to.
# first_email_... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/taxonomy.rb | app/models/taxonomy.rb | # frozen_string_literal: true
class Taxonomy < ApplicationRecord
has_closure_tree name_column: :slug
has_many :products, class_name: "Link"
has_one :taxonomy_stat, dependent: :destroy
validates :slug, presence: true, uniqueness: { scope: :parent_id }
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/community_chat_recap.rb | app/models/community_chat_recap.rb | # frozen_string_literal: true
class CommunityChatRecap < ApplicationRecord
belongs_to :community_chat_recap_run
belongs_to :community, optional: true
belongs_to :seller, class_name: "User", optional: true
validates :summarized_message_count, presence: true, numericality: { greater_than_or_equal_to: 0 }
vali... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/dispute.rb | app/models/dispute.rb | # frozen_string_literal: true
class Dispute < ApplicationRecord
has_paper_trail
include ExternalId
belongs_to :seller, class_name: "User", optional: true
belongs_to :purchase, optional: true
belongs_to :charge, optional: true
belongs_to :service_charge, optional: true
has_many :credits
has_many :bala... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/product_review_stat.rb | app/models/product_review_stat.rb | # frozen_string_literal: true
class ProductReviewStat < ApplicationRecord
belongs_to :link, optional: true
validates_presence_of :link
validates_uniqueness_of :link_id
RATING_COLUMN_MAP = {
1 => "ratings_of_one_count",
2 => "ratings_of_two_count",
3 => "ratings_of_three_count",
4 => "ratings_... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/shipping_destination.rb | app/models/shipping_destination.rb | # frozen_string_literal: true
class ShippingDestination < ApplicationRecord
include CurrencyHelper
include ShippingDestination::Destinations
include FlagShihTzu
belongs_to :purchase, optional: true
belongs_to :user, optional: true
belongs_to :link, optional: true
has_flags 1 => :is_virtual_country,
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/variant.rb | app/models/variant.rb | # frozen_string_literal: true
class Variant < BaseVariant
include Variant::Prices
belongs_to :variant_category, optional: true
has_many :prices, class_name: "VariantPrice"
has_many :alive_prices, -> { alive }, class_name: "VariantPrice"
has_and_belongs_to_many :skus, join_table: :skus_variants
has_many :... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/product_review_video.rb | app/models/product_review_video.rb | # frozen_string_literal: true
class ProductReviewVideo < ApplicationRecord
include ExternalId
include Deletable
belongs_to :product_review
has_one :video_file, as: :record, dependent: :destroy
validates :video_file, presence: true
accepts_nested_attributes_for :video_file
APPROVAL_STATUES = %w[pending... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/laos_bank_account.rb | app/models/laos_bank_account.rb | # frozen_string_literal: true
class LaosBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "LA"
BANK_CODE_FORMAT_REGEX = /^([0-9a-zA-Z]){8,11}$/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /^([0-9a-zA-Z]){1,18}$/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_c... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/wishlist.rb | app/models/wishlist.rb | # frozen_string_literal: true
class Wishlist < ApplicationRecord
include ExternalId, Deletable, FlagShihTzu
DEFAULT_NAME_MATCHER = /\AWishlist \d+\z/
belongs_to :user
has_many :wishlist_products
has_many :alive_wishlist_products, -> { alive }, class_name: "WishlistProduct"
has_many :products, through: :... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/canadian_bank_account.rb | app/models/canadian_bank_account.rb | # frozen_string_literal: true
class CanadianBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "CANADIAN"
INSTITUTION_NUMBER_FORMAT_REGEX = /^\d{3}$/
TRANSIT_NUMBER_FORMAT_REGEX = /^\d{5}$/
private_constant :INSTITUTION_NUMBER_FORMAT_REGEX, :TRANSIT_NUMBER_FORMAT_REGEX
alias_attribute :institution_number, :ba... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/mongolia_bank_account.rb | app/models/mongolia_bank_account.rb | # frozen_string_literal: true
class MongoliaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "MN"
BANK_CODE_FORMAT_REGEX = /^[0-9a-zA-Z]{8,11}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^\d{1,12}$/
private_constant :BANK_CODE_FORMAT_REGEX, :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code, :bank_number
validat... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/namibia_bank_account.rb | app/models/namibia_bank_account.rb | # frozen_string_literal: true
class NamibiaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "NA"
BANK_CODE_FORMAT_REGEX = /^[a-zA-Z0-9]{8,11}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^[a-zA-Z0-9]{8,13}$/
private_constant :BANK_CODE_FORMAT_REGEX, :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code, :bank_number
... | 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.