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/gabon_bank_account.rb | app/models/gabon_bank_account.rb | # frozen_string_literal: true
class GabonBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "GA"
BANK_CODE_FORMAT_REGEX = /^[0-9A-Za-z]{8,11}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^[0-9]{23}$/
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/uae_bank_account.rb | app/models/uae_bank_account.rb | # frozen_string_literal: true
class UaeBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "AE"
validate :validate_account_number, if: -> { Rails.env.production? }
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance::Countries::ARE.alpha2
end
def currency
Currency::AED
end
d... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/customer_email_info.rb | app/models/customer_email_info.rb | # frozen_string_literal: true
class CustomerEmailInfo < EmailInfo
EMAIL_INFO_TYPE = "customer"
def self.find_or_initialize_for_charge(charge_id:, email_name:)
# Queries `email_info_charges` first to leverage the index since there is no `purchase_id` on the associated
# `email_infos` record (`email_infos` ... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/preorder_link.rb | app/models/preorder_link.rb | # frozen_string_literal: true
class PreorderLink < ApplicationRecord
REMINDER_EMAIL_TO_RELEASE_TIME = 1.day # Send the seller reminder email 1 day before the release time.
belongs_to :link, optional: true
has_many :preorders
validates :link, presence: true
validates :release_at, presence: true
validate :... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/product_installment_plan.rb | app/models/product_installment_plan.rb | # frozen_string_literal: true
class ProductInstallmentPlan < ApplicationRecord
include CurrencyHelper
include Deletable
belongs_to :link, inverse_of: :installment_plan
has_many :payment_options, dependent: :restrict_with_exception
enum :recurrence,
BasePrice::Recurrence::ALLOWED_INSTALLMENT_PLAN_REC... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/egypt_bank_account.rb | app/models/egypt_bank_account.rb | # frozen_string_literal: true
class EgyptBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "EG"
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 :va... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/swiss_bank_account.rb | app/models/swiss_bank_account.rb | # frozen_string_literal: true
class SwissBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "CH"
ACCOUNT_NUMBER_FORMAT_REGEX = /\ACH[0-9]{7}[A-Za-z0-9]{12}\z/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
validate :validate_account_number, if: -> { Rails.env.production? }
def bank_account_type
BANK_ACCOUNT... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/armenia_bank_account.rb | app/models/armenia_bank_account.rb | # frozen_string_literal: true
class ArmeniaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "AM"
BANK_CODE_FORMAT_REGEX = /^[0-9A-Za-z]{8,11}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^\d{11,16}$/
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/imported_customer.rb | app/models/imported_customer.rb | # frozen_string_literal: true
class ImportedCustomer < ApplicationRecord
include ExternalId
include ActionView::Helpers::DateHelper
include Deletable
belongs_to :link, optional: true
belongs_to :importing_user, class_name: "User", optional: true
has_one :url_redirect
has_one :license
after_create :cr... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/creator_email_click_summary.rb | app/models/creator_email_click_summary.rb | # frozen_string_literal: true
class CreatorEmailClickSummary
include Mongoid::Document
index({ installment_id: 1 }, { unique: true, name: "installment_index" })
field :installment_id, type: Integer
field :total_unique_clicks, type: Integer
field :urls, type: Hash
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/discover_search_suggestion.rb | app/models/discover_search_suggestion.rb | # frozen_string_literal: true
class DiscoverSearchSuggestion < ApplicationRecord
include Deletable
belongs_to :discover_search
scope :by_user_or_browser, ->(user:, browser_guid:) {
alive
.joins(:discover_search)
.where(discover_searches: user.present? ? { user: } : { browser_guid:, user: nil })... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/angola_bank_account.rb | app/models/angola_bank_account.rb | # frozen_string_literal: true
class AngolaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "AO"
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/mauritius_bank_account.rb | app/models/mauritius_bank_account.rb | # frozen_string_literal: true
class MauritiusBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "MU"
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_... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/backtax_collection.rb | app/models/backtax_collection.rb | # frozen_string_literal: true
class BacktaxCollection < ApplicationRecord
belongs_to :user
belongs_to :backtax_agreement
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/legacy_permalink.rb | app/models/legacy_permalink.rb | # frozen_string_literal: true
class LegacyPermalink < ApplicationRecord
belongs_to :product, class_name: "Link", optional: true
validates :permalink, presence: true, format: { with: /\A[a-zA-Z0-9_-]+\z/ }, uniqueness: { case_sensitive: false }
validates_presence_of :product
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/bank_account.rb | app/models/bank_account.rb | # frozen_string_literal: true
class BankAccount < ApplicationRecord
include ExternalId
include Deletable
belongs_to :user, optional: true
has_many :payments
belongs_to :credit_card, optional: true
encrypt_with_public_key :account_number,
symmetric: :never,
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/country.rb | app/models/country.rb | # frozen_string_literal: true
class Country
include CurrencyHelper
CROSS_BORDER_PAYOUTS_COUNTRIES = [
Compliance::Countries::THA,
Compliance::Countries::KOR,
Compliance::Countries::ISR,
Compliance::Countries::TTO,
Compliance::Countries::PHL,
Compliance::Countries::MEX,
Compliance::Coun... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/black_recurring_service.rb | app/models/black_recurring_service.rb | # frozen_string_literal: true
class BlackRecurringService < RecurringService
SERVICE_DESCRIPTION = "Gumroad Premium"
attr_json_data_accessor :change_recurrence_to
attr_json_data_accessor :invite_credit
# black recurring service state transitions:
#
# → pending_cancellation → cancelle... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/cart.rb | app/models/cart.rb | # frozen_string_literal: true
class Cart < ApplicationRecord
include ExternalId
include Deletable
DISCOUNT_CODES_SCHEMA = {
"$schema": "http://json-schema.org/draft-06/schema#",
type: "array",
items: { "$ref": "#/$defs/discount_code" },
"$defs": {
discount_code: {
type: "object",
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/gibraltar_bank_account.rb | app/models/gibraltar_bank_account.rb | # frozen_string_literal: true
class GibraltarBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "GI"
validate :validate_account_number, if: -> { Rails.env.production? }
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance::Countries::GIB.alpha2
end
def currency
Currency::GBP
en... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/kenya_bank_account.rb | app/models/kenya_bank_account.rb | # frozen_string_literal: true
class KenyaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "KE"
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,32}\z/
private_constant :ACCOUNT_NUMBE... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/large_seller.rb | app/models/large_seller.rb | # frozen_string_literal: true
# This table contains a list of users that have a large number sales.
# It's needed for the performance of the web analytics.
# Note that:
# - This has nothing to do with VIPs / sellers that have a large revenue.
# This is strictly about the number of `purchases` rows associated with a ... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/thailand_bank_account.rb | app/models/thailand_bank_account.rb | # frozen_string_literal: true
class ThailandBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "TH"
BANK_CODE_FORMAT_REGEX = /\A[0-9]{3}\z/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[0-9]{6,15}\z/
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/taiwan_bank_account.rb | app/models/taiwan_bank_account.rb | # frozen_string_literal: true
class TaiwanBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "TW"
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-9]{10,14}\z/
private_constant :ACCOUNT_NUMBER_FO... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/botswana_bank_account.rb | app/models/botswana_bank_account.rb | # frozen_string_literal: true
class BotswanaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "BW"
BANK_CODE_FORMAT_REGEX = /^[a-zA-Z0-9]{8,11}\z/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /^[a-zA-Z0-9]{1,16}$/
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/email_info.rb | app/models/email_info.rb | # frozen_string_literal: true
class EmailInfo < ApplicationRecord
include ExternalId
# Note: For performance, the state transitions (and validations) are ignored when sending
# an email in PostSendgridApi.
belongs_to :purchase, optional: true
belongs_to :installment, optional: true
has_one :email_info_ch... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/oauth_application.rb | app/models/oauth_application.rb | # frozen_string_literal: true
class OauthApplication < Doorkeeper::Application
include ExternalId
include Deletable
include CdnUrlHelper
has_many :resource_subscriptions, dependent: :destroy
has_many :affiliate_credits
has_many :links, foreign_key: :affiliate_application_id
belongs_to :owner, class_nam... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/sku.rb | app/models/sku.rb | # frozen_string_literal: true
class Sku < BaseVariant
belongs_to :link, optional: true
has_and_belongs_to_many :variants, join_table: :skus_variants
delegate :user, to: :link
validates_presence_of :link
def as_json(options = {})
json = super(options)
json["custom_sku"] = custom_sku if custom_sku
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/purchase_taxjar_info.rb | app/models/purchase_taxjar_info.rb | # frozen_string_literal: true
class PurchaseTaxjarInfo < ApplicationRecord
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/product_cached_value.rb | app/models/product_cached_value.rb | # frozen_string_literal: true
class ProductCachedValue < ApplicationRecord
belongs_to :product, class_name: "Link", optional: true
before_create :assign_cached_values
validates_presence_of :product
scope :fresh, -> { where(expired: false) }
scope :expired, -> { where(expired: true) }
def expire!
up... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/brunei_bank_account.rb | app/models/brunei_bank_account.rb | # frozen_string_literal: true
class BruneiBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "BN"
BANK_CODE_FORMAT_REGEX = /^[0-9a-zA-Z]{8,11}$/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /^[0-9]{1,13}$/
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/monaco_bank_account.rb | app/models/monaco_bank_account.rb | # frozen_string_literal: true
class MonacoBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "MC"
validate :validate_account_number, if: -> { Rails.env.production? }
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance::Countries::MCO.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/sent_abandoned_cart_email.rb | app/models/sent_abandoned_cart_email.rb | # frozen_string_literal: true
class SentAbandonedCartEmail < ApplicationRecord
belongs_to :cart
belongs_to :installment
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/media_location.rb | app/models/media_location.rb | # frozen_string_literal: true
class MediaLocation < ApplicationRecord
include MediaLocation::Unit
include Platform
include TimestampScopes
belongs_to :product_file, optional: true
belongs_to :purchase, optional: true
scope :max_consumed_at_by_file, lambda { |purchase_id:|
subquery = MediaLocation.sel... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/israel_bank_account.rb | app/models/israel_bank_account.rb | # frozen_string_literal: true
class IsraelBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "IL"
validate :validate_account_number, if: -> { Rails.env.production? }
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance::Countries::ISR.alpha2
end
def currency
Currency::ILS
end
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/creator_email_open_event.rb | app/models/creator_email_open_event.rb | # frozen_string_literal: true
class CreatorEmailOpenEvent
include Mongoid::Document
include Mongoid::Timestamps
index({ mailer_method: 1, mailer_args: 1 }, { unique: true, name: "recipient_index" })
index({ installment_id: 1 }, { name: "installment_index" })
field :mailer_method, type: String
field :mail... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/azerbaijan_bank_account.rb | app/models/azerbaijan_bank_account.rb | # frozen_string_literal: true
class AzerbaijanBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "AZ"
BANK_CODE_FORMAT_REGEX = /^\d{6}$/
private_constant :BANK_CODE_FORMAT_REGEX
BRANCH_CODE_FORMAT_REGEX = /^\d{6}$/
private_constant :BRANCH_CODE_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/zip_tax_rate.rb | app/models/zip_tax_rate.rb | # frozen_string_literal: true
class ZipTaxRate < ApplicationRecord
include FlagShihTzu
include Deletable
include JsonData
has_flags 1 => :is_seller_responsible,
2 => :is_epublication_rate,
:column => "flags",
:flag_query_mode => :bit_operator,
check_for_column: ... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/credit.rb | app/models/credit.rb | # frozen_string_literal: true
class Credit < ApplicationRecord
include CurrencyHelper, JsonData
belongs_to :user, optional: true
belongs_to :merchant_account, optional: true
belongs_to :crediting_user, class_name: "User", optional: true
belongs_to :balance, optional: true
belongs_to :chargebacked_purchase... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/san_marino_bank_account.rb | app/models/san_marino_bank_account.rb | # frozen_string_literal: true
class SanMarinoBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "SM"
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
def routing_n... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/hong_kong_bank_account.rb | app/models/hong_kong_bank_account.rb | # frozen_string_literal: true
class HongKongBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "HK"
CLEARING_CODE_FORMAT_REGEX = /\A[0-9]{3}\z/
private_constant :CLEARING_CODE_FORMAT_REGEX
BRANCH_CODE_FORMAT_REGEX = /\A[0-9]{3}\z/
private_constant :BRANCH_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[0... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/base_variant.rb | app/models/base_variant.rb | # frozen_string_literal: true
class BaseVariant < ApplicationRecord
include ActionView::Helpers::SanitizeHelper
include CurrencyHelper
include ExternalId
include Deletable
include WithProductFilesManyToMany
include FlagShihTzu
include MaxPurchaseCount
include Integrations
include RichContents
MINI... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/sent_email_info.rb | app/models/sent_email_info.rb | # frozen_string_literal: true
class SentEmailInfo < ApplicationRecord
validates_presence_of :key
def self.key_exists?(key)
where(key:).exists?
end
def self.set_key!(key)
record = new
record.key = key
begin
record.save!
rescue ActiveRecord::RecordNotUnique
nil
end
end
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/installment.rb | app/models/installment.rb | # frozen_string_literal: true
require "custom_rouge_theme"
class Installment < ApplicationRecord
has_paper_trail
include Rails.application.routes.url_helpers
include ExternalId, ActionView::Helpers::SanitizeHelper, ActionView::Helpers::TextHelper, CurrencyHelper, S3Retrievable, WithProductFiles, Deletable, Jso... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | true |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/early_fraud_warning.rb | app/models/early_fraud_warning.rb | # frozen_string_literal: true
class EarlyFraudWarning < ApplicationRecord
self.table_name = "purchase_early_fraud_warnings"
has_paper_trail
include TimestampStateFields
belongs_to :purchase, optional: true
belongs_to :charge, optional: true
belongs_to :dispute, optional: true
belongs_to :refund, optio... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/utm_link_driven_sale.rb | app/models/utm_link_driven_sale.rb | # frozen_string_literal: true
class UtmLinkDrivenSale < ApplicationRecord
belongs_to :utm_link
belongs_to :utm_link_visit
belongs_to :purchase
validates :purchase_id, uniqueness: { scope: :utm_link_visit_id }
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/purchase_wallet_type.rb | app/models/purchase_wallet_type.rb | # frozen_string_literal: true
class PurchaseWalletType < 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/bank.rb | app/models/bank.rb | # frozen_string_literal: true
class Bank < ApplicationRecord
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/hungary_bank_account.rb | app/models/hungary_bank_account.rb | # frozen_string_literal: true
class HungaryBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "HU"
validate :validate_account_number, if: -> { Rails.env.production? }
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance::Countries::HUN.alpha2
end
def currency
Currency::HUF
end
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/seller_profile.rb | app/models/seller_profile.rb | # frozen_string_literal: true
class SellerProfile < ApplicationRecord
FONT_CHOICES = ["ABC Favorit", "Inter", "Domine", "Merriweather", "Roboto Slab", "Roboto Mono"]
belongs_to :seller, class_name: "User"
validates :font, inclusion: { in: FONT_CHOICES }
validates :background_color, hex_color: true
validate... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/balance_transaction.rb | app/models/balance_transaction.rb | # frozen_string_literal: true
# A record that records each change to a Balance record.
# Positive amount_cents represent deposited into the Balance.
# Negative amount_cents represent money withdrawn from the Balance.
class BalanceTransaction < ApplicationRecord
include Immutable
include ExternalId
class Amount
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/madagascar_bank_account.rb | app/models/madagascar_bank_account.rb | # frozen_string_literal: true
class MadagascarBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "MG"
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 = /^MG([0-9]){25}$/
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/link.rb | app/models/link.rb | # frozen_string_literal: true
require "zip/zipfilesystem"
class Link < ApplicationRecord
has_paper_trail
# Moving the definition of these flags will cause an error.
include FlagShihTzu
include ActionView::Helpers::SanitizeHelper
has_flags 1 => :product_refund_policy_enabled,
2 => :is_recurring_b... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | true |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/bolivia_bank_account.rb | app/models/bolivia_bank_account.rb | # frozen_string_literal: true
class BoliviaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "BO"
BANK_CODE_FORMAT_REGEX = /^\d{1,3}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^\d{10,15}$/
private_constant :BANK_CODE_FORMAT_REGEX, :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code, :bank_number
validate :validat... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/purchase_integration.rb | app/models/purchase_integration.rb | # frozen_string_literal: true
class PurchaseIntegration < ApplicationRecord
include Deletable
belongs_to :purchase, optional: true
belongs_to :integration, optional: true
validates :purchase_id, presence: true
validates :integration_id, presence: true
validates :integration_id, uniqueness: { scope: %i[pu... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/invite.rb | app/models/invite.rb | # frozen_string_literal: true
class Invite < ApplicationRecord
belongs_to :user, foreign_key: "sender_id", optional: true
# invite state machine
#
# invitation_sent → → → → signed_up
#
state_machine :invite_state, initial: :invitation_sent do
after_transition invitation_sent: :signed_up, do: :notify_s... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/circle_integration.rb | app/models/circle_integration.rb | # frozen_string_literal: true
class CircleIntegration < Integration
INTEGRATION_DETAILS = %w[community_id space_group_id]
INTEGRATION_DETAILS.each { |detail| attr_json_data_accessor detail }
validates_presence_of :api_key
def as_json(*)
super.merge(api_key:)
end
def self.is_enabled_for(purchase)
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/asset_preview.rb | app/models/asset_preview.rb | # frozen_string_literal: true
class AssetPreview < ApplicationRecord
include Deletable
include CdnUrlHelper
SUPPORTED_IMAGE_CONTENT_TYPES = /jpeg|gif|png|jpg/i
DEFAULT_DISPLAY_WIDTH = 670
RETINA_DISPLAY_WIDTH = (DEFAULT_DISPLAY_WIDTH * 1.5).to_i
after_commit :invalidate_product_cache
after_create :rese... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/seller_profile_section.rb | app/models/seller_profile_section.rb | # frozen_string_literal: true
class SellerProfileSection < ApplicationRecord
include ExternalId, FlagShihTzu
belongs_to :seller, class_name: "User"
belongs_to :product, class_name: "Link", optional: true
validate :validate_json_data
attribute :json_data, default: {}
scope :on_profile, -> { where(product_i... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/guyana_bank_account.rb | app/models/guyana_bank_account.rb | # frozen_string_literal: true
class GuyanaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "GY"
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,32}$/
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/preorder.rb | app/models/preorder.rb | # frozen_string_literal: true
class Preorder < ApplicationRecord
include ExternalId
include AfterCommitEverywhere
belongs_to :preorder_link, optional: true
belongs_to :seller, class_name: "User", optional: true
belongs_to :purchaser, class_name: "User", optional: true
has_many :purchases
has_one :url_re... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/discord_integration.rb | app/models/discord_integration.rb | # frozen_string_literal: true
class DiscordIntegration < Integration
INTEGRATION_DETAILS = %w[username server_id server_name]
INTEGRATION_DETAILS.each { |detail| attr_json_data_accessor detail }
def self.discord_user_id_for(purchase)
integration = purchase.find_enabled_integration(Integration::DISCORD)
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/comment.rb | app/models/comment.rb | # frozen_string_literal: true
class Comment < ApplicationRecord
include ExternalId
include Deletable
include JsonData
COMMENT_TYPE_NOTE = "note"
COMMENT_TYPE_USER_SUBMITTED = "user_submitted"
COMMENT_TYPE_PAYOUT_NOTE = "payout_note"
COMMENT_TYPE_COMPLIANT = "compliant"
COMMENT_TYPE_ON_PROBATION = "on"... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/base_variant_integration.rb | app/models/base_variant_integration.rb | # frozen_string_literal: true
class BaseVariantIntegration < ApplicationRecord
include Deletable
belongs_to :base_variant, optional: true
belongs_to :integration, optional: true
validates_presence_of :base_variant_id, :integration_id
validates_uniqueness_of :integration_id, scope: %i[base_variant_id delete... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/ach_account.rb | app/models/ach_account.rb | # frozen_string_literal: true
class AchAccount < BankAccount
include AchAccount::AccountType
BANK_ACCOUNT_TYPE = "ACH"
before_validation :set_default_account_type, on: :create, if: ->(ach_account) { ach_account.account_type.nil? }
validate :validate_bank_name
validate :validate_routing_number
validate :v... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/new_zealand_bank_account.rb | app/models/new_zealand_bank_account.rb | # frozen_string_literal: true
class NewZealandBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "NZ"
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[0-9]{15,16}\z/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
validate :validate_account_number
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance:... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/dropbox_file.rb | app/models/dropbox_file.rb | # frozen_string_literal: true
class DropboxFile < ApplicationRecord
include ExternalId
# A Dropbox file always belongs to a user. This is done because without it we could not fetch the dropbox files
# for the user when they visit an upload page.
belongs_to :user, optional: true
# A Dropbox file can belong t... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/consumption_event.rb | app/models/consumption_event.rb | # frozen_string_literal: true
class ConsumptionEvent < ApplicationRecord
class << self
def create_event!(**kwargs)
ConsumptionEvent.create!(
event_type: kwargs.fetch(:event_type),
platform: kwargs.fetch(:platform),
url_redirect_id: kwargs.fetch(:url_redirect_id),
product_fil... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/upsell.rb | app/models/upsell.rb | # frozen_string_literal: true
class Upsell < ApplicationRecord
include Deletable, ExternalId, FlagShihTzu, Upsell::Sorting
has_paper_trail
has_flags 1 => :replace_selected_products,
2 => :is_content_upsell,
:column => "flags",
:flag_query_mode => :bit_operator,
c... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/poland_bank_account.rb | app/models/poland_bank_account.rb | # frozen_string_literal: true
class PolandBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "PL"
validate :validate_account_number, if: -> { Rails.env.production? }
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance::Countries::POL.alpha2
end
def currency
Currency::PLN
end
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/user_tax_form.rb | app/models/user_tax_form.rb | # frozen_string_literal: true
class UserTaxForm < ApplicationRecord
include JsonData
TAX_FORM_TYPES = ["us_1099_k", "us_1099_misc"].freeze
MIN_TAX_YEAR = 2020
belongs_to :user
attr_json_data_accessor :stripe_account_id
validates :tax_year, presence: true, numericality: { only_integer: true, greater_tha... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/staff_picked_product.rb | app/models/staff_picked_product.rb | # frozen_string_literal: true
class StaffPickedProduct < ApplicationRecord
include TimestampStateFields
has_paper_trail
belongs_to :product, class_name: "Link"
validates :product, presence: true, uniqueness: true
timestamp_state_fields :deleted
after_commit :update_product_search_index
private
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/senegal_bank_account.rb | app/models/senegal_bank_account.rb | # frozen_string_literal: true
class SenegalBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "SN"
ACCOUNT_NUMBER_FORMAT_REGEX = /^SN([0-9SN]){20,26}$/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
validate :validate_account_number
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/vietnam_bank_account.rb | app/models/vietnam_bank_account.rb | # frozen_string_literal: true
class VietnamBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "VN"
BANK_CODE_FORMAT_REGEX = /\A[0-9]{8}\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_code, :bank_n... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/sales_export_chunk.rb | app/models/sales_export_chunk.rb | # frozen_string_literal: true
class SalesExportChunk < ApplicationRecord
belongs_to :export, class_name: "SalesExport"
serialize :purchase_ids, type: Array, coder: YAML
serialize :custom_fields, type: Array, coder: YAML
serialize :purchases_data, type: Array, coder: YAML
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/resource_subscription.rb | app/models/resource_subscription.rb | # frozen_string_literal: true
class ResourceSubscription < ApplicationRecord
include ExternalId
include Deletable
SALE_RESOURCE_NAME = "sale"
CANCELLED_RESOURCE_NAME = "cancellation"
SUBSCRIPTION_ENDED_RESOURCE_NAME = "subscription_ended"
SUBSCRIPTION_RESTARTED_RESOURCE_NAME = "subscription_restarted"
S... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/seller_profile_subscribe_section.rb | app/models/seller_profile_subscribe_section.rb | # frozen_string_literal: true
class SellerProfileSubscribeSection < SellerProfileSection
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/signup_event.rb | app/models/signup_event.rb | # frozen_string_literal: true
class SignupEvent < Event
belongs_to :user, optional: true
self.table_name = "signup_events"
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/upsell_purchase.rb | app/models/upsell_purchase.rb | # frozen_string_literal: true
class UpsellPurchase < ApplicationRecord
belongs_to :purchase
belongs_to :upsell
belongs_to :selected_product, class_name: "Link", optional: true
belongs_to :upsell_variant, optional: true
validates :purchase, presence: true, uniqueness: true
validates_presence_of :upsell
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/confirmed_follower_event.rb | app/models/confirmed_follower_event.rb | # frozen_string_literal: true
class ConfirmedFollowerEvent
include Elasticsearch::Model
index_name "confirmed_follower_events"
settings(
number_of_shards: 1,
number_of_replicas: 0,
sort: { field: :timestamp, order: :asc }
)
mapping dynamic: :strict do
indexes :name, type: :keyword
index... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/gumroad_daily_analytic.rb | app/models/gumroad_daily_analytic.rb | # frozen_string_literal: true
class GumroadDailyAnalytic < ApplicationRecord
validates :period_ended_at, :gumroad_price_cents, :gumroad_fee_cents, :creators_with_sales, :gumroad_discover_price_cents, presence: true
def self.import(date)
date_range = date.all_day
analytic = GumroadDailyAnalytic.find_or_ini... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/tunisia_bank_account.rb | app/models/tunisia_bank_account.rb | # frozen_string_literal: true
class TunisiaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "TN"
validate :validate_account_number, if: -> { Rails.env.production? }
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance::Countries::TUN.alpha2
end
def currency
Currency::TND
end
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/google_calendar_integration.rb | app/models/google_calendar_integration.rb | # frozen_string_literal: true
class GoogleCalendarIntegration < Integration
INTEGRATION_DETAILS = %w[access_token refresh_token calendar_id calendar_summary email]
INTEGRATION_DETAILS.each { |detail| attr_json_data_accessor detail }
def self.is_enabled_for(purchase)
purchase.find_enabled_integration(Integra... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/affiliate_partial_refund.rb | app/models/affiliate_partial_refund.rb | # frozen_string_literal: true
class AffiliatePartialRefund < ApplicationRecord
include Purchase::Searchable::AffiliatePartialRefundCallbacks
belongs_to :affiliate_user, class_name: "User", optional: true
belongs_to :affiliate_credit, optional: true
belongs_to :seller, class_name: "User", optional: true
belo... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/creator_contacting_customers_email_info.rb | app/models/creator_contacting_customers_email_info.rb | # frozen_string_literal: true
class CreatorContactingCustomersEmailInfo < EmailInfo
EMAIL_INFO_TYPE = "creator_contacting_customers"
validates_presence_of :installment
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/yearly_stat.rb | app/models/yearly_stat.rb | # frozen_string_literal: true
class YearlyStat < ApplicationRecord
belongs_to :user
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/creator_email_click_event.rb | app/models/creator_email_click_event.rb | # frozen_string_literal: true
class CreatorEmailClickEvent
include Mongoid::Document
include Mongoid::Timestamps
# This is a key that represents the link by which to view attached files on an installment
VIEW_ATTACHMENTS_URL = "view_attachments_url"
index({ installment_id: 1, mailer_method: 1, mailer_args:... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/purchase_custom_field.rb | app/models/purchase_custom_field.rb | # frozen_string_literal: true
class PurchaseCustomField < ApplicationRecord
include FlagShihTzu
has_flags 1 => :is_post_purchase,
flag_query_mode: :bit_operator,
check_for_column: false
def self.build_from_custom_field(custom_field:, value:, bundle_product: nil)
build(custom_field:,... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/email_info_charge.rb | app/models/email_info_charge.rb | # frozen_string_literal: true
class EmailInfoCharge < ApplicationRecord
belongs_to :email_info
belongs_to :charge
validates :email_info, presence: true, uniqueness: true
validates :charge, presence: true, uniqueness: true
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/cached_sales_related_products_info.rb | app/models/cached_sales_related_products_info.rb | # frozen_string_literal: true
class CachedSalesRelatedProductsInfo < ApplicationRecord
belongs_to :product, class_name: "Link"
after_initialize :assign_default_counts_value
validate :counts_has_valid_format
def normalized_counts = counts&.transform_keys(&:to_i)
private
def assign_default_counts_value
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/chile_bank_account.rb | app/models/chile_bank_account.rb | # frozen_string_literal: true
class ChileBankAccount < BankAccount
include ChileBankAccount::AccountType
BANK_ACCOUNT_TYPE = "CL"
BANK_CODE_FORMAT_REGEX = /\A[0-9]{3}\z/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[0-9]{5,25}\z/
private_constant :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/application_record.rb | app/models/application_record.rb | # frozen_string_literal: true
class ApplicationRecord < ActiveRecord::Base
include StrippedFields
self.abstract_class = true
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/qatar_bank_account.rb | app/models/qatar_bank_account.rb | # frozen_string_literal: true
class QatarBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "QA"
BANK_CODE_FORMAT_REGEX = /^[a-zA-Z0-9]{11}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^[a-zA-Z0-9]{29}$/
private_constant :BANK_CODE_FORMAT_REGEX, :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code, :bank_number
valid... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/product_files_archive.rb | app/models/product_files_archive.rb | # frozen_string_literal: true
class ProductFilesArchive < ApplicationRecord
include ExternalId, S3Retrievable, SignedUrlHelper, Deletable, CdnDeletable
has_paper_trail
belongs_to :link, optional: true
belongs_to :installment, optional: true
belongs_to :variant, optional: true
has_and_belongs_to_many :pro... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/product_sort_key.rb | app/models/product_sort_key.rb | # frozen_string_literal: true
class ProductSortKey
FEATURED = "featured"
BEST_SELLERS = "best_sellers"
CURATED = "curated"
NEWEST = "newest"
PRICE_ASCENDING = "price_asc"
PRICE_DESCENDING = "price_desc"
AVAILABLE_PRICE_ASCENDING = "available_price_asc"
AVAILABLE_PRICE_DESCENDING = "available_price_desc... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/australia_backtax_email_info.rb | app/models/australia_backtax_email_info.rb | # frozen_string_literal: true
class AustraliaBacktaxEmailInfo < ApplicationRecord
belongs_to :user
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/el_salvador_bank_account.rb | app/models/el_salvador_bank_account.rb | # frozen_string_literal: true
class ElSalvadorBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "SV"
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_... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/dispute_evidence.rb | app/models/dispute_evidence.rb | # frozen_string_literal: true
class DisputeEvidence < ApplicationRecord
def self.create_from_dispute!(dispute)
DisputeEvidence::CreateFromDisputeService.new(dispute).perform!
end
has_paper_trail
include ExternalId, TimestampStateFields
delegate :disputable, to: :dispute
stripped_fields \
:custo... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/video_file.rb | app/models/video_file.rb | # frozen_string_literal: true
class VideoFile < ApplicationRecord
include WithFileProperties
include Deletable
include S3Retrievable
include CdnDeletable, CdnUrlHelper
include SignedUrlHelper
include FlagShihTzu
include VideoFile::HasThumbnail
has_s3_fields :url
belongs_to :record, polymorphic: tr... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/models/ethiopia_bank_account.rb | app/models/ethiopia_bank_account.rb | # frozen_string_literal: true
class EthiopiaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "ET"
BANK_CODE_FORMAT_REGEX = /^[0-9a-zA-Z]{8,11}$/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /^[0-9a-zA-Z]{13,16}$/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_... | 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.