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/services/onetime/deactivate_affiliates_for_stripe_connect_brazil.rb
app/services/onetime/deactivate_affiliates_for_stripe_connect_brazil.rb
# frozen_string_literal: true # This script deactivates affiliates for Stripe Connect accounts in Brazil module Onetime::DeactivateAffiliatesForStripeConnectBrazil extend self def process eligible_merchant_accounts.find_each do |merchant_account| process_merchant_account!(merchant_account) end end...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/onetime/enable_refund_policy_for_sellers_without_refund_policies.rb
app/services/onetime/enable_refund_policy_for_sellers_without_refund_policies.rb
# frozen_string_literal: true class Onetime::EnableRefundPolicyForSellersWithoutRefundPolicies < Onetime::Base LAST_PROCESSED_SELLER_ID_KEY = :last_processed_existing_seller_without_refund_policies_id def self.reset_last_processed_seller_id $redis.del(LAST_PROCESSED_SELLER_ID_KEY) end def initialize(max_...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/onetime/create_product_refund_policies_for_user.rb
app/services/onetime/create_product_refund_policies_for_user.rb
# frozen_string_literal: true class Onetime::CreateProductRefundPoliciesForUser attr_reader :user_id, :max_refund_period_in_days, :results def initialize(user_id:, max_refund_period_in_days: 0) @user_id = user_id @max_refund_period_in_days = max_refund_period_in_days @results = { success: [], errors: ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/onetime/add_new_vr_taxonomies.rb
app/services/onetime/add_new_vr_taxonomies.rb
# frozen_string_literal: true class Onetime::AddNewVrTaxonomies def self.process move_vr_chat_to_3d old_taxonomy_count = Taxonomy.count taxonomy_names.each do |taxonomy_name| ancestor_slugs = taxonomy_name.split(",") parent = Taxonomy.find_by!(slug: ancestor_slugs.second_to_last) Taxono...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/onetime/index_products_with_allowed_offer_codes.rb
app/services/onetime/index_products_with_allowed_offer_codes.rb
# frozen_string_literal: true class Onetime::IndexProductsWithAllowedOfferCodes def self.process allowed_codes = SearchProducts::ALLOWED_OFFER_CODES offer_codes = OfferCode.alive.where(code: allowed_codes) indexed_product_ids = Set.new batch_index = 0 offer_codes.find_each do |offer_code| ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/onetime/notify_sellers_with_refund_policies.rb
app/services/onetime/notify_sellers_with_refund_policies.rb
# frozen_string_literal: true class Onetime::NotifySellersWithRefundPolicies < Onetime::Base LAST_PROCESSED_ID_KEY = :last_notified_seller_for_refund_policy_id def self.reset_last_processed_seller_id $redis.del(LAST_PROCESSED_ID_KEY) end def initialize(max_id: ProductRefundPolicy.last!.id) @max_id = ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/onetime/remove_stale_recipients.rb
app/services/onetime/remove_stale_recipients.rb
# frozen_string_literal: true class Onetime::RemoveStaleRecipients def self.process # Process followers last_follower_id = $redis.get(last_follower_id_key)&.to_i || 0 Follower.alive.where("id > ?", last_follower_id).find_each do |follower| if EmailEvent.stale_recipient?(follower.email) foll...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/onetime/base.rb
app/services/onetime/base.rb
# frozen_string_literal: true # Usage: # # class Onetime::MyScript < Onetime::Base # def initialize(args) # @args = args # end # # def process # Rails.logger.info "I do great things" # end # end # # To execute without logging: # Onetime::MyScript.new(args).process # To execute with logging: # Onetime::...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/onetime/set_max_allowed_refund_period_for_purchase_refund_policies.rb
app/services/onetime/set_max_allowed_refund_period_for_purchase_refund_policies.rb
# frozen_string_literal: true class Onetime::SetMaxAllowedRefundPeriodForPurchaseRefundPolicies < Onetime::Base LAST_PROCESSED_ID_KEY = :last_processed_id def self.reset_last_processed_id $redis.del(LAST_PROCESSED_ID_KEY) end def initialize(max_id: PurchaseRefundPolicy.last!.id) @max_id = max_id en...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/onetime/assign_physical_product_types.rb
app/services/onetime/assign_physical_product_types.rb
# frozen_string_literal: true # This script updates products marked as `is_physical` with a `native_type` of "digital" to have a `native_type` of "physical" # # Steps: # 1. In Rails console: Onetime::AssignPhysicalProductTypes.process class Onetime::AssignPhysicalProductTypes def self.process invalid_products = ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/onetime/send_gumroad_day_fee_saved_email.rb
app/services/onetime/send_gumroad_day_fee_saved_email.rb
# frozen_string_literal: true class Onetime::SendGumroadDayFeeSavedEmail def self.process start_time = DateTime.new(2024, 4, 4, 0, 0, 0, "+14:00") end_time = DateTime.new(2024, 4, 5, 0, 0, 0, "-13:00") Purchase.joins(:seller) .non_free .not_recurring_charge .where(pur...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/onetime/disable_recurring_subscription_notifications.rb
app/services/onetime/disable_recurring_subscription_notifications.rb
# frozen_string_literal: true # One-time script to disable recurring subscription charge notifications # (both email and push) for existing users. # # Usage: # Onetime::DisableRecurringSubscriptionNotifications.process class Onetime::DisableRecurringSubscriptionNotifications def self.process updated_users = 0 ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/onetime/enable_refund_policy_for_sellers_with_refund_policies.rb
app/services/onetime/enable_refund_policy_for_sellers_with_refund_policies.rb
# frozen_string_literal: true # About 40K sellers out of 22M have product refund policies # class Onetime::EnableRefundPolicyForSellersWithRefundPolicies < Onetime::Base LAST_PROCESSED_ID_KEY = :last_processed_seller_for_refund_policy_id def self.reset_last_processed_seller_id $redis.del(LAST_PROCESSED_ID_KEY...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/onetime/backfill_user_tax_forms.rb
app/services/onetime/backfill_user_tax_forms.rb
# frozen_string_literal: true class Onetime::BackfillUserTaxForms def initialize(stripe_account_ids:, tax_year:, tax_form_type:) @stripe_account_ids = stripe_account_ids @tax_year = tax_year @tax_form_type = tax_form_type @results = { created: 0, skipped: 0, errors: {} } validate_inputs! end ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/onetime/revert_to_product_level_refund_policies.rb
app/services/onetime/revert_to_product_level_refund_policies.rb
# frozen_string_literal: true # Used to process select sellers manually # For the rest, we'll use `seller_refund_policy_disabled_for_all` feature flag to override User#refund_policy_enabled flag # class Onetime::RevertToProductLevelRefundPolicies < Onetime::Base LAST_PROCESSED_ID_KEY = :last_processed_seller_for_re...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/onetime/compile_gumroad_daily_analytics_from_beginning.rb
app/services/onetime/compile_gumroad_daily_analytics_from_beginning.rb
# frozen_string_literal: true class Onetime::CompileGumroadDailyAnalyticsFromBeginning def self.process start_date = GUMROAD_STARTED_DATE end_date = Date.today (start_date..end_date).each do |date| GumroadDailyAnalytic.import(date) end end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/onetime/set_max_allowed_refund_period_for_product_refund_policies.rb
app/services/onetime/set_max_allowed_refund_period_for_product_refund_policies.rb
# frozen_string_literal: true class Onetime::SetMaxAllowedRefundPeriodForProductRefundPolicies < Onetime::Base LAST_PROCESSED_ID_KEY = :last_processed_id def self.reset_last_processed_id $redis.del(LAST_PROCESSED_ID_KEY) end def initialize(max_id: ProductRefundPolicy.last!.id) @max_id = max_id end ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/onetime/email_creators_quarterly_recap.rb
app/services/onetime/email_creators_quarterly_recap.rb
# frozen_string_literal: true class Onetime::EmailCreatorsQuarterlyRecap DEFAULT_REPLY_TO_EMAIL = "Sahil Lavingia <sahil@gumroad.com>" MIN_QUARTER_SIZE_IN_DAYS = 85.days private_constant :MIN_QUARTER_SIZE_IN_DAYS attr_reader :installment_external_id, :start_time, :end_time, :reply_to, :skip_user_ids, :emaile...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/onetime/create_seller_refund_policies.rb
app/services/onetime/create_seller_refund_policies.rb
# frozen_string_literal: true class Onetime::CreateSellerRefundPolicies < Onetime::Base LAST_PROCESSED_SELLER_ID_KEY = :last_processed_seller_for_refund_policy_id def self.reset_last_processed_seller_id $redis.del(LAST_PROCESSED_SELLER_ID_KEY) end def initialize(max_id: User.last!.id) @max_id = max_i...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/product_review/update_service.rb
app/services/product_review/update_service.rb
# frozen_string_literal: true class ProductReview::UpdateService def initialize(product_review, rating:, message:, video_options: {}) @product_review = product_review @rating = rating @message = message @video_options = video_options.to_h.with_indifferent_access end def update @product_revie...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/purchase/create_bundle_product_purchase_service.rb
app/services/purchase/create_bundle_product_purchase_service.rb
# frozen_string_literal: true class Purchase::CreateBundleProductPurchaseService def initialize(purchase, bundle_product) @purchase = purchase @bundle_product = bundle_product end def perform product_purchase = Purchase.create!( link: @bundle_product.product, seller: @purchase.seller, ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/purchase/variant_updater_service.rb
app/services/purchase/variant_updater_service.rb
# frozen_string_literal: true class Purchase::VariantUpdaterService attr_reader :purchase, :variant_id, :new_variant, :product, :new_quantity def initialize(purchase:, variant_id:, quantity:) @purchase = purchase @variant_id = variant_id @new_quantity = quantity end def perform @product = pur...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/purchase/create_service.rb
app/services/purchase/create_service.rb
# frozen_string_literal: true class Purchase::CreateService < Purchase::BaseService include CurrencyHelper RESERVED_URL_PARAMETERS = %w[code wanted referrer email as_modal as_embed debug affiliate_id].freeze INVENTORY_LOCK_ACQUISITION_TIMEOUT = 50.seconds attr_reader :product, :params, :purchase_params, :gif...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/purchase/confirm_service.rb
app/services/purchase/confirm_service.rb
# frozen_string_literal: true # Finalizes the purchase once the charge has been confirmed by the user on the front-end. class Purchase::ConfirmService < Purchase::BaseService attr_reader :params def initialize(purchase:, params:) @purchase = purchase @preorder = purchase.preorder @params = params en...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/purchase/sync_status_with_charge_processor_service.rb
app/services/purchase/sync_status_with_charge_processor_service.rb
# frozen_string_literal: true # Syncs the purchase status with Stripe/PayPal class Purchase::SyncStatusWithChargeProcessorService attr_accessor :purchase, :mark_as_failed def initialize(purchase, mark_as_failed: false) @purchase = purchase @mark_as_failed = mark_as_failed end def perform return f...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/purchase/mark_successful_service.rb
app/services/purchase/mark_successful_service.rb
# frozen_string_literal: true # Transitions the purchase to successful state and marks linked items (subscription, gift, giftee purchase, preorder) as successful too. class Purchase::MarkSuccessfulService < Purchase::BaseService def initialize(purchase) @purchase = purchase @preorder = purchase.preorder en...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/purchase/associate_bundle_product_level_gift_service.rb
app/services/purchase/associate_bundle_product_level_gift_service.rb
# frozen_string_literal: true class Purchase::AssociateBundleProductLevelGiftService def initialize(bundle_purchase:, bundle_product:) @bundle_purchase = bundle_purchase @bundle_product = bundle_product end def perform return unless bundle_product_belongs_to_bundle? return if bundle_level_gift.b...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/purchase/mark_failed_service.rb
app/services/purchase/mark_failed_service.rb
# frozen_string_literal: true # Transitions the purchase to corresponding failed state and marks linked items (preorder, gift, giftee purchase) as failed, too. class Purchase::MarkFailedService < Purchase::BaseService def initialize(purchase) @purchase = purchase @preorder = purchase.preorder end def pe...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/purchase/base_service.rb
app/services/purchase/base_service.rb
# frozen_string_literal: true class Purchase::BaseService include AfterCommitEverywhere attr_accessor :purchase, :preorder protected def handle_purchase_success if purchase.free_purchase? && purchase.is_preorder_authorization? mark_preorder_authorized return end giftee_pur...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/purchase/update_bundle_purchase_content_service.rb
app/services/purchase/update_bundle_purchase_content_service.rb
# frozen_string_literal: true class Purchase::UpdateBundlePurchaseContentService def initialize(purchase) @purchase = purchase end def perform existing_product_purchases = @purchase.product_purchases.pluck(:created_at, :link_id) content_needed_after = existing_product_purchases.map(&:first).max ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/workflow/manage_service.rb
app/services/workflow/manage_service.rb
# frozen_string_literal: true class Workflow::ManageService include Rails.application.routes.url_helpers attr_reader :workflow, :error def initialize(seller:, params:, product:, workflow:) @seller = seller @params = params @product = product @workflow = workflow || build_workflow @error = n...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/workflow/save_installments_service.rb
app/services/workflow/save_installments_service.rb
# frozen_string_literal: true class Workflow::SaveInstallmentsService include InstallmentRuleHelper attr_reader :errors, :old_and_new_installment_id_mapping def initialize(seller:, params:, workflow:, preview_email_recipient:) @seller = seller @params = params @workflow = workflow @preview_emai...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/iffy/product/mark_compliant_service.rb
app/services/iffy/product/mark_compliant_service.rb
# frozen_string_literal: true class Iffy::Product::MarkCompliantService attr_reader :product def initialize(product_id) @product = Link.find_by_external_id!(product_id) end def perform product.update!(is_unpublished_by_admin: false) product.publish! end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/iffy/product/ingest_service.rb
app/services/iffy/product/ingest_service.rb
# frozen_string_literal: true class Iffy::Product::IngestService include SignedUrlHelper include Rails.application.routes.url_helpers URL = Rails.env.production? ? "https://api.iffy.com/api/v1/ingest" : "http://localhost:3000/api/v1/ingest" def initialize(product) @product = product end def perform ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/iffy/product/flag_service.rb
app/services/iffy/product/flag_service.rb
# frozen_string_literal: true class Iffy::Product::FlagService attr_reader :product def initialize(product_id) @product = Link.find_by_external_id!(product_id) end def perform product.unpublish!(is_unpublished_by_admin: true) end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/iffy/user/mark_compliant_service.rb
app/services/iffy/user/mark_compliant_service.rb
# frozen_string_literal: true class Iffy::User::MarkCompliantService attr_reader :user def initialize(user_id) @user = User.find_by_external_id!(user_id) end def perform user.mark_compliant!(author_name: "Iffy") end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/iffy/user/ban_service.rb
app/services/iffy/user/ban_service.rb
# frozen_string_literal: true class Iffy::User::BanService attr_reader :user def initialize(id) @user = User.find_by_external_id!(id) end def perform ActiveRecord::Base.transaction do reason = "Adult (18+) content" user.update!(tos_violation_reason: reason) comment_content = "Banned...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/iffy/user/suspend_service.rb
app/services/iffy/user/suspend_service.rb
# frozen_string_literal: true class Iffy::User::SuspendService attr_reader :user def initialize(id) @user = User.find_by_external_id!(id) end def perform return if !user.can_flag_for_tos_violation? ActiveRecord::Base.transaction do reason = "Adult (18+) content" user.update!(tos_viol...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/iffy/profile/ingest_service.rb
app/services/iffy/profile/ingest_service.rb
# frozen_string_literal: true class Iffy::Profile::IngestService include Rails.application.routes.url_helpers URL = Rails.env.production? ? "https://api.iffy.com/api/v1/ingest" : "http://localhost:3000/api/v1/ingest" TEST_MODE = Rails.env.test? def initialize(user) @user = user end def perform r...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/iffy/post/mark_compliant_service.rb
app/services/iffy/post/mark_compliant_service.rb
# frozen_string_literal: true class Iffy::Post::MarkCompliantService attr_reader :post def initialize(post_id) @post = Installment.find_by_external_id!(post_id) end def perform return unless !post.published? && post.is_unpublished_by_admin? post.is_unpublished_by_admin = false post.publish! ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/iffy/post/ingest_service.rb
app/services/iffy/post/ingest_service.rb
# frozen_string_literal: true class Iffy::Post::IngestService URL = Rails.env.production? ? "https://api.iffy.com/api/v1/ingest" : "http://localhost:3000/api/v1/ingest" def initialize(installment) @installment = installment end def perform iffy_api_request end private attr_reader :installmen...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/services/iffy/post/flag_service.rb
app/services/iffy/post/flag_service.rb
# frozen_string_literal: true class Iffy::Post::FlagService attr_reader :post def initialize(post_id) @post = Installment.find_by_external_id!(post_id) end def perform post.unpublish!(is_unpublished_by_admin: true) end end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/auth_presenter.rb
app/presenters/auth_presenter.rb
# frozen_string_literal: true class AuthPresenter attr_reader :params, :application def initialize(params:, application:) @params = params @application = application end def login_props { email: params[:email] || retrieve_team_invitation_email(params[:next]), application_name: applica...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/communities_presenter.rb
app/presenters/communities_presenter.rb
# frozen_string_literal: true class CommunitiesPresenter def initialize(current_user:) @current_user = current_user end def props communities = Community.where(id: current_user.accessible_communities_ids).includes(:resource, :seller) community_ids = communities.map(&:id) notification_settings = ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/workflow_presenter.rb
app/presenters/workflow_presenter.rb
# frozen_string_literal: true class WorkflowPresenter include Rails.application.routes.url_helpers include ApplicationHelper attr_reader :seller, :workflow def initialize(seller:, workflow: nil) @seller = seller @workflow = workflow end def new_page_react_props { context: workflow_form_conte...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/cart_presenter.rb
app/presenters/cart_presenter.rb
# frozen_string_literal: true class CartPresenter attr_reader :logged_in_user, :ip, :cart def initialize(logged_in_user:, ip:, browser_guid:) @logged_in_user = logged_in_user @ip = ip @cart = Cart.fetch_by(user: logged_in_user, browser_guid:) end def cart_props return if cart.nil? cart_p...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/customer_presenter.rb
app/presenters/customer_presenter.rb
# frozen_string_literal: true class CustomerPresenter attr_reader :purchase def initialize(purchase:) @purchase = purchase end def missed_posts posts = Installment.missed_for_purchase(purchase).order(published_at: :desc) posts.map do |post| { id: post.external_id, name: post...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/collab_products_page_presenter.rb
app/presenters/collab_products_page_presenter.rb
# frozen_string_literal: true class CollabProductsPagePresenter include ProductsHelper include Rails.application.routes.url_helpers PER_PAGE = 50 def initialize(pundit_user:, page: 1, sort_params: {}, query: nil) @pundit_user = pundit_user @page = page @sort_params = sort_params @query = quer...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/checkout_presenter.rb
app/presenters/checkout_presenter.rb
# frozen_string_literal: true class CheckoutPresenter include Rails.application.routes.url_helpers include ActionView::Helpers::SanitizeHelper include CardParamsHelper include ProductsHelper include CurrencyHelper include PreorderHelper include CardParamsHelper attr_reader :logged_in_user, :ip def ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/product_review_presenter.rb
app/presenters/product_review_presenter.rb
# frozen_string_literal: true class ProductReviewPresenter include ActionView::Helpers::DateHelper attr_reader :product_review def initialize(product_review) @product_review = product_review end def product_review_props purchase = product_review.purchase purchaser = purchase.purchaser { ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/paginated_product_posts_presenter.rb
app/presenters/paginated_product_posts_presenter.rb
# frozen_string_literal: true class PaginatedProductPostsPresenter include Pagy::Backend PER_PAGE = 10 private_constant :PER_PAGE def initialize(product:, variant_external_id:, options: {}) @product = product @variant_external_id = variant_external_id @options = options @page = [options[:page...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/profile_presenter.rb
app/presenters/profile_presenter.rb
# frozen_string_literal: true class ProfilePresenter attr_reader :pundit_user, :seller # seller is the profile being viewed within the consumer area # pundit_user.seller is the selected seller for the logged-in user (pundit_user.user) - which may be different from seller def initialize(pundit_user:, seller:) ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/product_review_video_presenter.rb
app/presenters/product_review_video_presenter.rb
# frozen_string_literal: true class ProductReviewVideoPresenter attr_reader :video def initialize(video) @video = video end def props(pundit_user:) { id: video.external_id, approval_status: video.approval_status, thumbnail_url: video.video_file.thumbnail_url, can_approve: Pund...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/community_chat_message_presenter.rb
app/presenters/community_chat_message_presenter.rb
# frozen_string_literal: true class CommunityChatMessagePresenter def initialize(message:) @message = message end def props { id: message.external_id, community_id: message.community.external_id, content: message.content, created_at: message.created_at.iso8601, updated_at: ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/tax_center_presenter.rb
app/presenters/tax_center_presenter.rb
# frozen_string_literal: true class TaxCenterPresenter include CurrencyHelper def initialize(seller:, year:) @seller = seller @year = available_years.include?(year) ? year : available_years.first end def props { documents: fetch_documents, available_years:, selected_year: year ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/payouts_presenter.rb
app/presenters/payouts_presenter.rb
# frozen_string_literal: true class PayoutsPresenter include CurrencyHelper include PayoutsHelper include Pagy::Backend PAST_PAYMENTS_PER_PAGE = 3 attr_reader :seller, :params def initialize(seller:, params: {}) @seller = seller @params = params end def past_payout_period_data past_payo...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/utm_link_presenter.rb
app/presenters/utm_link_presenter.rb
# frozen_string_literal: true class UtmLinkPresenter include CurrencyHelper def initialize(seller:, utm_link: nil) @seller = seller @utm_link = utm_link end def new_page_react_props(copy_from: nil) reference_utm_link = seller.utm_links.alive.find_by_external_id(copy_from) if copy_from.present? ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/product_presenter.rb
app/presenters/product_presenter.rb
# frozen_string_literal: true class ProductPresenter include Rails.application.routes.url_helpers include ProductsHelper include CurrencyHelper include PreorderHelper extend PreorderHelper attr_reader :product, :editing_page_id, :pundit_user, :request delegate :user, :skus, :skus_enabled, :...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/dashboard_products_page_presenter.rb
app/presenters/dashboard_products_page_presenter.rb
# frozen_string_literal: true class DashboardProductsPagePresenter include Product::Caching include ActionView::Helpers::NumberHelper include ActionView::Helpers::TextHelper include Rails.application.routes.url_helpers attr_reader :memberships, :memberships_pagination, :products, :products_pagination, :pund...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/public_file_presenter.rb
app/presenters/public_file_presenter.rb
# frozen_string_literal: true class PublicFilePresenter include CdnUrlHelper def initialize(public_file:) @public_file = public_file end def props { id: public_file.public_id, name: public_file.display_name, extension: public_file.file_type&.upcase, file_size: public_file.file...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/settings_presenter.rb
app/presenters/settings_presenter.rb
# frozen_string_literal: true class SettingsPresenter include CurrencyHelper include ActiveSupport::NumberHelper attr_reader :pundit_user, :seller ALL_PAGES = %w( main profile team payments authorized_applications password third_party_analytics advanced ).freeze private_c...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/paginated_installments_presenter.rb
app/presenters/paginated_installments_presenter.rb
# frozen_string_literal: true class PaginatedInstallmentsPresenter include Pagy::Backend PER_PAGE = 25 private_constant :PER_PAGE def initialize(seller:, type:, page: nil, query: nil) @type = type @seller = seller @page = [page.to_i, 1].max @query = query&.strip raise ArgumentError, "Inv...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/paginated_community_chat_messages_presenter.rb
app/presenters/paginated_community_chat_messages_presenter.rb
# frozen_string_literal: true class PaginatedCommunityChatMessagesPresenter include Pagy::Backend MESSAGES_PER_PAGE = 100 def initialize(community:, timestamp:, fetch_type:) @community = community @timestamp = timestamp @fetch_type = fetch_type raise ArgumentError, "Invalid timestamp" unless t...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/creator_home_presenter.rb
app/presenters/creator_home_presenter.rb
# frozen_string_literal: true class CreatorHomePresenter include CurrencyHelper ACTIVITY_ITEMS_LIMIT = 10 BALANCE_ITEMS_LIMIT = 3 attr_reader :pundit_user, :seller def initialize(pundit_user) @seller = pundit_user.seller @pundit_user = pundit_user end def creator_home_props has_sale = sel...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/subscriptions_presenter.rb
app/presenters/subscriptions_presenter.rb
# frozen_string_literal: true class SubscriptionsPresenter def initialize(subscription:) @subscription = subscription end def magic_link_props unique_emails = @subscription.emails.map do |source, email| { email: EmailRedactorService.redact(email), source: } unless email.nil? end.compact.uniq {...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/widget_presenter.rb
app/presenters/widget_presenter.rb
# frozen_string_literal: true class WidgetPresenter include Rails.application.routes.url_helpers attr_reader :seller, :product def initialize(seller:, product: nil) @seller = seller @product = product end def widget_props { display_product_select: user_signed_in? && product.blank?, ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/pagy_presenter.rb
app/presenters/pagy_presenter.rb
# frozen_string_literal: true class PagyPresenter attr_reader :pagy def initialize(pagy) @pagy = pagy end def props { pages: pagy.last, page: pagy.page } end def metadata { count: pagy.count, items: pagy.limit, page: pagy.page, pages: pagy.pages, prev: pagy.prev...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/paginated_comments_presenter.rb
app/presenters/paginated_comments_presenter.rb
# frozen_string_literal: true require "pagy/extras/standalone" class PaginatedCommentsPresenter include Pagy::Backend COMMENTS_PER_PAGE = 20 attr_reader :commentable, :pundit_user, :purchase, :options, :page def initialize(pundit_user:, commentable:, purchase:, options: {}) @pundit_user = pundit_user ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/affiliates_presenter.rb
app/presenters/affiliates_presenter.rb
# frozen_string_literal: true require "pagy/extras/standalone" class AffiliatesPresenter include Rails.application.routes.url_helpers include Pagy::Backend PER_PAGE = 100 def initialize(pundit_user, query: nil, page: nil, sort: nil, should_get_affiliate_requests: false) @pundit_user = pundit_user @s...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/installment_presenter.rb
app/presenters/installment_presenter.rb
# frozen_string_literal: true class InstallmentPresenter include ActionView::Helpers::NumberHelper include ActionView::Helpers::TextHelper include ApplicationHelper attr_reader :installment, :seller, :from_tab def initialize(seller:, installment: nil, from_tab: nil) @seller = seller @installment = ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/wishlist_presenter.rb
app/presenters/wishlist_presenter.rb
# frozen_string_literal: true class WishlistPresenter include Rails.application.routes.url_helpers include Pagy::Backend attr_reader :wishlist PER_PAGE = 20 private_constant :PER_PAGE def initialize(wishlist:) @wishlist = wishlist end def self.library_props(wishlists:, is_wishlist_creator: true...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/paginated_utm_links_presenter.rb
app/presenters/paginated_utm_links_presenter.rb
# frozen_string_literal: true class PaginatedUtmLinksPresenter include Pagy::Backend PER_PAGE = 100 SORT_KEY_TO_COLUMN_MAP = { "link" => "title", "date" => "created_at", "source" => "utm_source", "medium" => "utm_medium", "campaign" => "utm_campaign", "clicks" => "unique_clicks", "sa...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/customers_presenter.rb
app/presenters/customers_presenter.rb
# frozen_string_literal: true class CustomersPresenter attr_reader :pundit_user, :customers, :pagination, :product, :count def initialize(pundit_user:, customers: [], pagination: nil, product: nil, count: 0) @pundit_user = pundit_user @customers = customers @pagination = pagination @product = prod...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/library_presenter.rb
app/presenters/library_presenter.rb
# frozen_string_literal: true class LibraryPresenter include Rails.application.routes.url_helpers attr_reader :logged_in_user def initialize(logged_in_user) @logged_in_user = logged_in_user end def library_cards purchases = logged_in_user.purchases .for_library .not_rental_expired ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/community_presenter.rb
app/presenters/community_presenter.rb
# frozen_string_literal: true class CommunityPresenter def initialize(community:, current_user:, extras: {}) @community = community @current_user = current_user @extras = extras end def props { id: community.external_id, name: community.name, thumbnail_url: community.thumbnail_...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/analytics_presenter.rb
app/presenters/analytics_presenter.rb
# frozen_string_literal: true class AnalyticsPresenter def initialize(seller:) @seller = seller end def page_props { products: seller.products_for_creator_analytics.map { product_props(_1) }, country_codes: Compliance::Countries.mapping.invert, state_names: STATES_SUPPORTED_BY_ANALYTIC...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/user_presenter.rb
app/presenters/user_presenter.rb
# frozen_string_literal: true class UserPresenter include Rails.application.routes.url_helpers attr_reader :user def initialize(user:) @user = user end def audience_count = user.audience_members.count def audience_types result = [] result << :customers if user.audience_members.where(custome...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/profile_sections_presenter.rb
app/presenters/profile_sections_presenter.rb
# frozen_string_literal: true class ProfileSectionsPresenter include SearchProducts CACHE_KEY_PREFIX = "profile-sections" # seller is the owner of the section # pundit_user.seller is the selected seller for the logged-in user (pundit_user.user) - which may be different from seller def initialize(seller:, q...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/dispute_evidence_page_presenter.rb
app/presenters/dispute_evidence_page_presenter.rb
# frozen_string_literal: true class DisputeEvidencePagePresenter def initialize(dispute_evidence) @dispute_evidence = dispute_evidence @purchase = @dispute_evidence.disputable.purchase_for_dispute_evidence @purchase_product_presenter = PurchaseProductPresenter.new(@purchase) end def react_props ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/purchase_product_presenter.rb
app/presenters/purchase_product_presenter.rb
# frozen_string_literal: true # Used to generate the product page for a purchase (e.g. /purchases/:id/product) # for fighting chargebacks # Similar with app/presenters/product_presenter.rb # Attempts to retrieve the product description, refund policy, and pricing, at the # time of purchase, via versioning # class Purc...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/workflows_presenter.rb
app/presenters/workflows_presenter.rb
# frozen_string_literal: true class WorkflowsPresenter def initialize(seller:) @seller = seller end def workflows_props { workflows: seller.workflows.alive.order("created_at DESC").map do |workflow| WorkflowPresenter.new(seller:, workflow:).workflow_props end } end private ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/url_redirect_presenter.rb
app/presenters/url_redirect_presenter.rb
# frozen_string_literal: true class UrlRedirectPresenter include Rails.application.routes.url_helpers include ProductsHelper include ActionView::Helpers::TextHelper CONTENT_UNAVAILABILITY_REASON_CODES = { inactive_membership: "inactive_membership", rental_expired: "rental_expired", access_expired:...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/receipt_presenter.rb
app/presenters/receipt_presenter.rb
# frozen_string_literal: true class ReceiptPresenter attr_reader :for_email # chargeable is either a Purchase or a Charge def initialize(chargeable, for_email:) @for_email = for_email @chargeable = chargeable end def charge_info @_charge_info ||= ReceiptPresenter::ChargeInfo.new( chargeab...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/comment_presenter.rb
app/presenters/comment_presenter.rb
# frozen_string_literal: true class CommentPresenter include UsersHelper include ActionView::Helpers::DateHelper attr_reader :comment, :pundit_user, :purchase delegate :author, to: :comment, allow_nil: true def initialize(pundit_user:, comment:, purchase:) @pundit_user = pundit_user @comment = comm...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/affiliated_products_presenter.rb
app/presenters/affiliated_products_presenter.rb
# frozen_string_literal: true require "pagy/extras/standalone" require "pagy/extras/arel" class AffiliatedProductsPresenter include Pagy::Backend PER_PAGE = 20 def initialize(user, query: nil, page: nil, sort: nil) @user = user @query = query.presence @page = page @sort = sort end def aff...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/reviews_presenter.rb
app/presenters/reviews_presenter.rb
# frozen_string_literal: true class ReviewsPresenter attr_reader :user def initialize(user) @user = user end def reviews_props { reviews: user.product_reviews.includes(:editable_video).map do |review| product = review.link ProductReviewPresenter.new(review).review_form_props.mer...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/mobile_tracking_presenter.rb
app/presenters/mobile_tracking_presenter.rb
# frozen_string_literal: true class MobileTrackingPresenter include UsersHelper attr_reader :seller def initialize(seller:) @seller = seller end def product_props(product:) { enabled: is_third_party_analytics_enabled?(seller:, logged_in_seller: nil), seller_id: seller.external_id, ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/collaborators_presenter.rb
app/presenters/collaborators_presenter.rb
# frozen_string_literal: true class CollaboratorsPresenter def initialize(seller:) @seller = seller end def index_props { collaborators: seller.collaborators.alive.map do CollaboratorPresenter.new(seller:, collaborator: _1).collaborator_props end, collaborators_disabled_reason:...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/community_notification_setting_presenter.rb
app/presenters/community_notification_setting_presenter.rb
# frozen_string_literal: true class CommunityNotificationSettingPresenter def initialize(settings:) @settings = settings end def props { recap_frequency: settings.recap_frequency } end private attr_reader :settings end
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/bundle_presenter.rb
app/presenters/bundle_presenter.rb
# frozen_string_literal: true class BundlePresenter include Rails.application.routes.url_helpers attr_reader :bundle def initialize(bundle:) @bundle = bundle end def bundle_props refund_policy = bundle.find_or_initialize_product_refund_policy profile_sections = bundle.user.seller_profile_produ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/collaborator_presenter.rb
app/presenters/collaborator_presenter.rb
# frozen_string_literal: true class CollaboratorPresenter def initialize(seller:, collaborator: nil) @seller = seller @collaborator = collaborator end def new_collaborator_props { products: all_products, collaborators_disabled_reason: seller.has_brazilian_stripe_connect_account? ? "Colla...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/invoice_presenter.rb
app/presenters/invoice_presenter.rb
# frozen_string_literal: true class InvoicePresenter def initialize(chargeable, address_fields: {}, additional_notes: nil, business_vat_id: nil) @chargeable = chargeable @address_fields = address_fields @additional_notes = additional_notes @business_vat_id = business_vat_id end def invoice_gener...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/user_memberships_presenter.rb
app/presenters/user_memberships_presenter.rb
# frozen_string_literal: true class UserMembershipsPresenter class OwnerTeamMembershipRecordMissingError < StandardError; end attr_reader :pundit_user def initialize(pundit_user:) @pundit_user = pundit_user end def props user_memberships = pundit_user.user.user_memberships_not_deleted_and_ordered ...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/post_presenter.rb
app/presenters/post_presenter.rb
# frozen_string_literal: true class PostPresenter include UsersHelper RECENT_UPDATES_LIMIT = 5 delegate :link, :seller, :id, :message, to: :post, allow_nil: true attr_reader :post, :purchase, :pundit_user, :purchase_id_param, :visible_posts def initialize(pundit_user:, post:, purchase_id_param:) @pundi...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/utm_links_stats_presenter.rb
app/presenters/utm_links_stats_presenter.rb
# frozen_string_literal: true class UtmLinksStatsPresenter def initialize(seller:, utm_link_ids:) @seller = seller @utm_link_ids = utm_link_ids end def props utm_links = seller.utm_links.select(%( utm_links.id, COUNT(purchases.id) AS sales_count, COALESCE(SUM(purchases.price_cents)...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/settings/team_presenter.rb
app/presenters/settings/team_presenter.rb
# frozen_string_literal: true class Settings::TeamPresenter attr_reader :pundit_user TYPES = %w(owner membership invitation) TYPES.each do |type| self.const_set("TYPE_#{type.upcase}", type) end def initialize(pundit_user:) @pundit_user = pundit_user end def member_infos infos = [MemberInfo...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/settings/team_presenter/member_info.rb
app/presenters/settings/team_presenter/member_info.rb
# frozen_string_literal: true class Settings::TeamPresenter::MemberInfo TYPES = %w(owner membership invitation) TYPES.each do |type| self.const_set("TYPE_#{type.upcase}", type) end class << self def build_membership_info(pundit_user:, team_membership:) MembershipInfo.new(pundit_user:, team_membe...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/settings/team_presenter/member_info/invitation_info.rb
app/presenters/settings/team_presenter/member_info/invitation_info.rb
# frozen_string_literal: true class Settings::TeamPresenter::MemberInfo::InvitationInfo < Settings::TeamPresenter::MemberInfo attr_reader :pundit_user, :team_invitation def initialize(pundit_user:, team_invitation:) @pundit_user = pundit_user @team_invitation = team_invitation end def to_hash cur...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/settings/team_presenter/member_info/owner_info.rb
app/presenters/settings/team_presenter/member_info/owner_info.rb
# frozen_string_literal: true class Settings::TeamPresenter::MemberInfo::OwnerInfo < Settings::TeamPresenter::MemberInfo attr_reader :user def initialize(user) @user = user end def to_hash role = TeamMembership::ROLE_OWNER { type: Settings::TeamPresenter::MemberInfo::TYPE_OWNER, id: u...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false
antiwork/gumroad
https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/settings/team_presenter/member_info/membership_info.rb
app/presenters/settings/team_presenter/member_info/membership_info.rb
# frozen_string_literal: true class Settings::TeamPresenter::MemberInfo::MembershipInfo < Settings::TeamPresenter::MemberInfo attr_reader :pundit_user, :team_membership def initialize(pundit_user:, team_membership:) @pundit_user = pundit_user @team_membership = team_membership end def to_hash use...
ruby
MIT
638f6c3a40b23b907c09f6881d4df18339da069c
2026-01-04T15:39:11.815677Z
false