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/models/mailer_info.rb | app/models/mailer_info.rb | # frozen_string_literal: true
module MailerInfo
extend self
include Kernel
EMAIL_PROVIDER_SENDGRID = "sendgrid"
EMAIL_PROVIDER_RESEND = "resend"
SENDGRID_X_SMTPAPI_HEADER = "X-SMTPAPI"
FIELD_NAMES = %i[
email_provider environment category mailer_class mailer_method mailer_args purchase_id charge_id ... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/purchase.rb | app/models/purchase.rb | # frozen_string_literal: true
class Purchase < ApplicationRecord
has_paper_trail
include Rails.application.routes.url_helpers
include ActionView::Helpers::DateHelper, CurrencyHelper, ProductsHelper, Mongoable, PurchaseErrorCode,
ExternalId, JsonData, TimestampScopes, Accounting, Blockable, CardCountry... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | true |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/payment.rb | app/models/payment.rb | # frozen_string_literal: true
class Payment < ApplicationRecord
include ExternalId, Payment::Stats, JsonData, FlagShihTzu, TimestampScopes, Payment::FailureReason
CREATING = "creating"
PROCESSING = "processing"
UNCLAIMED = "unclaimed"
COMPLETED = "completed"
FAILED = "failed"
CANCELLED = "cancelled"
R... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/purchase_offer_code_discount.rb | app/models/purchase_offer_code_discount.rb | # frozen_string_literal: true
class PurchaseOfferCodeDiscount < ApplicationRecord
belongs_to :purchase, optional: true
belongs_to :offer_code, optional: true
validates :purchase, presence: true, uniqueness: true
validates :offer_code, presence: true
validates :offer_code_amount, presence: true
validates :... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/argentina_bank_account.rb | app/models/argentina_bank_account.rb | # frozen_string_literal: true
class ArgentinaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "AR"
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[0-9]{22}\z/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
validate :validate_account_number
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance::Cou... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/seller_profile_rich_text_section.rb | app/models/seller_profile_rich_text_section.rb | # frozen_string_literal: true
class SellerProfileRichTextSection < SellerProfileSection
validate :limit_text_size
after_save :trigger_iffy_ingest, if: -> { saved_change_to_json_data? || saved_change_to_header? }
private
def limit_text_size
errors.add(:base, "Text is too large") if text.to_json.length ... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/cambodia_bank_account.rb | app/models/cambodia_bank_account.rb | # frozen_string_literal: true
class CambodiaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "KH"
BANK_CODE_FORMAT_REGEX = /^[0-9a-zA-Z]{8,11}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^[0-9a-zA-Z]{5,15}$/
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/rich_content.rb | app/models/rich_content.rb | # frozen_string_literal: true
class RichContent < ApplicationRecord
include Deletable, ExternalId, Versionable
has_paper_trail
FILE_EMBED_NODE_TYPE = "fileEmbed"
FILE_EMBED_GROUP_NODE_TYPE = "fileEmbedGroup"
ORDERED_LIST_NODE_TYPE = "orderedList"
BULLET_LIST_NODE_TYPE = "bulletList"
LIST_ITEM_NODE_TYPE... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/last_read_community_chat_message.rb | app/models/last_read_community_chat_message.rb | # frozen_string_literal: true
class LastReadCommunityChatMessage < ApplicationRecord
include ExternalId
belongs_to :user
belongs_to :community
belongs_to :community_chat_message
validates :user_id, uniqueness: { scope: :community_id }
def self.set!(user_id:, community_id:, community_chat_message_id:)
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/integration.rb | app/models/integration.rb | # frozen_string_literal: true
class Integration < ApplicationRecord
include FlagShihTzu
include JsonData
include TimestampScopes
CIRCLE = "circle"
DISCORD = "discord"
ZOOM = "zoom"
GOOGLE_CALENDAR = "google_calendar"
ALL_NAMES = [CIRCLE, DISCORD, ZOOM, GOOGLE_CALENDAR]
has_one :product_integration... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/product_tagging.rb | app/models/product_tagging.rb | # frozen_string_literal: true
class ProductTagging < ApplicationRecord
belongs_to :tag, optional: true
belongs_to :product, class_name: "Link", optional: true
validates_uniqueness_of :product_id, scope: :tag_id
scope :owned_by_user, lambda { |user|
joins(:product).where(links: { user_id: user.id })
}
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/wishlist_follower.rb | app/models/wishlist_follower.rb | # frozen_string_literal: true
class WishlistFollower < ApplicationRecord
include ExternalId
include Deletable
belongs_to :wishlist
belongs_to :follower_user, class_name: "User"
validates :follower_user, uniqueness: { scope: [:wishlist_id, :deleted_at], message: "is already following this wishlist." }
val... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/bhutan_bank_account.rb | app/models/bhutan_bank_account.rb | # frozen_string_literal: true
class BhutanBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "BT"
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,17}$/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/stamped_pdf.rb | app/models/stamped_pdf.rb | # frozen_string_literal: true
class StampedPdf < ApplicationRecord
include S3Retrievable, Deletable, CdnDeletable
has_s3_fields :url
belongs_to :url_redirect, optional: true
belongs_to :product_file, optional: true
validates_presence_of :url_redirect, :product_file, :url
def user
product_file.try(:l... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/team_membership.rb | app/models/team_membership.rb | # frozen_string_literal: true
class TeamMembership < ApplicationRecord
include ExternalId
include TimestampStateFields
has_paper_trail
ROLES = %w(owner accountant admin marketing support).freeze
ROLES.each do |role|
self.const_set("ROLE_#{role.upcase}", role)
scope "role_#{role}", -> { where(role... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/email_event_info.rb | app/models/email_event_info.rb | # frozen_string_literal: true
class EmailEventInfo
RECEIPT_MAILER_METHOD = "receipt"
PREORDER_RECEIPT_MAILER_METHOD = "preorder_receipt"
PURCHASE_INSTALLMENT_MAILER_METHOD = "purchase_installment"
FOLLOWER_INSTALLMENT_MAILER_METHOD = "follower_installment"
DIRECT_AFFILIATE_INSTALLMENT_MAILER_METHOD = "direct... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/team_invitation.rb | app/models/team_invitation.rb | # frozen_string_literal: true
class TeamInvitation < ApplicationRecord
include ExternalId
include TimestampStateFields
has_paper_trail
ACTIVE_INTERVAL_IN_DAYS = 7
ROLES = TeamMembership::ROLES
.excluding(TeamMembership::ROLE_OWNER)
ROLES.each do |role|
scope "role_#{role}", -> { where(role:) }
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/colombia_bank_account.rb | app/models/colombia_bank_account.rb | # frozen_string_literal: true
class ColombiaBankAccount < BankAccount
include ColombiaBankAccount::AccountType
BANK_ACCOUNT_TYPE = "CO"
BANK_CODE_FORMAT_REGEX = /\A[0-9]{3}\z/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[0-9]{9,16}\z/
private_constant :ACCOUNT_NUMBER_FORMAT... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/bosnia_and_herzegovina_bank_account.rb | app/models/bosnia_and_herzegovina_bank_account.rb | # frozen_string_literal: true
class BosniaAndHerzegovinaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "BA"
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... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/service_charge.rb | app/models/service_charge.rb | # frozen_string_literal: true
class ServiceCharge < ApplicationRecord
include CurrencyHelper
include ActionView::Helpers::DateHelper
include Mongoable
include PurchaseErrorCode
include DiscountCode
include ExternalId
include JsonData
include TimestampScopes
include Purchase::CardCountrySource
inclu... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/user_compliance_info_request.rb | app/models/user_compliance_info_request.rb | # frozen_string_literal: true
class UserComplianceInfoRequest < ApplicationRecord
include ExternalId
include JsonData
include FlagShihTzu
belongs_to :user, optional: true
validates :user, presence: true
has_flags 1 => :only_needs_field_to_be_partially_provided,
:column => "flags",
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/iceland_bank_account.rb | app/models/iceland_bank_account.rb | # frozen_string_literal: true
class IcelandBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "IS"
validate :validate_account_number
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance::Countries::ISL.alpha2
end
def currency
Currency::EUR
end
def account_number_visual
"... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/cote_d_ivoire_bank_account.rb | app/models/cote_d_ivoire_bank_account.rb | # frozen_string_literal: true
class CoteDIvoireBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "CI"
validate :validate_account_number, if: -> { Rails.env.production? }
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance::Countries::CIV.alpha2
end
def currency
Currency::XOF
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/community_chat_recap_run.rb | app/models/community_chat_recap_run.rb | # frozen_string_literal: true
class CommunityChatRecapRun < ApplicationRecord
has_many :community_chat_recaps, dependent: :destroy
validates :recap_frequency, :from_date, :to_date, presence: true
validates :recap_frequency, uniqueness: { scope: [:from_date, :to_date] }
enum :recap_frequency, { daily: "daily"... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/recommended_purchase_info.rb | app/models/recommended_purchase_info.rb | # frozen_string_literal: true
class RecommendedPurchaseInfo < ApplicationRecord
include FlagShihTzu
belongs_to :purchase, optional: true
belongs_to :recommended_link, class_name: "Link", optional: true
belongs_to :recommended_by_link, class_name: "Link", optional: true
validates_inclusion_of :recommender_m... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/bulgaria_bank_account.rb | app/models/bulgaria_bank_account.rb | # frozen_string_literal: true
class BulgariaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "BG"
validate :validate_account_number, if: -> { Rails.env.production? }
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance::Countries::BGR.alpha2
end
def currency
Currency::EUR
end... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/blocked_customer_object.rb | app/models/blocked_customer_object.rb | # frozen_string_literal: true
class BlockedCustomerObject < ApplicationRecord
SUPPORTED_OBJECT_TYPES = {
email: "email",
charge_processor_fingerprint: "charge_processor_fingerprint"
}.freeze
has_paper_trail
belongs_to :seller, class_name: "User"
validates_presence_of :object_type, :object_value
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/serbia_bank_account.rb | app/models/serbia_bank_account.rb | # frozen_string_literal: true
class SerbiaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "RS"
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 = /^RS([0-9]){18,20}$/
private_constant :ACCOUNT_NUMBER_... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/sri_lanka_bank_account.rb | app/models/sri_lanka_bank_account.rb | # frozen_string_literal: true
class SriLankaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "LK"
BANK_CODE_FORMAT_REGEX = /^[a-z0-9A-Z]{11}$/
BRANCH_CODE_FORMAT_REGEX = /^\d{7}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^\d{10,18}$/
private_constant :BANK_CODE_FORMAT_REGEX, :BRANCH_CODE_FORMAT_REGEX, :ACCOUNT_NUMBER_FO... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/seller_profile_featured_product_section.rb | app/models/seller_profile_featured_product_section.rb | # frozen_string_literal: true
class SellerProfileFeaturedProductSection < SellerProfileSection
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/admin_action_call_info.rb | app/models/admin_action_call_info.rb | # frozen_string_literal: true
class AdminActionCallInfo < ApplicationRecord
validates_presence_of :controller_name, :action_name
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/paraguay_bank_account.rb | app/models/paraguay_bank_account.rb | # frozen_string_literal: true
class ParaguayBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "PY"
BANK_CODE_FORMAT_REGEX = /\A[0-9]{1,2}\z/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[0-9]{1,16}\z/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code, :ban... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/ghana_bank_account.rb | app/models/ghana_bank_account.rb | # frozen_string_literal: true
class GhanaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "GH"
BANK_CODE_FORMAT_REGEX = /\A[0-9]{6}\z/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[0-9]{8,20}\z/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code, :bank_num... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/charge.rb | app/models/charge.rb | # frozen_string_literal: true
class Charge < ApplicationRecord
include ExternalId, Chargeable, Purchase::ChargeEventsHandler, Disputable, FlagShihTzu, Refundable
COMBINED_CHARGE_PREFIX = "CH-"
belongs_to :order
belongs_to :seller, class_name: "User"
belongs_to :merchant_account, optional: true
belongs_to... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/sendgrid_event_info.rb | app/models/sendgrid_event_info.rb | # frozen_string_literal: true
class SendgridEventInfo < EmailEventInfo
attr_reader \
:charge_id, :click_url, :email, :event_json, :installment_id, :mailer_args, :mailer_class_and_method,
:mailer_class, :mailer_method, :purchase_id, :type, :created_at
def initialize(event_json)
@event_json = event_json... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/bahrain_bank_account.rb | app/models/bahrain_bank_account.rb | # frozen_string_literal: true
class BahrainBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "BH"
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/sales_related_products_info.rb | app/models/sales_related_products_info.rb | # frozen_string_literal: true
class SalesRelatedProductsInfo < ApplicationRecord
belongs_to :smaller_product, class_name: "Link"
belongs_to :larger_product, class_name: "Link"
validates_numericality_of :smaller_product_id, less_than: :larger_product_id
scope :for_product_id, ->(product_id) { where("smaller_p... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/collaborator.rb | app/models/collaborator.rb | # frozen_string_literal: true
class Collaborator < Affiliate
MIN_PERCENT_COMMISSION = 1
MAX_PERCENT_COMMISSION = 50
belongs_to :seller, class_name: "User"
has_one :collaborator_invitation, dependent: :destroy
validates :seller_id, uniqueness: { scope: [:affiliate_user_id, :deleted_at] }, unless: :deleted?... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/transcoded_video.rb | app/models/transcoded_video.rb | # frozen_string_literal: true
class TranscodedVideo < ApplicationRecord
include FlagShihTzu, Deletable, CdnDeletable
self.ignored_columns += [:product_file_id]
has_paper_trail
belongs_to :link, optional: true
delegated_type :streamable, types: %w[ProductFile], optional: true
validates_presence_of :ori... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/email_event.rb | app/models/email_event.rb | # frozen_string_literal: true
class EmailEvent
include Mongoid::Document
include Mongoid::Timestamps
EMAIL_DIGEST_LENGTH = 12
STALE_RECIPIENT_THRESHOLD_DAYS = 365
STALE_RECIPIENT_UNOPENED_THRESHOLD = 10
private_constant :EMAIL_DIGEST_LENGTH, :STALE_RECIPIENT_THRESHOLD_DAYS, :STALE_RECIPIENT_UNOPENED_THRES... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/purchase_sales_tax_info.rb | app/models/purchase_sales_tax_info.rb | # frozen_string_literal: true
class PurchaseSalesTaxInfo < ApplicationRecord
belongs_to :purchase, optional: true
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/processor_payment_intent.rb | app/models/processor_payment_intent.rb | # frozen_string_literal: true
class ProcessorPaymentIntent < ApplicationRecord
belongs_to :purchase
validates_uniqueness_of :purchase
validates_presence_of :intent_id
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/url_redirect.rb | app/models/url_redirect.rb | # frozen_string_literal: true
class UrlRedirect < ApplicationRecord
include ExternalId
include SignedUrlHelper
include FlagShihTzu
# Note: SendPostBlastEmailsJob bypasses all validations and callbacks when creating records.
before_validation :set_token
validates :token, uniqueness: { case_sensitive: true ... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/cart_product.rb | app/models/cart_product.rb | # frozen_string_literal: true
class CartProduct < ApplicationRecord
include ExternalId
include Deletable
URL_PARAMETERS_JSON_SCHEMA = { type: "object", additionalProperties: { type: "string" } }.freeze
ACCEPTED_OFFER_DETAILS_JSON_SCHEMA = {
type: "object",
properties: {
original_product_id: { ty... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/bundle_product.rb | app/models/bundle_product.rb | # frozen_string_literal: true
class BundleProduct < ApplicationRecord
include Deletable, ExternalId
has_paper_trail
belongs_to :bundle, class_name: "Link"
belongs_to :product, class_name: "Link"
belongs_to :variant, class_name: "BaseVariant", optional: true
validate :product_belongs_to_bundle_seller
v... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/gift.rb | app/models/gift.rb | # frozen_string_literal: true
class Gift < ApplicationRecord
include FlagShihTzu
stripped_fields :gifter_email, :giftee_email
belongs_to :gifter_purchase, class_name: "Purchase", optional: true
belongs_to :giftee_purchase, class_name: "Purchase", optional: true
belongs_to :link, optional: true
validates... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/installment_rule.rb | app/models/installment_rule.rb | # frozen_string_literal: true
class InstallmentRule < ApplicationRecord
has_paper_trail version: :paper_trail_version
include Deletable
belongs_to :installment, optional: true
# To show the proper time period to a user, we need to store this.
# To a user, they should see "1 week" instead of "7 days."
HO... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/tanzania_bank_account.rb | app/models/tanzania_bank_account.rb | # frozen_string_literal: true
class TanzaniaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "TZ"
BANK_CODE_FORMAT_REGEX = /^[a-zA-Z0-9]{8,11}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^[a-zA-Z0-9]{10,14}$/
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/philippines_bank_account.rb | app/models/philippines_bank_account.rb | # frozen_string_literal: true
class PhilippinesBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "PH"
BANK_CODE_FORMAT_REGEX = /\A[A-Za-z0-9]{8,11}\z/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[0-9]{1,17}\z/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/european_bank_account.rb | app/models/european_bank_account.rb | # frozen_string_literal: true
class EuropeanBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "EU"
# On sandbox, the test IBAN numbers are of same length for all countries
# (ref: https://stripe.com/docs/connect/testing#account-numbers),
# so validating this only for production.
validate :validate_account_numbe... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/product_review.rb | app/models/product_review.rb | # frozen_string_literal: true
class ProductReview < ApplicationRecord
include ExternalId, Deletable
PRODUCT_RATING_RANGE = (1..5)
REVIEW_REMINDER_DELAY = 5.days
REVIEW_REMINDER_PHYSICAL_DELAY = 90.days
RestrictedOperationError = Class.new(StandardError)
belongs_to :link, optional: true
belongs_to :purc... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/stripe_apple_pay_domain.rb | app/models/stripe_apple_pay_domain.rb | # frozen_string_literal: true
class StripeApplePayDomain < ApplicationRecord
belongs_to :user, optional: true
validates_presence_of :user, :domain, :stripe_id
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/subscription_plan_change.rb | app/models/subscription_plan_change.rb | # frozen_string_literal: true
# Represents a user-initiated plan change to a subscription, for example to
# upgrade or downgrade their tier or recurrence. Used by `RecurringChargeWorker`
# worker to check if a user has a plan change that must be made at the end of
# the current billing period, before initiating the ne... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/nigeria_bank_account.rb | app/models/nigeria_bank_account.rb | # frozen_string_literal: true
class NigeriaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "NG"
BANK_CODE_FORMAT_REGEX = /^([0-9a-zA-Z]){8,11}$/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /^\d{10}$/
private_constant :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/romania_bank_account.rb | app/models/romania_bank_account.rb | # frozen_string_literal: true
class RomaniaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "RO"
validate :validate_account_number, if: -> { Rails.env.production? }
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance::Countries::ROU.alpha2
end
def currency
Currency::RON
end
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/device.rb | app/models/device.rb | # frozen_string_literal: true
class Device < ApplicationRecord
DEVICE_TYPES = {
ios: "ios",
android: "android"
}
APP_TYPES = {
consumer: "consumer",
creator: "creator"
}
NOTIFICATION_SOUNDS = {
sale: "chaching.wav"
}
belongs_to :user
validates_presence_of :token
validates :devi... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/purchase_refund_policy.rb | app/models/purchase_refund_policy.rb | # frozen_string_literal: true
class PurchaseRefundPolicy < ApplicationRecord
belongs_to :purchase
has_one :link, through: :purchase
has_one :product_refund_policy, through: :link
stripped_fields :title, :fine_print
validates :purchase, uniqueness: true
validates :title, presence: true
# This is the da... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/guatemala_bank_account.rb | app/models/guatemala_bank_account.rb | # frozen_string_literal: true
class GuatemalaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "GT"
BANK_CODE_FORMAT_REGEX = /^[A-Za-z0-9]{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/global_affiliate.rb | app/models/global_affiliate.rb | # frozen_string_literal: true
class GlobalAffiliate < Affiliate
AFFILIATE_COOKIE_LIFETIME_DAYS = 7
AFFILIATE_BASIS_POINTS = 1000
validates :affiliate_user_id, uniqueness: true
validates :affiliate_basis_points, presence: true
before_validation :set_affiliate_basis_points, unless: :persisted?
def self.co... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/custom_field.rb | app/models/custom_field.rb | # frozen_string_literal: true
class CustomField < ApplicationRecord
include ExternalId, FlagShihTzu
has_flags 1 => :is_post_purchase,
2 => :collect_per_product,
column: "flags",
flag_query_mode: :bit_operator,
check_for_column: false
belongs_to :seller, class_nam... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/norway_bank_account.rb | app/models/norway_bank_account.rb | # frozen_string_literal: true
class NorwayBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "NO"
validate :validate_account_number, if: -> { Rails.env.production? }
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance::Countries::NOR.alpha2
end
def currency
Currency::NOK
end
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/utm_link_visit.rb | app/models/utm_link_visit.rb | # frozen_string_literal: true
class UtmLinkVisit < ApplicationRecord
has_paper_trail
belongs_to :utm_link
belongs_to :user, optional: true
has_many :utm_link_driven_sales, dependent: :destroy
has_many :purchases, through: :utm_link_driven_sales
validates :ip_address, presence: true
validates :browser_g... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/community.rb | app/models/community.rb | # frozen_string_literal: true
class Community < ApplicationRecord
include Deletable
include ExternalId
belongs_to :seller, class_name: "User"
belongs_to :resource, polymorphic: true
has_many :community_chat_messages, dependent: :destroy
has_many :last_read_community_chat_messages, dependent: :destroy
h... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/custom_domain.rb | app/models/custom_domain.rb | # frozen_string_literal: true
require "ipaddr"
class CustomDomain < ApplicationRecord
WWW_PREFIX = "www"
MAX_FAILED_VERIFICATION_ATTEMPTS_COUNT = 3
include Deletable
stripped_fields :domain, transform: -> { _1.downcase }
belongs_to :user, optional: true
belongs_to :product, class_name: "Link", optional... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/sweden_bank_account.rb | app/models/sweden_bank_account.rb | # frozen_string_literal: true
class SwedenBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "SE"
validate :validate_account_number, if: -> { Rails.env.production? }
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance::Countries::SWE.alpha2
end
def currency
Currency::SEK
end
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/resend_event_info.rb | app/models/resend_event_info.rb | # frozen_string_literal: true
class ResendEventInfo < EmailEventInfo
attr_reader \
:charge_id, :click_url, :email, :event_json, :installment_id,
:mailer_class, :mailer_method, :mailer_args, :purchase_id, :workflow_ids, :type, :created_at
# Sample payload
# event_json = HashWithIndifferentAccess.new({
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/dominican_republic_bank_account.rb | app/models/dominican_republic_bank_account.rb | # frozen_string_literal: true
class DominicanRepublicBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "DO"
BANK_CODE_FORMAT_REGEX = /^\d{1,3}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^\d{1,28}$/
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/sent_post_email.rb | app/models/sent_post_email.rb | # frozen_string_literal: true
class SentPostEmail < ApplicationRecord
belongs_to :post, class_name: "Installment", optional: true
before_validation :downcase_email
validates_presence_of :email
def downcase_email
return if email.blank?
self.email = email.downcase
end
def self.missing_emails(post:,... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/peru_bank_account.rb | app/models/peru_bank_account.rb | # frozen_string_literal: true
class PeruBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "PE"
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[0-9]{20}\z/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
validate :validate_account_number
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance::Countrie... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/trinidad_and_tobago_bank_account.rb | app/models/trinidad_and_tobago_bank_account.rb | # frozen_string_literal: true
class TrinidadAndTobagoBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "TT"
BANK_CODE_FORMAT_REGEX = /\A[0-9]{3}\z/
private_constant :BANK_CODE_FORMAT_REGEX
BRANCH_CODE_FORMAT_REGEX = /\A[0-9]{5}\z/
private_constant :BRANCH_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/base_variants_purchase.rb | app/models/base_variants_purchase.rb | # frozen_string_literal: true
# This table is used as a HABTM join table between BaseVariant and Purchase.
# This model exists to allow us to query for variant ids directly from purchase ids.
# It must not be used directly for creating/deleting records.
class BaseVariantsPurchase < ApplicationRecord
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/seller_refund_policy.rb | app/models/seller_refund_policy.rb | # frozen_string_literal: true
class SellerRefundPolicy < RefundPolicy
validates :seller, presence: true, uniqueness: { conditions: -> { where(product_id: nil) } }
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/kazakhstan_bank_account.rb | app/models/kazakhstan_bank_account.rb | # frozen_string_literal: true
class KazakhstanBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "KZ"
BANK_CODE_FORMAT_REGEX = /^[a-zA-Z0-9]{8,11}\z/
private_constant :BANK_CODE_FORMAT_REGEX
alias_attribute :bank_code, :bank_number
validate :validate_bank_code
validate :validate_account_number
def routing... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/refund_policy.rb | app/models/refund_policy.rb | # frozen_string_literal: true
class RefundPolicy < ApplicationRecord
include ExternalId
has_paper_trail
ALLOWED_REFUND_PERIODS_IN_DAYS = {
0 => "No refunds allowed",
7 => "7-day money back guarantee",
14 => "14-day money back guarantee",
30 => "30-day money back guarantee",
183 => "6-month ... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/niger_bank_account.rb | app/models/niger_bank_account.rb | # frozen_string_literal: true
class NigerBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "NE"
validate :validate_account_number, if: -> { Rails.env.production? }
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance::Countries::NER.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/product_integration.rb | app/models/product_integration.rb | # frozen_string_literal: true
class ProductIntegration < ApplicationRecord
include Deletable
belongs_to :product, class_name: "Link", optional: true
belongs_to :integration, optional: true
validates_presence_of :product_id, :integration_id
validates_uniqueness_of :integration_id, scope: %i[product_id delet... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/affiliate_request.rb | app/models/affiliate_request.rb | # frozen_string_literal: true
class AffiliateRequest < ApplicationRecord
include ExternalId
ACTION_APPROVE = "approve"
ACTION_IGNORE = "ignore"
belongs_to :seller, class_name: "User", optional: true
validates :seller, :name, :email, :promotion_text, presence: true
validates :name, length: { maximum: Use... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/kuwait_bank_account.rb | app/models/kuwait_bank_account.rb | # frozen_string_literal: true
class KuwaitBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "KW"
BANK_CODE_FORMAT_REGEX = /^[a-zA-Z0-9]{8,11}$/
private_constant :BANK_CODE_FORMAT_REGEX
alias_attribute :bank_code, :bank_number
validate :validate_bank_code
validate :validate_account_number
def routing_numb... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/card_bank_account.rb | app/models/card_bank_account.rb | # frozen_string_literal: true
class CardBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "CARD"
belongs_to :credit_card, optional: true
validates :credit_card, presence: true
validate :validate_credit_card_is_funded_by_debit
validate :validate_credit_card_is_issued_by_a_united_states_issuer
# Only on creat... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/installment_event.rb | app/models/installment_event.rb | # frozen_string_literal: true
class InstallmentEvent < ApplicationRecord
belongs_to :event, optional: true
belongs_to :installment, optional: true
after_commit :update_installment_events_cache_count, on: [:create, :destroy]
private
def update_installment_events_cache_count
UpdateInstallmentEventsCo... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/jordan_bank_account.rb | app/models/jordan_bank_account.rb | # frozen_string_literal: true
class JordanBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "JO"
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.e... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/call.rb | app/models/call.rb | # frozen_string_literal: true
class Call < ApplicationRecord
include ExternalId
belongs_to :purchase
delegate :link, to: :purchase
attr_readonly :start_time, :end_time
normalizes :start_time, :end_time, with: -> { _1.change(sec: 0) }
validates_presence_of :start_time, :end_time
validate :start_time_... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/backtax_agreement.rb | app/models/backtax_agreement.rb | # frozen_string_literal: true
class BacktaxAgreement < ApplicationRecord
include FlagShihTzu
belongs_to :user
has_one :credit
has_many :backtax_collections
has_flags 1 => :collected,
:column => "flags",
:flag_query_mode => :bit_operator,
check_for_column: false
module... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/morocco_bank_account.rb | app/models/morocco_bank_account.rb | # frozen_string_literal: true
class MoroccoBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "MA"
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 = /^MA([0-9]){20,26}$/
private_constant :ACCOUNT_NUMBER... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/affiliate_credit.rb | app/models/affiliate_credit.rb | # frozen_string_literal: true
class AffiliateCredit < ApplicationRecord
include Purchase::Searchable::AffiliateCreditCallbacks
belongs_to :affiliate_user, class_name: "User"
belongs_to :seller, class_name: "User"
belongs_to :purchase
belongs_to :link, optional: true
belongs_to :affiliate, optional: true
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/product_file.rb | app/models/product_file.rb | # frozen_string_literal: true
class ProductFile < ApplicationRecord
include S3Retrievable, WithFileProperties, ExternalId, SignedUrlHelper, JsonData, SendableToKindle, Deletable,
CdnDeletable, FlagShihTzu, CdnUrlHelper, Streamable
SUPPORTED_THUMBNAIL_IMAGE_CONTENT_TYPES = /jpeg|gif|png|jpg/i
MAXIMUM_T... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/uruguay_bank_account.rb | app/models/uruguay_bank_account.rb | # frozen_string_literal: true
class UruguayBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "UY"
BANK_CODE_FORMAT_REGEX = /^\d{3}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^\d{1,12}$/
private_constant :BANK_CODE_FORMAT_REGEX, :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code, :bank_number
validate :validate_b... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/taxonomy_stat.rb | app/models/taxonomy_stat.rb | # frozen_string_literal: true
class TaxonomyStat < ApplicationRecord
belongs_to :taxonomy
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/product_refund_policy.rb | app/models/product_refund_policy.rb | # frozen_string_literal: true
class ProductRefundPolicy < RefundPolicy
belongs_to :product, class_name: "Link"
validates :product, presence: true, uniqueness: true
validate :product_must_belong_to_seller
scope :for_visible_and_not_archived_products, -> { joins(:product).merge(Link.visible_and_not_archived) }... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/shipment.rb | app/models/shipment.rb | # frozen_string_literal: true
class Shipment < ApplicationRecord
belongs_to :purchase, optional: true
CARRIER_TRACKING_URL_MAPPING = {
"USPS" => "https://tools.usps.com/go/TrackConfirmAction?qtc_tLabels1=",
"UPS" => "http://wwwapps.ups.com/WebTracking/processInputRequest?TypeOfInquiryNumber=T&InquiryNumbe... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/purchase_preview.rb | app/models/purchase_preview.rb | # frozen_string_literal: true
class PurchasePreview
include ActiveModel::Model
attr_accessor :link, :seller, :created_at, :quantity, :custom_fields,
:formatted_total_display_price_per_unit, :shipping_cents,
:displayed_price_currency_type, :url_redirect, :displayed_price_cents,
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/bundle_product_purchase.rb | app/models/bundle_product_purchase.rb | # frozen_string_literal: true
class BundleProductPurchase < ApplicationRecord
belongs_to :bundle_purchase, class_name: "Purchase", foreign_key: :bundle_purchase_id
belongs_to :product_purchase, class_name: "Purchase", foreign_key: :product_purchase_id
validate :purchases_must_have_same_seller
validate :produc... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/denmark_bank_account.rb | app/models/denmark_bank_account.rb | # frozen_string_literal: true
class DenmarkBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "DK"
validate :validate_account_number, if: -> { Rails.env.production? }
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance::Countries::DNK.alpha2
end
def currency
Currency::DKK
end
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/collaborator_invitation.rb | app/models/collaborator_invitation.rb | # frozen_string_literal: true
class CollaboratorInvitation < ApplicationRecord
include ExternalId
belongs_to :collaborator
def accept!
destroy!
AffiliateMailer.collaborator_invitation_accepted(collaborator_id).deliver_later
end
def decline!
collaborator.mark_deleted!
AffiliateMailer.collab... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/community_notification_setting.rb | app/models/community_notification_setting.rb | # frozen_string_literal: true
class CommunityNotificationSetting < ApplicationRecord
belongs_to :user
belongs_to :seller, class_name: "User"
validates :user_id, uniqueness: { scope: :seller_id }
enum :recap_frequency, { daily: "daily", weekly: "weekly" }, prefix: true, validate: { allow_nil: true }
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/costa_rica_bank_account.rb | app/models/costa_rica_bank_account.rb | # frozen_string_literal: true
class CostaRicaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "CR"
validate :validate_account_number, if: -> { Rails.env.production? }
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance::Countries::CRI.alpha2
end
def currency
Currency::CRC
en... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/user.rb | app/models/user.rb | # frozen_string_literal: true
class User < ApplicationRecord
devise :database_authenticatable, :registerable, :confirmable, :omniauthable,
:recoverable, :rememberable, :trackable, :pwned_password
has_paper_trail
has_one_time_password
include Flipper::Identifier, FlagShihTzu, CurrencyHelper, Mongoable... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | true |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/saudi_arabia_bank_account.rb | app/models/saudi_arabia_bank_account.rb | # frozen_string_literal: true
class SaudiArabiaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "SA"
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
valida... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/concerns/stripped_fields.rb | app/models/concerns/stripped_fields.rb | # frozen_string_literal: true
# Strips whitespace from start and end, and optionally:
# * converts blanks to nil
# * removes duplicate spaces
# * makes changes to the value
#
# Example:
#
# include StrippedFields
# stripped_fields :code, nilify_blanks: false
# stripped_fields :email, transform: -> { _1.dow... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/concerns/two_factor_authentication.rb | app/models/concerns/two_factor_authentication.rb | # frozen_string_literal: true
module TwoFactorAuthentication
extend ActiveSupport::Concern
DEFAULT_AUTH_TOKEN = "000000"
TOKEN_VALIDITY = 10.minutes
TWO_FACTOR_AUTH_EXPIRY = 2.months
TWO_FACTOR_COOKIE_NAME_PREFIX = "_gumroad_two_factor_"
class_methods do
def find_by_encrypted_external_id(external_... | 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.