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/shipment.rb | Ruby | mit | 8,966 | main | 1,985 | # frozen_string_literal: true
class Shipment < ApplicationRecord
belongs_to :purchase, optional: true
CARRIER_TRACKING_URL_MAPPING = {
"USPS" => "https://tools.usps.com/go/TrackConfirmAction?qtc_tLabels1=",
"UPS" => "http://wwwapps.ups.com/WebTracking/processInputRequest?TypeOfInquiryNumber=T&InquiryNumbe... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/product_file.rb | Ruby | mit | 8,966 | main | 11,386 | # frozen_string_literal: true
class ProductFile < ApplicationRecord
include S3Retrievable, WithFileProperties, ExternalId, SignedUrlHelper, JsonData, SendableToKindle, Deletable,
CdnDeletable, FlagShihTzu, CdnUrlHelper, Streamable
SUPPORTED_THUMBNAIL_IMAGE_CONTENT_TYPES = /jpeg|gif|png|jpg/i
MAXIMUM_T... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/uk_bank_account.rb | Ruby | mit | 8,966 | main | 606 | # frozen_string_literal: true
class UkBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "UK"
SORT_CODE_FORMAT_REGEX = /^\d{2}-\d{2}-\d{2}$/
private_constant :SORT_CODE_FORMAT_REGEX
alias_attribute :sort_code, :bank_number
validate :validate_sort_code
def routing_number
sort_code
end
def bank_acco... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/jamaica_bank_account.rb | Ruby | mit | 8,966 | main | 1,366 | # frozen_string_literal: true
class JamaicaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "JM"
BANK_CODE_FORMAT_REGEX = /^\d{3}$/
BRANCH_CODE_FORMAT_REGEX = /^\d{5}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^\d{1,18}$/
private_constant :BANK_CODE_FORMAT_REGEX, :BRANCH_CODE_FORMAT_REGEX, :ACCOUNT_NUMBER_FORMAT_REGEX
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/integration.rb | Ruby | mit | 8,966 | main | 1,321 | # frozen_string_literal: true
class Integration < ApplicationRecord
include FlagShihTzu
include JsonData
include TimestampScopes
CIRCLE = "circle"
DISCORD = "discord"
ZOOM = "zoom"
GOOGLE_CALENDAR = "google_calendar"
ALL_NAMES = [CIRCLE, DISCORD, ZOOM, GOOGLE_CALENDAR]
has_one :product_integration... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/hungary_bank_account.rb | Ruby | mit | 8,966 | main | 688 | # 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
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/backtax_agreement.rb | Ruby | mit | 8,966 | main | 504 | # frozen_string_literal: true
class BacktaxAgreement < ApplicationRecord
include FlagShihTzu
belongs_to :user
has_one :credit
has_many :backtax_collections
has_flags 1 => :collected,
:column => "flags",
:flag_query_mode => :bit_operator,
check_for_column: false
module... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/chile_bank_account.rb | Ruby | mit | 8,966 | main | 1,447 | # 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
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/algeria_bank_account.rb | Ruby | mit | 8,966 | main | 1,129 | # frozen_string_literal: true
class AlgeriaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "DZ"
BANK_CODE_FORMAT_REGEX = /^([0-9a-zA-Z]){8,11}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^\d{20}$/
private_constant :BANK_CODE_FORMAT_REGEX, :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code, :bank_number
validate... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/sales_export.rb | Ruby | mit | 8,966 | main | 420 | # frozen_string_literal: true
class SalesExport < ApplicationRecord
belongs_to :recipient, class_name: "User"
# We use :delete_all instead of :destroy to prevent needlessly loading
# a lot of data in memory (column `purchases_data`).
has_many :chunks, class_name: "SalesExportChunk", foreign_key: :export_id, de... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/purchase_custom_field.rb | Ruby | mit | 8,966 | main | 2,264 | # 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:,... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/email_event.rb | Ruby | mit | 8,966 | main | 3,054 | # frozen_string_literal: true
class EmailEvent
include Mongoid::Document
include Mongoid::Timestamps
EMAIL_DIGEST_LENGTH = 12
STALE_RECIPIENT_THRESHOLD_DAYS = 365
STALE_RECIPIENT_UNOPENED_THRESHOLD = 10
private_constant :EMAIL_DIGEST_LENGTH, :STALE_RECIPIENT_THRESHOLD_DAYS, :STALE_RECIPIENT_UNOPENED_THRES... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/ach_account.rb | Ruby | mit | 8,966 | main | 2,340 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/sales_related_products_info.rb | Ruby | mit | 8,966 | main | 5,126 | # frozen_string_literal: true
class SalesRelatedProductsInfo < ApplicationRecord
belongs_to :smaller_product, class_name: "Link"
belongs_to :larger_product, class_name: "Link"
validates_numericality_of :smaller_product_id, less_than: :larger_product_id
scope :for_product_id, ->(product_id) { where("smaller_p... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/bhutan_bank_account.rb | Ruby | mit | 8,966 | main | 1,142 | # frozen_string_literal: true
class BhutanBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "BT"
BANK_CODE_FORMAT_REGEX = /^([0-9a-zA-Z]){8,11}$/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /^([0-9a-zA-Z]){1,17}$/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/north_macedonia_bank_account.rb | Ruby | mit | 8,966 | main | 1,192 | # frozen_string_literal: true
class NorthMacedoniaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "MK"
BANK_CODE_FORMAT_REGEX = /\A[a-zA-Z0-9]{8,11}\z/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[a-zA-Z0-9]{19}\z/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/subscription_plan_change.rb | Ruby | mit | 8,966 | main | 1,909 | # frozen_string_literal: true
# Represents a user-initiated plan change to a subscription, for example to
# upgrade or downgrade their tier or recurrence. Used by `RecurringChargeWorker`
# worker to check if a user has a plan change that must be made at the end of
# the current billing period, before initiating the ne... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/transcoded_video.rb | Ruby | mit | 8,966 | main | 1,677 | # frozen_string_literal: true
class TranscodedVideo < ApplicationRecord
include FlagShihTzu, Deletable, CdnDeletable
self.ignored_columns += [:product_file_id]
has_paper_trail
belongs_to :link, optional: true
delegated_type :streamable, types: %w[ProductFile], optional: true
validates_presence_of :ori... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/product_refund_policy.rb | Ruby | mit | 8,966 | main | 4,475 | # frozen_string_literal: true
class ProductRefundPolicy < RefundPolicy
belongs_to :product, class_name: "Link"
validates :product, presence: true, uniqueness: true
validate :product_must_belong_to_seller
scope :for_visible_and_not_archived_products, -> { joins(:product).merge(Link.visible_and_not_archived) }... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/creator_email_click_summary.rb | Ruby | mit | 8,966 | main | 281 | # 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 |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/product_page_view.rb | Ruby | mit | 8,966 | main | 802 | # frozen_string_literal: true
class ProductPageView
include Elasticsearch::Model
index_name "product_page_views"
def self.index_name_from_body(body)
USE_ES_ALIASES ? "#{index_name}-#{body["timestamp"].first(7)}" : index_name
end
settings number_of_shards: 1, number_of_replicas: 0
mapping dynamic: :... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/purchase_refund_policy.rb | Ruby | mit | 8,966 | main | 5,162 | # frozen_string_literal: true
class PurchaseRefundPolicy < ApplicationRecord
belongs_to :purchase
has_one :link, through: :purchase
has_one :product_refund_policy, through: :link
stripped_fields :title, :fine_print
validates :purchase, uniqueness: true
validates :title, presence: true
# This is the da... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/affiliate_credit.rb | Ruby | mit | 8,966 | main | 2,246 | # frozen_string_literal: true
class AffiliateCredit < ApplicationRecord
include Purchase::Searchable::AffiliateCreditCallbacks
belongs_to :affiliate_user, class_name: "User"
belongs_to :seller, class_name: "User"
belongs_to :purchase
belongs_to :link, optional: true
belongs_to :affiliate, optional: true
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/bangladesh_bank_account.rb | Ruby | mit | 8,966 | main | 1,144 | # frozen_string_literal: true
class BangladeshBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "BD"
BANK_CODE_FORMAT_REGEX = /^([0-9a-zA-Z]){9}$/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /^([0-9a-zA-Z]){13,17}$/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :ba... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/benin_bank_account.rb | Ruby | mit | 8,966 | main | 764 | # frozen_string_literal: true
class BeninBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "BJ"
ACCOUNT_NUMBER_FORMAT_REGEX = /^BJ[a-zA-Z0-9]{26}$/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
validate :validate_account_number
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance::C... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/monaco_bank_account.rb | Ruby | mit | 8,966 | main | 686 | # 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
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/mongolia_bank_account.rb | Ruby | mit | 8,966 | main | 1,112 | # frozen_string_literal: true
class MongoliaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "MN"
BANK_CODE_FORMAT_REGEX = /^[0-9a-zA-Z]{8,11}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^\d{1,12}$/
private_constant :BANK_CODE_FORMAT_REGEX, :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code, :bank_number
validat... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/offer_code.rb | Ruby | mit | 8,966 | main | 10,705 | # frozen_string_literal: true
class OfferCode < ApplicationRecord
has_paper_trail
include FlagShihTzu
include ExternalId
include CurrencyHelper
include Deletable
include MaxPurchaseCount
include OfferCode::Sorting
has_flags 1 => :is_cancellation_discount,
2 => :created_via_cli,
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/purchase_offer_code_discount.rb | Ruby | mit | 8,966 | main | 441 | # frozen_string_literal: true
class PurchaseOfferCodeDiscount < ApplicationRecord
belongs_to :purchase, optional: true
belongs_to :offer_code, optional: true
validates :purchase, presence: true, uniqueness: true
validates :offer_code, presence: true
validates :offer_code_amount, presence: true
validates :... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/upsell.rb | Ruby | mit | 8,966 | main | 4,360 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/affiliate_request.rb | Ruby | mit | 8,966 | main | 5,252 | # frozen_string_literal: true
class AffiliateRequest < ApplicationRecord
include ExternalId
ACTION_APPROVE = "approve"
ACTION_IGNORE = "ignore"
belongs_to :seller, class_name: "User", optional: true
validates :seller, :name, :email, :promotion_text, presence: true
validates :name, length: { maximum: Use... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/sku.rb | Ruby | mit | 8,966 | main | 1,180 | # 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
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/rich_content.rb | Ruby | mit | 8,966 | main | 3,662 | # frozen_string_literal: true
class RichContent < ApplicationRecord
include Deletable, ExternalId, Versionable
has_paper_trail
FILE_EMBED_NODE_TYPE = "fileEmbed"
FILE_EMBED_GROUP_NODE_TYPE = "fileEmbedGroup"
ORDERED_LIST_NODE_TYPE = "orderedList"
BULLET_LIST_NODE_TYPE = "bulletList"
LIST_ITEM_NODE_TYPE... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/balance.rb | Ruby | mit | 8,966 | main | 2,642 | # frozen_string_literal: true
class Balance < ApplicationRecord
include ExternalId
include Balance::Searchable
include Balance::RefundEligibilityUnderwriter
belongs_to :user, optional: true
belongs_to :merchant_account, optional: true
has_many :balance_transactions
has_many :successful_sales, class_na... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/product_review.rb | Ruby | mit | 8,966 | main | 2,320 | # frozen_string_literal: true
class ProductReview < ApplicationRecord
include ExternalId, Deletable
PRODUCT_RATING_RANGE = (1..5)
REVIEW_REMINDER_DELAY = 5.days
REVIEW_REMINDER_PHYSICAL_DELAY = 90.days
RestrictedOperationError = Class.new(StandardError)
belongs_to :link, optional: true
belongs_to :purc... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/ecuador_bank_account.rb | Ruby | mit | 8,966 | main | 1,131 | # frozen_string_literal: true
class EcuadorBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "EC"
BANK_CODE_FORMAT_REGEX = /^[a-zA-Z0-9]{8,11}\z/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[0-9]{5,18}\z/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code,... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/user_compliance_info.rb | Ruby | mit | 8,966 | main | 8,497 | # frozen_string_literal: true
class UserComplianceInfo < ApplicationRecord
self.table_name = "user_compliance_info"
include ExternalId
include Immutable
include UserComplianceInfo::BusinessTypes
include JsonData
stripped_fields :first_name, :last_name, :street_address, :city, :zip_code, :business_name, :... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/product_installment_plan.rb | Ruby | mit | 8,966 | main | 3,285 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/order.rb | Ruby | mit | 8,966 | main | 3,635 | # frozen_string_literal: true
class Order < ApplicationRecord
include ExternalId, SecureExternalId, Orderable, FlagShihTzu
belongs_to :purchaser, class_name: "User", optional: true
has_many :order_purchases, dependent: :destroy
has_many :purchases, through: :order_purchases, dependent: :destroy
has_many :c... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/european_bank_account.rb | Ruby | mit | 8,966 | main | 898 | # frozen_string_literal: true
class EuropeanBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "EU"
# On sandbox, the test IBAN numbers are of same length for all countries
# (ref: https://stripe.com/docs/connect/testing#account-numbers),
# so validating this only for production.
validate :validate_account_numbe... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/base_variant.rb | Ruby | mit | 8,966 | main | 7,600 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/kuwait_bank_account.rb | Ruby | mit | 8,966 | main | 1,025 | # frozen_string_literal: true
class KuwaitBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "KW"
BANK_CODE_FORMAT_REGEX = /^[a-zA-Z0-9]{8,11}$/
private_constant :BANK_CODE_FORMAT_REGEX
alias_attribute :bank_code, :bank_number
validate :validate_bank_code
validate :validate_account_number
def routing_numb... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/product_review_response.rb | Ruby | mit | 8,966 | main | 329 | # frozen_string_literal: true
class ProductReviewResponse < ApplicationRecord
belongs_to :user
belongs_to :product_review
validates :message, presence: true
after_create_commit :notify_reviewer_via_email
private
def notify_reviewer_via_email
CustomerMailer.review_response(self).deliver_later
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/indian_bank_account.rb | Ruby | mit | 8,966 | main | 824 | # frozen_string_literal: true
class IndianBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "IN"
# IFSC Format:
# • 4 chars to identify bank
# • 1 reserved digit, always 0
# • 6 chars to identify branch
IFSC_FORMAT_REGEX = /^[A-Za-z]{4}0[A-Z0-9a-z]{6}$/
private_constant :IFSC_FORMAT_REGEX
alias_attrib... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/tag.rb | Ruby | mit | 8,966 | main | 1,585 | # frozen_string_literal: true
class Tag < ApplicationRecord
before_validation :clean_name, if: :name_changed?
has_many :product_taggings, dependent: :destroy
has_many :products, through: :product_taggings, class_name: "Link"
validates :name,
presence: true,
uniqueness: { case_sensitive... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/morocco_bank_account.rb | Ruby | mit | 8,966 | main | 1,224 | # frozen_string_literal: true
class MoroccoBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "MA"
BANK_CODE_FORMAT_REGEX = /^([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?$/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /^MA([0-9]){20,26}$/
private_constant :ACCOUNT_NUMBER... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/denmark_bank_account.rb | Ruby | mit | 8,966 | main | 688 | # frozen_string_literal: true
class DenmarkBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "DK"
validate :validate_account_number, if: -> { Rails.env.production? }
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance::Countries::DNK.alpha2
end
def currency
Currency::DKK
end
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/team_membership.rb | Ruby | mit | 8,966 | main | 1,654 | # frozen_string_literal: true
class TeamMembership < ApplicationRecord
include ExternalId
include TimestampStateFields
has_paper_trail
ROLES = %w(owner accountant admin marketing support).freeze
ROLES.each do |role|
self.const_set("ROLE_#{role.upcase}", role)
scope "role_#{role}", -> { where(role... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/collaborator_invitation.rb | Ruby | mit | 8,966 | main | 388 | # frozen_string_literal: true
class CollaboratorInvitation < ApplicationRecord
include ExternalId
belongs_to :collaborator
def accept!
destroy!
AffiliateMailer.collaborator_invitation_accepted(collaborator_id).deliver_later
end
def decline!
collaborator.mark_deleted!
AffiliateMailer.collab... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/bosnia_and_herzegovina_bank_account.rb | Ruby | mit | 8,966 | main | 1,077 | # frozen_string_literal: true
class BosniaAndHerzegovinaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "BA"
BANK_CODE_FORMAT_REGEX = /^([0-9a-zA-Z]){8,11}$/
private_constant :BANK_CODE_FORMAT_REGEX
alias_attribute :bank_code, :bank_number
validate :validate_bank_code
validate :validate_account_number, if... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/installment.rb | Ruby | mit | 8,966 | main | 36,128 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/tanzania_bank_account.rb | Ruby | mit | 8,966 | main | 1,122 | # frozen_string_literal: true
class TanzaniaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "TZ"
BANK_CODE_FORMAT_REGEX = /^[a-zA-Z0-9]{8,11}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^[a-zA-Z0-9]{10,14}$/
private_constant :BANK_CODE_FORMAT_REGEX, :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code, :bank_number
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/turkey_bank_account.rb | Ruby | mit | 8,966 | main | 1,068 | # frozen_string_literal: true
class TurkeyBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "TR"
BANK_CODE_FORMAT_REGEX = /^([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?$/
private_constant :BANK_CODE_FORMAT_REGEX
alias_attribute :bank_code, :bank_number
validate :validate_bank_code
validate :v... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/armenia_bank_account.rb | Ruby | mit | 8,966 | main | 1,112 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/dispute.rb | Ruby | mit | 8,966 | main | 4,432 | # frozen_string_literal: true
class Dispute < ApplicationRecord
has_paper_trail
include ExternalId
belongs_to :seller, class_name: "User", optional: true
belongs_to :purchase, optional: true
belongs_to :charge, optional: true
belongs_to :service_charge, optional: true
has_many :credits
has_many :bala... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/uruguay_bank_account.rb | Ruby | mit | 8,966 | main | 1,099 | # frozen_string_literal: true
class UruguayBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "UY"
BANK_CODE_FORMAT_REGEX = /^\d{3}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^\d{1,12}$/
private_constant :BANK_CODE_FORMAT_REGEX, :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code, :bank_number
validate :validate_b... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/large_seller.rb | Ruby | mit | 8,966 | main | 818 | # 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 ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/product_files_archive.rb | Ruby | mit | 8,966 | main | 3,905 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/post_email_blast.rb | Ruby | mit | 8,966 | main | 2,896 | # frozen_string_literal: true
class PostEmailBlast < ApplicationRecord
# requested_at:
# Time when a user clicked on "Publish now".
# For a scheduled post, it is when the post was scheduled for.
# started_at:
# Time when we start the process of finding recipients to send the emails to.
# first_email_... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/jordan_bank_account.rb | Ruby | mit | 8,966 | main | 1,072 | # frozen_string_literal: true
class JordanBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "JO"
BANK_CODE_FORMAT_REGEX = /^([0-9a-zA-Z]){8,11}$/
private_constant :BANK_CODE_FORMAT_REGEX
alias_attribute :bank_code, :bank_number
validate :validate_bank_code
validate :validate_account_number, if: -> { Rails.e... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/discover_search.rb | Ruby | mit | 8,966 | main | 255 | # frozen_string_literal: true
class DiscoverSearch < ApplicationRecord
belongs_to :user, optional: true
belongs_to :taxonomy, optional: true
belongs_to :clicked_resource, polymorphic: true, optional: true
has_one :discover_search_suggestion
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/wishlist.rb | Ruby | mit | 8,966 | main | 1,265 | # frozen_string_literal: true
class Wishlist < ApplicationRecord
include ExternalId, Deletable, FlagShihTzu
DEFAULT_NAME_MATCHER = /\AWishlist \d+\z/
belongs_to :user
has_many :wishlist_products
has_many :alive_wishlist_products, -> { alive }, class_name: "WishlistProduct"
has_many :products, through: :... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/community_chat_recap_run.rb | Ruby | mit | 8,966 | main | 1,547 | # frozen_string_literal: true
class CommunityChatRecapRun < ApplicationRecord
has_many :community_chat_recaps, dependent: :destroy
validates :recap_frequency, :from_date, :to_date, presence: true
validates :recap_frequency, uniqueness: { scope: [:from_date, :to_date] }
enum :recap_frequency, { daily: "daily"... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/product_review_stat.rb | Ruby | mit | 8,966 | main | 2,183 | # frozen_string_literal: true
class ProductReviewStat < ApplicationRecord
belongs_to :link, optional: true
validates_presence_of :link
validates_uniqueness_of :link_id
RATING_COLUMN_MAP = {
1 => "ratings_of_one_count",
2 => "ratings_of_two_count",
3 => "ratings_of_three_count",
4 => "ratings_... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/upsell_variant.rb | Ruby | mit | 8,966 | main | 655 | # frozen_string_literal: true
class UpsellVariant < ApplicationRecord
include Deletable, ExternalId
belongs_to :upsell
belongs_to :selected_variant, class_name: "BaseVariant"
belongs_to :offered_variant, class_name: "BaseVariant"
validates_presence_of :upsell, :selected_variant, :offered_variant
validat... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/poland_bank_account.rb | Ruby | mit | 8,966 | main | 687 | # 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
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/philippines_bank_account.rb | Ruby | mit | 8,966 | main | 1,141 | # frozen_string_literal: true
class PhilippinesBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "PH"
BANK_CODE_FORMAT_REGEX = /\A[A-Za-z0-9]{8,11}\z/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[0-9]{1,17}\z/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/product_cached_value.rb | Ruby | mit | 8,966 | main | 739 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/israel_bank_account.rb | Ruby | mit | 8,966 | main | 687 | # 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
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/gibraltar_bank_account.rb | Ruby | mit | 8,966 | main | 979 | # frozen_string_literal: true
class GibraltarBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "GI"
SORT_CODE_FORMAT_REGEX = /^\d{2}-\d{2}-\d{2}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^\d{8}$/
private_constant :SORT_CODE_FORMAT_REGEX, :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :sort_code, :bank_number
validate ... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/link.rb | Ruby | mit | 8,966 | main | 56,201 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/sweden_bank_account.rb | Ruby | mit | 8,966 | main | 687 | # frozen_string_literal: true
class SwedenBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "SE"
validate :validate_account_number, if: -> { Rails.env.production? }
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance::Countries::SWE.alpha2
end
def currency
Currency::SEK
end
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/purchase_preview.rb | Ruby | mit | 8,966 | main | 1,798 | # frozen_string_literal: true
class PurchasePreview
include ActiveModel::Model
attr_accessor :link, :seller, :created_at, :quantity, :custom_fields,
:formatted_total_display_price_per_unit, :shipping_cents,
:displayed_price_currency_type, :url_redirect, :displayed_price_cents,
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/installment_plan_snapshot.rb | Ruby | mit | 8,966 | main | 690 | # frozen_string_literal: true
class InstallmentPlanSnapshot < ApplicationRecord
belongs_to :payment_option
validates :payment_option, uniqueness: true
validates :number_of_installments, presence: true, numericality: { greater_than: 0, only_integer: true }
validates :recurrence, presence: true
validates :tot... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/legacy_permalink.rb | Ruby | mit | 8,966 | main | 287 | # 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 |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/bahamas_bank_account.rb | Ruby | mit | 8,966 | main | 1,112 | # frozen_string_literal: true
class BahamasBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "BS"
BANK_CODE_FORMAT_REGEX = /^[a-z0-9A-Z]{8,11}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^\d{1,10}$/
private_constant :BANK_CODE_FORMAT_REGEX, :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code, :bank_number
validate... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/oauth_application.rb | Ruby | mit | 8,966 | main | 2,809 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/staff_picked_product.rb | Ruby | mit | 8,966 | main | 424 | # 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
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/consumption_event.rb | Ruby | mit | 8,966 | main | 1,511 | # 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... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/australian_bank_account.rb | Ruby | mit | 8,966 | main | 815 | # frozen_string_literal: true
class AustralianBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "AUSTRALIAN"
# BSB Number Format:
# • 2 digits to identify bank
# • 1 digit to identify state
# • 3 digits to identify branch
BSB_NUMBER_FORMAT_REGEX = /^[0-9]{6}$/
private_constant :BSB_NUMBER_FORMAT_REGEX
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/new_zealand_bank_account.rb | Ruby | mit | 8,966 | main | 756 | # 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:... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/moldova_bank_account.rb | Ruby | mit | 8,966 | main | 1,138 | # frozen_string_literal: true
class MoldovaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "MD"
BANK_CODE_FORMAT_REGEX = /^[A-Z0-9]{4}MD[A-Z0-9]{2}([A-Z0-9]{3})?$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^MD\d{2}[A-Z0-9]{20}$/
private_constant :BANK_CODE_FORMAT_REGEX, :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :ban... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/call_limitation_info.rb | Ruby | mit | 8,966 | main | 1,016 | # frozen_string_literal: true
class CallLimitationInfo < ApplicationRecord
DEFAULT_MINIMUM_NOTICE_IN_MINUTES = 180
CHECKOUT_GRACE_PERIOD = 3.minutes
belongs_to :call, class_name: "Link"
validate :belongs_to_call
attribute :minimum_notice_in_minutes, default: DEFAULT_MINIMUM_NOTICE_IN_MINUTES
def allows... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/japan_bank_account.rb | Ruby | mit | 8,966 | main | 2,247 | # frozen_string_literal: true
class JapanBankAccount < BankAccount
include StrippedFields
BANK_ACCOUNT_TYPE = "JP"
BANK_CODE_FORMAT_REGEX = /\A[0-9]{4}\z/
private_constant :BANK_CODE_FORMAT_REGEX
BRANCH_CODE_FORMAT_REGEX = /\A[0-9]{3}\z/
private_constant :BRANCH_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMA... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/purchase.rb | Ruby | mit | 8,966 | main | 167,004 | # frozen_string_literal: true
class Purchase < ApplicationRecord
has_paper_trail
include Rails.application.routes.url_helpers
include ActionView::Helpers::DateHelper, CurrencyHelper, ProductsHelper, PurchaseErrorCode,
ExternalId, JsonData, TimestampScopes, Accounting, Blockable, CardCountrySource, Tar... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/antigua_and_barbuda_bank_account.rb | Ruby | mit | 8,966 | main | 1,130 | # frozen_string_literal: true
class AntiguaAndBarbudaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "AG"
BANK_CODE_FORMAT_REGEX = /^[a-zA-Z0-9]{8,11}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^[a-zA-Z0-9]{1,32}$/
private_constant :BANK_CODE_FORMAT_REGEX, :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code, :bank... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/blocked_object.rb | Ruby | mit | 8,966 | main | 2,243 | # frozen_string_literal: true
class BlockedObject
include Mongoid::Document
include Mongoid::Timestamps
# Block the IP for 6 months so that if the IP gets reallocated can be used again
# Also prevents the list of blocked IPs to grow indefinitely
IP_ADDRESS_BLOCKING_DURATION_IN_MONTHS = 6
field :object_ty... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/discover_search_suggestion.rb | Ruby | mit | 8,966 | main | 361 | # 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 })... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/colombia_bank_account.rb | Ruby | mit | 8,966 | main | 1,463 | # frozen_string_literal: true
class ColombiaBankAccount < BankAccount
include ColombiaBankAccount::AccountType
BANK_ACCOUNT_TYPE = "CO"
BANK_CODE_FORMAT_REGEX = /\A[0-9]{3}\z/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[0-9]{9,16}\z/
private_constant :ACCOUNT_NUMBER_FORMAT... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/workflow.rb | Ruby | mit | 8,966 | main | 3,996 | # frozen_string_literal: true
class Workflow < ApplicationRecord
has_paper_trail
include ActionView::Helpers::NumberHelper, ExternalId, Deletable, JsonData, WithFiltering, FlagShihTzu,
Workflow::AbandonedCartProducts
has_flags 1 => :send_to_past_customers,
column: "flags",
fla... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/saudi_arabia_bank_account.rb | Ruby | mit | 8,966 | main | 1,073 | # frozen_string_literal: true
class SaudiArabiaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "SA"
BANK_CODE_FORMAT_REGEX = /^([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?$/
private_constant :BANK_CODE_FORMAT_REGEX
alias_attribute :bank_code, :bank_number
validate :validate_bank_code
valida... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/community.rb | Ruby | mit | 8,966 | main | 560 | # frozen_string_literal: true
class Community < ApplicationRecord
include Deletable
include ExternalId
belongs_to :seller, class_name: "User"
belongs_to :resource, polymorphic: true
has_many :community_chat_messages, dependent: :destroy
has_many :last_read_community_chat_messages, dependent: :destroy
h... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/asset_preview.rb | Ruby | mit | 8,966 | main | 7,299 | # 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
# Update updated_... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/saint_lucia_bank_account.rb | Ruby | mit | 8,966 | main | 1,123 | # frozen_string_literal: true
class SaintLuciaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "LC"
BANK_CODE_FORMAT_REGEX = /^[a-zA-Z0-9]{8,11}$/
ACCOUNT_NUMBER_FORMAT_REGEX = /^[a-zA-Z0-9]{1,32}$/
private_constant :BANK_CODE_FORMAT_REGEX, :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute :bank_code, :bank_number... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/sendgrid_event_info.rb | Ruby | mit | 8,966 | main | 3,430 | # frozen_string_literal: true
class SendgridEventInfo < EmailEventInfo
attr_reader \
:charge_id, :click_url, :email, :event_json, :installment_id, :mailer_args, :mailer_class_and_method,
:mailer_class, :mailer_method, :purchase_id, :type, :created_at
def initialize(event_json)
@event_json = event_json... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/purchasing_power_parity_info.rb | Ruby | mit | 8,966 | main | 266 | # frozen_string_literal: true
class PurchasingPowerParityInfo < ApplicationRecord
belongs_to :purchase
validates :purchase, presence: true, uniqueness: true
def factor
super / 100.0
end
def factor=(new_factor)
super(new_factor * 100)
end
end |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/circle_integration.rb | Ruby | mit | 8,966 | main | 479 | # 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)
... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/license.rb | Ruby | mit | 8,966 | main | 1,743 | # frozen_string_literal: true
class License < ApplicationRecord
has_paper_trail only: %i[disabled_at serial]
include FlagShihTzu
include ExternalId
validates_numericality_of :uses, greater_than_or_equal_to: 0
validates_presence_of :serial
belongs_to :link, optional: true
belongs_to :purchase, optional... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/korea_bank_account.rb | Ruby | mit | 8,966 | main | 1,073 | # frozen_string_literal: true
class KoreaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "KR"
BANK_CODE_FORMAT_REGEX = /\A[A-Za-z]{4}KR[A-Za-z0-9]{2,5}\z/
private_constant :BANK_CODE_FORMAT_REGEX
ACCOUNT_NUMBER_FORMAT_REGEX = /\A[0-9]{11,15}\z/
private_constant :ACCOUNT_NUMBER_FORMAT_REGEX
alias_attribute... |
github | antiwork/gumroad | https://github.com/antiwork/gumroad | app/models/costa_rica_bank_account.rb | Ruby | mit | 8,966 | main | 690 | # frozen_string_literal: true
class CostaRicaBankAccount < BankAccount
BANK_ACCOUNT_TYPE = "CR"
validate :validate_account_number, if: -> { Rails.env.production? }
def bank_account_type
BANK_ACCOUNT_TYPE
end
def country
Compliance::Countries::CRI.alpha2
end
def currency
Currency::CRC
en... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.