source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/bulgaria_bank_account.rb | Ruby | mit | 8,966 | main | 689 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/liechtenstein_bank_account.rb | Ruby | mit | 8,966 | main | 684 | # frozen_string_literal: true
class LiechtensteinBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "LI"
validate :validate_account_number, if: -> { Rails.env.production? }
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance::Countries::LIE.alpha2
end
def currency
Currency::CHF
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/senegal_bank_account.rb | Ruby | mit | 8,966 | main | 757 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/base_price.rb | Ruby | mit | 8,966 | main | 605 | # frozen_string_literal: true
class BasePrice < ApplicationRecord
has_paper_trail
self.table_name = "prices"
include BasePrice::Recurrence
include ExternalId
include ProductsHelper
include Deletable
include FlagShihTzu
validates :price_cents, :currency, presence: true
has_flags 1 => :is_rental,
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/totp_credential.rb | Ruby | mit | 8,966 | main | 1,252 | # frozen_string_literal: true
require "bcrypt"
class TotpCredential < ApplicationRecord
has_one_time_password column_name: :otp_secret
belongs_to :user
validates :user_id, uniqueness: true
serialize :recovery_codes, coder: JSON
DRIFT = 30
RECOVERY_CODE_COUNT = 10
RECOVERY_CODE_LENGTH = 8
ISSUER_NA... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/mauritius_bank_account.rb | Ruby | mit | 8,966 | main | 1,039 | # 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_... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/black_recurring_service.rb | Ruby | mit | 8,966 | main | 1,970 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/email_info_charge.rb | Ruby | mit | 8,966 | main | 236 | # 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 |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/malaysia_bank_account.rb | Ruby | mit | 8,966 | main | 1,172 | # frozen_string_literal: true
class MalaysiaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "MY"
BANK_CODE_FORMAT_REGEX = /^([0-9a-zA-Z]){8,11}$/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /^([0-9]){5,17}$/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_cod... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/iceland_bank_account.rb | Ruby | mit | 8,966 | main | 654 | # 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
"... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/commission.rb | Ruby | mit | 8,966 | main | 3,387 | # frozen_string_literal: true
class Commission < ApplicationRecord
include ExternalId
COMMISSION_DEPOSIT_PROPORTION = 0.5
STATUSES = ["in_progress", "completed", "cancelled"].freeze
STATUSES.each do |status|
const_set("STATUS_#{status.upcase}", status)
end
STATUSES.each do |status|
define_method... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/base_variant_integration.rb | Ruby | mit | 8,966 | main | 838 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/card_bank_account.rb | Ruby | mit | 8,966 | main | 1,607 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/balance_transaction.rb | Ruby | mit | 8,966 | main | 10,088 | # 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
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/email_info.rb | Ruby | mit | 8,966 | main | 1,838 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/follower.rb | Ruby | mit | 8,966 | main | 3,757 | # frozen_string_literal: true
class Follower < ApplicationRecord
include ExternalId
include TimestampScopes
include Follower::From
include Deletable
include ConfirmedFollowerEvent::FollowerCallbacks
include Follower::AudienceMember
has_paper_trail
belongs_to :user, foreign_key: "followed_id", optiona... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/el_salvador_bank_account.rb | Ruby | mit | 8,966 | main | 1,115 | # frozen_string_literal: true
class ElSalvadorBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "SV"
BANK_CODE_FORMAT_REGEX = /^[a-zA-Z0-9]{8,11}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[0-9]{10,20}\z/
private_constant :BANK_CODE_FORMAT_REGEX, :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code, :bank_number
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/utm_link_driven_sale.rb | Ruby | mit | 8,966 | main | 223 | # 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 |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/seller_profile.rb | Ruby | mit | 8,966 | main | 2,153 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/tunisia_bank_account.rb | Ruby | mit | 8,966 | main | 688 | # 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
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/botswana_bank_account.rb | Ruby | mit | 8,966 | main | 1,175 | # 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_... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/zip_tax_rate.rb | Ruby | mit | 8,966 | main | 578 | # 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: ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/laos_bank_account.rb | Ruby | mit | 8,966 | main | 1,140 | # frozen_string_literal: true
class LaosBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "LA"
BANK_CODE_FORMAT_REGEX = /^([0-9a-zA-Z]){8,11}$/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /^([0-9a-zA-Z]){1,18}$/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_c... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/cached_sales_related_products_info.rb | Ruby | mit | 8,966 | main | 748 | # 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
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/namibia_bank_account.rb | Ruby | mit | 8,966 | main | 1,120 | # frozen_string_literal: true
class NamibiaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "NA"
BANK_CODE_FORMAT_REGEX = /^[a-zA-Z0-9]{8,11}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^[a-zA-Z0-9]{8,13}$/
private_constant :BANK_CODE_FORMAT_REGEX, :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code, :bank_number
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/custom_field.rb | Ruby | mit | 8,966 | main | 1,967 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/variant.rb | Ruby | mit | 8,966 | main | 3,395 | # frozen_string_literal: true
class Variant < BaseVariant
include Variant::Prices
belongs_to :variant_category, optional: true
has_many :prices, class_name: "VariantPrice"
has_many :alive_prices, -> { alive }, class_name: "VariantPrice"
has_and_belongs_to_many :skus, join_table: :skus_variants
has_many :... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/paraguay_bank_account.rb | Ruby | mit | 8,966 | main | 1,131 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/device.rb | Ruby | mit | 8,966 | main | 688 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/comment.rb | Ruby | mit | 8,966 | main | 4,321 | # 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"... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/czech_republic_bank_account.rb | Ruby | mit | 8,966 | main | 694 | # frozen_string_literal: true
class CzechRepublicBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "CZ"
validate :validate_account_number, if: -> { Rails.env.production? }
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance::Countries::CZE.alpha2
end
def currency
Currency::CZK
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/credit_card.rb | Ruby | mit | 8,966 | main | 4,881 | # frozen_string_literal: true
class CreditCard < ApplicationRecord
include PurchaseErrorCode
include ChargeProcessable
has_many :users
has_one :purchase
has_one :subscription
belongs_to :preorder, optional: true
has_one :bank_account
attr_accessor :error_code, :stripe_error_code
validates :stripe... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/gabon_bank_account.rb | Ruby | mit | 8,966 | main | 1,110 | # 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 ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/oman_bank_account.rb | Ruby | mit | 8,966 | main | 1,285 | # frozen_string_literal: true
class OmanBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "OM"
BANK_CODE_FORMAT_REGEX = /^[A-Z]{4}OM[A-Z0-9]{2,5}\z/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /^[0-9]{6,16}$/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/seller_profile_products_section.rb | Ruby | mit | 8,966 | main | 268 | # frozen_string_literal: true
class SellerProfileProductsSection < SellerProfileSection
def product_names
# Prevents a full table scan (see https://github.com/gumroad/web/pull/26855)
Link.where(user_id: seller_id, id: shown_products).pluck(:name)
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/utm_link.rb | Ruby | mit | 8,966 | main | 4,745 | # frozen_string_literal: true
class UtmLink < ApplicationRecord
include Deletable, ExternalId
MAX_UTM_PARAM_LENGTH = 200
has_paper_trail
belongs_to :seller, class_name: "User"
belongs_to :target_resource, polymorphic: true, optional: true
has_many :utm_link_visits, dependent: :destroy
has_many :utm_l... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/affiliate.rb | Ruby | mit | 8,966 | main | 4,567 | # frozen_string_literal: true
class Affiliate < ApplicationRecord
include ExternalId
include Deletable
include CurrencyHelper
include FlagShihTzu
include AudienceMember, Cookies
self.ignored_columns = %w(archived_at)
QUERY_PARAM = "affiliate_id"
SHORT_QUERY_PARAM = "a"
QUERY_PARAMS = [QUERY_PARAM,... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/base_variants_purchase.rb | Ruby | mit | 8,966 | main | 306 | # 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 |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/gift.rb | Ruby | mit | 8,966 | main | 1,011 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/self_service_affiliate_product.rb | Ruby | mit | 8,966 | main | 1,749 | # frozen_string_literal: true
class SelfServiceAffiliateProduct < ApplicationRecord
include Affiliate::BasisPointsValidations
include Affiliate::DestinationUrlValidations
belongs_to :seller, class_name: "User", optional: true
belongs_to :product, class_name: "Link", optional: true
validates :seller, :produ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/video_file.rb | Ruby | mit | 8,966 | main | 1,381 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/indonesia_bank_account.rb | Ruby | mit | 8,966 | main | 1,138 | # frozen_string_literal: true
class IndonesiaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "ID"
BANK_CODE_FORMAT_REGEX = /\A[0-9a-zA-Z]{3,4}\z/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[0-9]{1,35}\z/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_cod... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/guatemala_bank_account.rb | Ruby | mit | 8,966 | main | 1,062 | # 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.... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/billing_detail.rb | Ruby | mit | 8,966 | main | 573 | # frozen_string_literal: true
class BillingDetail < ApplicationRecord
belongs_to :purchaser, class_name: "User"
validates :full_name, :street_address, :city, :zip_code, :country_code, presence: true
validates :state, presence: true, if: :us_address?
validates :country_code, length: { is: 2 }
validates :purc... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/serbia_bank_account.rb | Ruby | mit | 8,966 | main | 1,205 | # 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_... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/user_compliance_info_request.rb | Ruby | mit | 8,966 | main | 14,304 | # 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",
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/subscription_event.rb | Ruby | mit | 8,966 | main | 796 | # frozen_string_literal: true
class SubscriptionEvent < ApplicationRecord
belongs_to :subscription
belongs_to :seller, class_name: "User"
before_validation :assign_seller, on: :create
validates :event_type, :occurred_at, presence: true
validate :consecutive_event_type_not_duplicated
enum event_type: %i[... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/google_calendar_integration.rb | Ruby | mit | 8,966 | main | 787 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/dominican_republic_bank_account.rb | Ruby | mit | 8,966 | main | 1,250 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/cote_d_ivoire_bank_account.rb | Ruby | mit | 8,966 | main | 701 | # 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
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/affiliate_partial_refund.rb | Ruby | mit | 8,966 | main | 537 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/singaporean_bank_account.rb | Ruby | mit | 8,966 | main | 1,423 | # frozen_string_literal: true
class SingaporeanBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "SG"
BANK_CODE_FORMAT_REGEX = /\A[0-9]{4}\z/
private_constant :BANK_CODE_FORMAT_REGEX
BRANCH_CODE_FORMAT_REGEX = /\A[0-9]{3}\z/
private_constant :BRANCH_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[0-9]{6... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/imported_customer.rb | Ruby | mit | 8,966 | main | 1,333 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/community_notification_setting.rb | Ruby | mit | 8,966 | main | 315 | # 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 |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/subscription.rb | Ruby | mit | 8,966 | main | 41,798 | # frozen_string_literal: true
class Subscription < ApplicationRecord
class DoubleChargeAttemptError < GumroadRuntimeError
def initialize(subscription_id, purchase_id)
super("Attempted to double charge subscription: #{subscription_id}, while purchase #{purchase_id} was in progress")
end
end
class U... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/creator_email_open_event.rb | Ruby | mit | 8,966 | main | 458 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/thailand_bank_account.rb | Ruby | mit | 8,966 | main | 1,129 | # 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_... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/team_invitation.rb | Ruby | mit | 8,966 | main | 1,378 | # 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:) }
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/community_chat_recap.rb | Ruby | mit | 8,966 | main | 682 | # frozen_string_literal: true
class CommunityChatRecap < ApplicationRecord
belongs_to :community_chat_recap_run
belongs_to :community, optional: true
belongs_to :seller, class_name: "User", optional: true
validates :summarized_message_count, presence: true, numericality: { greater_than_or_equal_to: 0 }
vali... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/audience_member.rb | Ruby | mit | 8,966 | main | 13,929 | # frozen_string_literal: true
class AudienceMember < ApplicationRecord
VALID_FILTER_TYPES = %w[customer follower affiliate].freeze
belongs_to :seller, class_name: "User"
after_initialize :assign_default_details_value
before_validation :compact_details
before_validation :normalize_email, if: :email?
valida... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/help_center/article.rb | Ruby | mit | 8,966 | main | 472 | # frozen_string_literal: true
# Explicitly require the dependency HelpCenter::Category to avoid circular
# dependency that results in a deadlock during loading.
require "help_center/category"
class HelpCenter::Article < ActiveYaml::Base
include ActiveHash::Associations
set_root_path "app/models"
belongs_to :c... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/help_center/category.rb | Ruby | mit | 8,966 | main | 413 | # frozen_string_literal: true
class HelpCenter::Category < ActiveYaml::Base
include ActiveHash::Associations
include ActiveHash::Enum
set_root_path "app/models"
has_many :articles, class_name: "HelpCenter::Article"
enum_accessor :title
def to_param
slug
end
def categories_for_same_audience
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/unused_columns.rb | Ruby | mit | 8,966 | main | 1,613 | # frozen_string_literal: true
# This module allows marking certain columns as unused on a model.
# For large tables, removing columns can be an expensive operation. It is often preferable to collect
# multiple columns and remove them in a batch.
# This serves as a temporary alternative to `self.ignored_columns`, which... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/with_filtering.rb | Ruby | mit | 8,966 | main | 9,484 | # frozen_string_literal: true
module WithFiltering
extend ActiveSupport::Concern
include CurrencyHelper, JsonData
AUDIENCE_TYPE = "audience"
SELLER_TYPE = "seller"
PRODUCT_TYPE = "product"
VARIANT_TYPE = "variant"
FOLLOWER_TYPE = "follower"
AFFILIATE_TYPE = "affiliate"
ABANDONED_CART_TYPE = "abandon... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/streamable.rb | Ruby | mit | 8,966 | main | 2,911 | # frozen_string_literal: true
module Streamable
extend ActiveSupport::Concern
included do
has_many :transcoded_videos, as: :streamable
end
def attempt_to_transcode?(allowed_when_processing: false)
# Don't transcode if another transcoding job is already pending for this particular video.
return fa... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/stripped_fields.rb | Ruby | mit | 8,966 | main | 1,724 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/secure_external_id.rb | Ruby | mit | 8,966 | main | 6,146 | # frozen_string_literal: true
# A concern to generate and resolve secure, expiring, encrypted, URL-safe tokens
# that represent a model instance. It supports key rotation.
#
# Configuration:
# This module requires configuration in your config/credentials.yml.enc or environment variables via GlobalConfig.
# The configu... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/rich_contents.rb | Ruby | mit | 8,966 | main | 1,130 | # frozen_string_literal: true
module RichContents
extend ActiveSupport::Concern
included do
has_many :rich_contents, as: :entity
has_many :alive_rich_contents, -> { alive }, class_name: "RichContent", as: :entity
end
def rich_content_folder_name(folder_id)
return if folder_id.blank?
folder =... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/search_index_model_common.rb | Ruby | mit | 8,966 | main | 395 | # frozen_string_literal: true
module SearchIndexModelCommon
extend ActiveSupport::Concern
class_methods do
def search_fields
@_search_fields ||= mappings.to_hash[:properties].keys.map(&:to_s)
end
end
def as_indexed_json(options = {})
fields = options[:only] || self.class.search_fields
f... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/charge_processable.rb | Ruby | mit | 8,966 | main | 386 | # frozen_string_literal: true
module ChargeProcessable
def stripe_charge_processor?
charge_processor_id == StripeChargeProcessor.charge_processor_id
end
def paypal_charge_processor?
charge_processor_id == PaypalChargeProcessor.charge_processor_id
end
def braintree_charge_processor?
charge_proce... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/timestamp_state_fields.rb | Ruby | mit | 8,966 | main | 2,289 | # frozen_string_literal: true
# Implements ActiveRecord state fields based on timestamp columns.
#
# Requires a column to be named `property_at`, e.g., `verified_at`.
#
# `state` method uses reverse order of states to determine priority. E.g., it
# checks the last state in the fields first to determine if the object ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/transactional_attribute_change_tracker.rb | Ruby | mit | 8,966 | main | 1,001 | # frozen_string_literal: true
# Tracks all the attributes that were changed in a transaction,
# and makes them available in `#attributes_committed` when the transaction is committed.
# This module exists because `previous_changes` only contains the attributes that were changed in the last `save`,
# if the record was n... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/attribute_blockable.rb | Ruby | mit | 8,966 | main | 12,648 | # frozen_string_literal: true
# AttributeBlockable provides a flexible system for checking if model attributes
# are blocked via the BlockedObject system, with support for efficient N+1 query
# prevention through eager loading.
#
# == Basic Usage
#
# To make an attribute blockable, use the +attr_blockable+ class metho... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/two_factor_authentication.rb | Ruby | mit | 8,966 | main | 2,317 | # 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_... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/versionable.rb | Ruby | mit | 8,966 | main | 906 | # frozen_string_literal: true
# Requires has_paper_trail on the model
#
module Versionable
extend ActiveSupport::Concern
# Reasonable limit of version records to query
LIMIT = 100
VersionInfoStruct = Struct.new(:created_at, :changes)
# It returns a collection of VersionInfoStruct objects that contain chan... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/max_purchase_count.rb | Ruby | mit | 8,966 | main | 495 | # frozen_string_literal: true
module MaxPurchaseCount
extend ActiveSupport::Concern
MAX_PURCHASE_COUNT_RANGE = (0 .. 10_000_000)
included do
before_validation :constrain_max_purchase_count_within_range
validates_numericality_of :max_purchase_count, in: MAX_PURCHASE_COUNT_RANGE, allow_nil: true
end
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/json_data.rb | Ruby | mit | 8,966 | main | 2,974 | # frozen_string_literal: true
# Mixin for modules that contain a `json_data` field. Adds functions that
# standardize how data is stored within the `json_data` field, and what happens
# if the data within is not present or blank.
#
# All functions are safe to call when `json_data` is nil and it does not need
# to be i... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/product/taxonomies.rb | Ruby | mit | 8,966 | main | 205 | # frozen_string_literal: true
module Product::Taxonomies
extend ActiveSupport::Concern
include Purchase::Searchable::ProductCallbacks
included do
belongs_to :taxonomy, optional: true
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/product/as_json.rb | Ruby | mit | 8,966 | main | 8,435 | # frozen_string_literal: true
module Product::AsJson
extend ActiveSupport::Concern
included do
alias super_as_json as_json
end
def as_json(options = {})
return super(options) if options.delete(:original)
return as_json_for_admin_info if options.delete(:admin_info)
return as_json_for_api(optio... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/product/staff_picked.rb | Ruby | mit | 8,966 | main | 395 | # frozen_string_literal: true
module Product::StaffPicked
extend ActiveSupport::Concern
def staff_picked?
return false if staff_picked_product.blank?
staff_picked_product.not_deleted?
end
alias_method :staff_picked, :staff_picked?
def staff_picked_at
return if staff_picked_product.blank? || st... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/product/tags.rb | Ruby | mit | 8,966 | main | 1,373 | # frozen_string_literal: true
module Product::Tags
extend ActiveSupport::Concern
included do
has_many :product_taggings, foreign_key: :product_id, dependent: :destroy
has_many :tags, through: :product_taggings
scope :with_tags, lambda { |tag_names|
if tag_names.present? && tag_names.any?
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/product/structured_data.rb | Ruby | mit | 8,966 | main | 3,496 | # frozen_string_literal: true
module Product::StructuredData
extend ActiveSupport::Concern
include ActionView::Helpers::SanitizeHelper
SCHEMA_ORG_CONTEXT = "https://schema.org"
AVAILABILITY_IN_STOCK = "#{SCHEMA_ORG_CONTEXT}/InStock"
AVAILABILITY_LIMITED = "#{SCHEMA_ORG_CONTEXT}/LimitedAvailability"
AVAILA... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/product/bundles_marketing.rb | Ruby | mit | 8,966 | main | 339 | # frozen_string_literal: true
module Product::BundlesMarketing
YEAR_BUNDLE = "year"
BEST_SELLING_BUNDLE = "best_selling"
EVERYTHING_BUNDLE = "everything"
BUNDLE_NAMES = {
YEAR_BUNDLE => "#{1.year.ago.year} Bundle",
BEST_SELLING_BUNDLE => "Best Selling Bundle",
EVERYTHING_BUNDLE => "Everything Bund... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/product/native_type_templates.rb | Ruby | mit | 8,966 | main | 775 | # frozen_string_literal: true
module Product::NativeTypeTemplates
extend ActiveSupport::Concern
DEFAULT_ATTRIBUTES_FOR_TYPE = {
podcast: [
{ name: "Episodes", value: "" },
{ name: "Total length", value: "" }
],
ebook: [
{ name: "Pages", value: "" }
],
audiobook: [
{ nam... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/product/sorting.rb | Ruby | mit | 8,966 | main | 2,560 | # frozen_string_literal: true
module Product::Sorting
extend ActiveSupport::Concern
ES_SORT_KEYS = ["display_price_cents", "is_recommendable"]
SQL_SORT_KEYS = ["name", "successful_sales_count", "status", "taxonomy", "display_product_reviews", "revenue", "cut"]
SORT_KEYS = ES_SORT_KEYS + SQL_SORT_KEYS
SORT_... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/workflow/abandoned_cart_products.rb | Ruby | mit | 8,966 | main | 1,894 | # frozen_string_literal: true
module Workflow::AbandonedCartProducts
extend ActiveSupport::Concern
included do
include Rails.application.routes.url_helpers
end
def abandoned_cart_products(only_product_and_variant_ids: false)
return [] unless abandoned_cart_type?
include_all_products = bought_pr... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/charge/refundable.rb | Ruby | mit | 8,966 | main | 1,705 | # frozen_string_literal: true
module Charge::Refundable
extend ActiveSupport::Concern
def handle_event_refund_updated!(event)
stripe_refund_id = event.refund_id
db_refunds = Refund.where(processor_refund_id: stripe_refund_id)
if db_refunds.present?
db_refunds.each do |db_refund|
db_refu... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/charge/chargeable.rb | Ruby | mit | 8,966 | main | 3,910 | # frozen_string_literal: true
module Charge::Chargeable
class << self
def find_by_stripe_event(event)
chargeable = nil
if event.charge_reference.to_s.starts_with?(Charge::COMBINED_CHARGE_PREFIX)
chargeable ||= Charge.where(id: event.charge_reference.sub(Charge::COMBINED_CHARGE_PREFIX, "")).l... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/charge/disputable.rb | Ruby | mit | 8,966 | main | 8,923 | # frozen_string_literal: true
module Charge::Disputable
extend ActiveSupport::Concern
include CurrencyHelper
included do
has_one :dispute
def charge_processor
is_a?(Charge) ? processor : charge_processor_id
end
def charge_processor_transaction_id
is_a?(Charge) ? processor_transacti... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/order/orderable.rb | Ruby | mit | 8,966 | main | 848 | # frozen_string_literal: true
module Order::Orderable
def require_shipping?
is_a?(Order) ? super : link.require_shipping?
end
def receipt_for_gift_receiver?
is_a?(Order) ? super : is_gift_receiver_purchase?
end
def receipt_for_gift_sender?
is_a?(Order) ? super : is_gift_sender_purchase?
end
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/user/stripe_connect.rb | Ruby | mit | 8,966 | main | 1,677 | # frozen_string_literal: true
module User::StripeConnect
extend ActiveSupport::Concern
class_methods do
def find_or_create_for_stripe_connect_account(data)
return nil if data.blank?
user = MerchantAccount.where(charge_processor_merchant_id: data["uid"]).alive
.find { |ma| ma.is_a... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/user/team.rb | Ruby | mit | 8,966 | main | 2,545 | # frozen_string_literal: true
module User::Team
extend ActiveSupport::Concern
included do
has_many :user_memberships, class_name: "TeamMembership", foreign_key: :user_id
has_many :seller_memberships, class_name: "TeamMembership", foreign_key: :seller_id
has_many :team_invitations, foreign_key: :seller... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/user/recommendation_type.rb | Ruby | mit | 8,966 | main | 274 | # frozen_string_literal: true
module User::RecommendationType
TYPES = [
"no_recommendations",
"own_products",
"gumroad_affiliates_products",
"directly_affiliated_products"
].freeze
TYPES.each do |type|
self.const_set(type.upcase, type)
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/user/as_json.rb | Ruby | mit | 8,966 | main | 1,736 | # frozen_string_literal: true
module User::AsJson
extend ActiveSupport::Concern
def as_json(options = {})
result =
if options[:internal_use] || valid_api_scope?(options)
super(only: %i[name bio currency_type], methods: options[:methods], include: options[:include])
.merge(common_fields... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/user/purchases.rb | Ruby | mit | 8,966 | main | 401 | # frozen_string_literal: true
module User::Purchases
extend ActiveSupport::Concern
def transfer_purchases!(new_email:)
new_user = User.find_by!(email: new_email)
purchases = Purchase.where(email:)
transaction do
purchases.find_each do |purchase|
purchase.email = new_email
purcha... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/user/mailer_level.rb | Ruby | mit | 8,966 | main | 1,093 | # frozen_string_literal: true
module User::MailerLevel
extend ActiveSupport::Concern
MAILER_LEVEL_REDIS_EXPIRY = 1.week
def mailer_level
# Use Memcached cache to reduce the number of queries to Redis
Rails.cache.fetch("creator_mailer_level_#{id}", expires_in: 2.days) do
level_from_redis = mailer_... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/user/taxation.rb | Ruby | mit | 8,966 | main | 5,121 | # frozen_string_literal: true
module User::Taxation
extend ActiveSupport::Concern
include Compliance
MIN_SALE_AMOUNT_FOR_1099_K_FEDERAL_FILING = 20_000 * 100
MIN_SALE_COUNT_FOR_1099_K_FEDERAL_FILING = 200
MIN_SALE_AMOUNT_FOR_1099_K_FEDERAL_FILING_FOR_YEAR = { 2024 => 5_000 }
MIN_SALE_COUNT_FOR_1099_K_FEDE... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/user/social_google.rb | Ruby | mit | 8,966 | main | 3,797 | # frozen_string_literal: true
module User::SocialGoogle
extend ActiveSupport::Concern
def google_picture_url(data)
return nil if data["info"]["image"].nil? || data["info"]["image"].empty?
pic_url = data["info"]["image"]
# Replacing all instances of "s96-c" in the string with "s400-c" to get a larger ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/user/social_apple.rb | Ruby | mit | 8,966 | main | 2,029 | # frozen_string_literal: true
module User::SocialApple
extend ActiveSupport::Concern
class_methods do
def find_or_create_for_apple_oauth(data)
if data["uid"].blank?
ErrorNotifier.notify("Apple OAuth data is missing a uid")
return nil
end
auth = UserExternalAuthentication.fin... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/concerns/user/vip_creator.rb | Ruby | mit | 8,966 | main | 336 | # frozen_string_literal: true
module User::VipCreator
extend ActiveSupport::Concern
VIP_GROSS_PAID_PAYOUTS_THRESHOLD_CENTS = 5_000_00
def vip_creator?
gross_paid_payouts_cents > VIP_GROSS_PAID_PAYOUTS_THRESHOLD_CENTS
end
private
def gross_paid_payouts_cents
payments.completed.sum(:amount_cen... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.