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/modules/user_compliance_info/business_types.rb
Ruby
mit
8,966
main
1,817
# frozen_string_literal: true module UserComplianceInfo::BusinessTypes LLC = "llc" PARTNERSHIP = "partnership" NON_PROFIT = "profit" REGISTERED_CHARITY = "registered_charity" SOLE_PROPRIETORSHIP = "sole_proprietorship" CORPORATION = "corporation" def self.all [ LLC, PARTNERSHIP, NO...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/modules/shipping_destination/destinations.rb
Ruby
mit
8,966
main
2,361
# frozen_string_literal: true module ShippingDestination::Destinations # constant referring to all other countries ELSEWHERE = "ELSEWHERE" # constants for virtual countries EUROPE = "EUROPE" ASIA = "ASIA" NORTH_AMERICA = "NORTH AMERICA" VIRTUAL_COUNTRY_CODES = [EUROPE, ASIA, NORTH_AMERICA].freeze def ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/modules/subscription/ping_notification.rb
Ruby
mit
8,966
main
1,543
# frozen_string_literal: true module Subscription::PingNotification def payload_for_ping_notification(resource_name: nil, additional_params: {}) payload = { subscription_id: external_id, product_id: link.external_id, product_name: link.name, user_id: user.try(:external_id), user_ema...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/modules/subscription/restartable.rb
Ruby
mit
8,966
main
1,619
# frozen_string_literal: true module Subscription::Restartable def restartable_for_product_and_buyer(product:, buyer:) return nil unless product.is_recurring_billing where(link_id: product.id) .where(ended_at: nil) .where(user_id: buyer.id) .where.not(deactivated_at: nil) .not_is_tes...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/modules/post/caching.rb
Ruby
mit
8,966
main
200
# frozen_string_literal: true module Post::Caching def key_for_cache(key) "#{key}_for_installment_#{id}" end def invalidate_cache(key) Rails.cache.delete(key_for_cache(key)) end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/modules/variant/prices.rb
Ruby
mit
8,966
main
1,552
# frozen_string_literal: true module Variant::Prices include BasePrice::Shared delegate :price_currency_type, :single_unit_currency?, :enqueue_index_update_for, to: :link def save_recurring_prices!(recurrence_price_values) ActiveRecord::Base.transaction do super(recurrence_price...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/modules/recurring_service/tiers.rb
Ruby
mit
8,966
main
525
# frozen_string_literal: true module RecurringService::Tiers include ActionView::Helpers::NumberHelper def monthly_tier_amount(customer_count) case customer_count when 0..999 10 when 1000..1999 25 when 2000..4999 50 when 5000..9999 75 when 10_000..14_999 100 ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/modules/recurring_service/recurrence.rb
Ruby
mit
8,966
main
295
# frozen_string_literal: true module RecurringService::Recurrence def recurrence_indicator { monthly: " a month", yearly: " a year" }[recurrence.to_sym] end def recurrence_duration { monthly: 1.month, yearly: 1.year }[recurrence.to_sym] end end
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/tax_center_presenter.rb
Ruby
mit
8,966
main
2,704
# 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 ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/utm_link_presenter.rb
Ruby
mit
8,966
main
4,520
# 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? ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/paginated_community_chat_messages_presenter.rb
Ruby
mit
8,966
main
2,600
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/analytics_presenter.rb
Ruby
mit
8,966
main
624
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/product_presenter.rb
Ruby
mit
8,966
main
15,814
# 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, :ai_generated delegate :user, :skus, :...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/affiliates_presenter.rb
Ruby
mit
8,966
main
4,260
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/help_center_presenter.rb
Ruby
mit
8,966
main
1,716
# frozen_string_literal: true class HelpCenterPresenter attr_reader :view_context def initialize(view_context:) @view_context = view_context end def default_url_options { host: DOMAIN, protocol: PROTOCOL } end def index_props { categories: categories_with_articles } end def ar...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/payouts_presenter.rb
Ruby
mit
8,966
main
2,341
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/url_redirect_presenter.rb
Ruby
mit
8,966
main
13,257
# 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:...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/community_chat_message_presenter.rb
Ruby
mit
8,966
main
612
# 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: ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/bundle_presenter.rb
Ruby
mit
8,966
main
5,656
# frozen_string_literal: true class BundlePresenter include Rails.application.routes.url_helpers attr_reader :bundle def initialize(bundle:) @bundle = bundle end def edit_product_props shared_props.merge( currency_type: bundle.price_currency_type, thumbnail: bundle.thumbnail&.alive&.as...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/dashboard_products_page_presenter.rb
Ruby
mit
8,966
main
6,143
# frozen_string_literal: true class DashboardProductsPagePresenter include Product::Caching include ProductsHelper include ActionView::Helpers::NumberHelper include ActionView::Helpers::TextHelper include Rails.application.routes.url_helpers PER_PAGE = 50 attr_reader :products_sort, :memberships_sort, ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/paginated_installments_presenter.rb
Ruby
mit
8,966
main
1,908
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/product_review_presenter.rb
Ruby
mit
8,966
main
1,467
# 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 { ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/paginated_utm_links_presenter.rb
Ruby
mit
8,966
main
2,329
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/community_notification_setting_presenter.rb
Ruby
mit
8,966
main
244
# 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
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/creator_home_presenter.rb
Ruby
mit
8,966
main
7,078
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/reviews_presenter.rb
Ruby
mit
8,966
main
1,435
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/settings_presenter.rb
Ruby
mit
8,966
main
26,712
# frozen_string_literal: true class SettingsPresenter include CurrencyHelper include ActiveSupport::NumberHelper include Rails.application.routes.url_helpers attr_reader :pundit_user, :seller ALL_PAGES = %w( main profile team payments billing authorized_applications password ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/pagy_presenter.rb
Ruby
mit
8,966
main
383
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/public_file_presenter.rb
Ruby
mit
8,966
main
502
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/affiliated_products_presenter.rb
Ruby
mit
8,966
main
4,525
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/customer_presenter.rb
Ruby
mit
8,966
main
7,674
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/auth_presenter.rb
Ruby
mit
8,966
main
1,321
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/utm_links_stats_presenter.rb
Ruby
mit
8,966
main
972
# 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)...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/library_presenter.rb
Ruby
mit
8,966
main
3,188
# 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 ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/post_presenter.rb
Ruby
mit
8,966
main
3,678
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/communities_presenter.rb
Ruby
mit
8,966
main
3,568
# frozen_string_literal: true class CommunitiesPresenter def initialize(current_user:) @current_user = current_user end def props { has_products: has_products?, communities: communities_props, notification_settings: notification_settings_props } end def has_products? curre...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/customers_presenter.rb
Ruby
mit
8,966
main
1,407
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/product_review_video_presenter.rb
Ruby
mit
8,966
main
439
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/collaborators_presenter.rb
Ruby
mit
8,966
main
407
# frozen_string_literal: true class CollaboratorsPresenter def initialize(seller:) @seller = seller end def index_props { collaborators: @seller.collaborators.alive.includes(:collaborator_invitation).map { CollaboratorPresenter.new(seller: @seller, collaborator: _1).collaborator_props }, has...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/paginated_product_posts_presenter.rb
Ruby
mit
8,966
main
1,131
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/collaborator_presenter.rb
Ruby
mit
8,966
main
4,163
# frozen_string_literal: true class CollaboratorPresenter def initialize(seller:, collaborator: nil) @seller = seller @collaborator = collaborator end DEFAULT_PERCENT_COMMISSION = 50 MAX_PRODUCTS_WITH_AFFILIATES_TO_SHOW = 10 def new_collaborator_props collaborator_form_props.compact end de...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/incoming_collaborators_presenter.rb
Ruby
mit
8,966
main
762
# frozen_string_literal: true class IncomingCollaboratorsPresenter def initialize(seller:) @seller = seller end def index_props { collaborators: scoped_and_sorted_incoming_collaborators.map { CollaboratorPresenter.new(seller:).incoming_collaborator_props(_1) }, } end private attr_read...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/comment_presenter.rb
Ruby
mit
8,966
main
1,477
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/widget_presenter.rb
Ruby
mit
8,966
main
2,515
# 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?, ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/receipt_presenter.rb
Ruby
mit
8,966
main
1,253
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/user_presenter.rb
Ruby
mit
8,966
main
1,945
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/cart_presenter.rb
Ruby
mit
8,966
main
3,010
# frozen_string_literal: true class CartPresenter attr_reader :logged_in_user, :ip, :cart, :checkout_presenter 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:) @checkout_presenter = CheckoutPres...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/wishlist_presenter.rb
Ruby
mit
8,966
main
6,526
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/dispute_evidence_page_presenter.rb
Ruby
mit
8,966
main
2,372
# 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 props { ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/installment_presenter.rb
Ruby
mit
8,966
main
6,158
# 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 = ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/user_memberships_presenter.rb
Ruby
mit
8,966
main
1,875
# 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 ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/paginated_comments_presenter.rb
Ruby
mit
8,966
main
1,282
# 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 ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/rendering_extension.rb
Ruby
mit
8,966
main
4,773
# frozen_string_literal: true module RenderingExtension extend self def custom_context(view_context) pundit_user = view_context.pundit_user { design_settings: { font: { name: "ABC Favorit", url: view_context.font_url("ABCFavorit-Regular.woff2") } }, domain_settings: { scheme: PROTOCOL,...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/invoice_presenter.rb
Ruby
mit
8,966
main
2,088
# frozen_string_literal: true class InvoicePresenter def initialize(chargeable, address_fields: {}, additional_notes: nil, business_vat_id: nil, business_vat_id_country_code: nil, business_name: nil, buyer: nil, show_reverse_charge_note: nil) @chargeable = chargeable @address_fields = address_fields @add...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/collab_products_page_presenter.rb
Ruby
mit
8,966
main
4,131
# frozen_string_literal: true class CollabProductsPagePresenter include ProductsHelper include Rails.application.routes.url_helpers PER_PAGE = 50 attr_reader :products_sort, :memberships_sort def initialize(pundit_user:, products_page: 1, memberships_page: 1, products_sort: nil, memberships_sort: nil, que...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/community_presenter.rb
Ruby
mit
8,966
main
1,250
# 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_...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/workflow_presenter.rb
Ruby
mit
8,966
main
3,616
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/mobile_tracking_presenter.rb
Ruby
mit
8,966
main
601
# frozen_string_literal: true class MobileTrackingPresenter include UsersHelper attr_reader :seller def initialize(seller:) @seller = seller end def product_props(product:) { seller_id: seller.external_id, analytics: product.analytics_data, has_product_third_party_analytics: prod...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/purchase_product_presenter.rb
Ruby
mit
8,966
main
4,818
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/workflows_presenter.rb
Ruby
mit
8,966
main
347
# 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 ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/checkout_presenter.rb
Ruby
mit
8,966
main
16,450
# frozen_string_literal: true class CheckoutPresenter CART_SAVE_DEBOUNCE_DURATION_IN_SECONDS = 0.1.seconds include Rails.application.routes.url_helpers include ActionView::Helpers::SanitizeHelper include CardParamsHelper include ProductsHelper include CurrencyHelper include PreorderHelper include Card...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/profile_presenter.rb
Ruby
mit
8,966
main
2,148
# 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:) ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/profile_sections_presenter.rb
Ruby
mit
8,966
main
6,217
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/products/available_offer_codes_presenter.rb
Ruby
mit
8,966
main
500
# frozen_string_literal: true class Products::AvailableOfferCodesPresenter attr_reader :offer_codes def initialize(offer_codes: []) @offer_codes = offer_codes end def offer_codes_props offer_codes.map { |offer_code| offer_code_props(offer_code) } end private def offer_code_props(offer_code) ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/product_presenter/product_props.rb
Ruby
mit
8,966
main
7,596
# frozen_string_literal: true class ProductPresenter::ProductProps include Rails.application.routes.url_helpers include ProductsHelper SALES_COUNT_CACHE_KEY_REFIX = "product-presenter:sales-count-cache" SALES_COUNT_CACHE_METRICS_KEY = "#{SALES_COUNT_CACHE_KEY_REFIX}-metrics" def initialize(product:) @p...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/product_presenter/installment_plan_props.rb
Ruby
mit
8,966
main
677
# frozen_string_literal: true class ProductPresenter::InstallmentPlanProps attr_reader :product, :installment_plan def initialize(product:) @product = product @installment_plan = product.installment_plan end def props { eligible_for_installment_plans: product.eligible_for_installment_plans?...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/product_presenter/card.rb
Ruby
mit
8,966
main
2,944
# frozen_string_literal: true class ProductPresenter::Card include Rails.application.routes.url_helpers include ProductsHelper ASSOCIATIONS = [ :alive_prices, :product_review_stat, :tiers, :variant_categories_alive, :default_offer_code, { user: [:avatar_attachment, :avatar_blob], thumbnail_a...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/invoice_presenter/supplier_info.rb
Ruby
mit
8,966
main
4,107
# frozen_string_literal: true class InvoicePresenter::SupplierInfo include ActionView::Helpers::TextHelper def initialize(chargeable) @chargeable = chargeable @seller = chargeable.seller end def heading "Supplier" end def attributes gumroad_attributes end private attr_reader :ch...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/invoice_presenter/order_info.rb
Ruby
mit
8,966
main
8,613
# frozen_string_literal: true class InvoicePresenter::OrderInfo include ActionView::Helpers::TextHelper include CurrencyHelper attr_reader :charge_info def initialize(chargeable, address_fields:, additional_notes:, business_vat_id:, business_vat_id_country_code: nil, business_name: nil, show_reverse_charge_n...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/invoice_presenter/seller_info.rb
Ruby
mit
8,966
main
758
# frozen_string_literal: true class InvoicePresenter::SellerInfo include ActionView::Helpers::TextHelper def initialize(chargeable) @chargeable = chargeable @seller = chargeable.seller end def heading "Creator" end def attributes seller_attributes end private attr_reader :charge...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/invoice_presenter/form_info.rb
Ruby
mit
8,966
main
2,456
# frozen_string_literal: true class InvoicePresenter::FormInfo BUSINESS_ID_LABELS = BusinessIdLabels::LABELS BUSINESS_ID_COUNTRY_CODES = BusinessIdLabels::COUNTRY_CODES def initialize(chargeable, buyer: nil) @chargeable = chargeable @buyer = buyer end def heading chargeable.is_direct_to_austral...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/settings/team_presenter.rb
Ruby
mit
8,966
main
1,322
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/settings/team_presenter/member_info.rb
Ruby
mit
8,966
main
1,037
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/settings/team_presenter/member_info/invitation_info.rb
Ruby
mit
8,966
main
1,688
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/settings/team_presenter/member_info/owner_info.rb
Ruby
mit
8,966
main
644
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/settings/team_presenter/member_info/membership_info.rb
Ruby
mit
8,966
main
1,672
# 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...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/discover/taxonomy_presenter.rb
Ruby
mit
8,966
main
12,200
# frozen_string_literal: true class Discover::TaxonomyPresenter TAXONOMY_LABELS = { "3d" => "3D", "3d-assets" => "3D Assets", "3d-icons" => "3D Icons", "3d-modeling" => "3D Modeling", "3d-printing" => "3D Printing", "3dsmax" => "3ds Max", "ableton-live" => "Ableton Live", "accessories...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/discover/autocomplete_presenter.rb
Ruby
mit
8,966
main
2,444
# frozen_string_literal: true class Discover::AutocompletePresenter RECENT_SEARCH_LIMIT = 100 PRODUCT_RESULT_COUNT = 5 def initialize(query:, user:, browser_guid:) @query = query.to_s.downcase @user = user @browser_guid = browser_guid end def props { recent_searches: }.merge(product_results...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/discover/tag_page_meta_presenter.rb
Ruby
mit
8,966
main
1,346
# frozen_string_literal: true class Discover::TagPageMetaPresenter include ActionView::Helpers::NumberHelper attr_reader :tags, :result_count def initialize(tags, result_count) @tags = tags @result_count = result_count end def title default_tag_title = fetch_discover_meta("titles.default", tag...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/discover/canonical_url_presenter.rb
Ruby
mit
8,966
main
813
# frozen_string_literal: true class Discover::CanonicalUrlPresenter def self.canonical_url(params) if params.values_at(:taxonomy, :query, :tags).all?(&:blank?) return UrlService.discover_full_path("/") end path = params[:taxonomy] || "/" valid_canonical_params = params.permit(:sort, :query, :m...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/post/social_image.rb
Ruby
mit
8,966
main
579
# frozen_string_literal: true class Post::SocialImage class << self alias_method :for, :new end def initialize(content) @content = content end def url first_figure_with_image&.at("img")&.attr("src") end def caption first_figure_with_image&.at(".figcaption")&.text end def blank? ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/subscriptions/magic_link_presenter.rb
Ruby
mit
8,966
main
569
# frozen_string_literal: true class Subscriptions::MagicLinkPresenter 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.com...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/checkout/form_presenter.rb
Ruby
mit
8,966
main
1,103
# frozen_string_literal: true class Checkout::FormPresenter include CheckoutDashboardHelper attr_reader :pundit_user def initialize(pundit_user:) @pundit_user = pundit_user end def form_props seller = pundit_user.seller products = seller.products.visible.order(created_at: :desc).to_a cart_...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/checkout/upsells_presenter.rb
Ruby
mit
8,966
main
941
# frozen_string_literal: true class Checkout::UpsellsPresenter include CheckoutDashboardHelper attr_reader :pundit_user, :upsells, :pagination def initialize(pundit_user:, upsells:, pagination:) @pundit_user = pundit_user @upsells = upsells @pagination = pagination end def upsells_props { ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/checkout/discounts_presenter.rb
Ruby
mit
8,966
main
2,318
# frozen_string_literal: true class Checkout::DiscountsPresenter include CheckoutDashboardHelper BLACK_FRIDAY_CODE_NAME = "Black Friday 2025" attr_reader :pundit_user, :offer_codes, :pagination def initialize(pundit_user:, offer_codes: [], pagination: nil) @pundit_user = pundit_user @offer_codes = o...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/checkout/upsells/product_presenter.rb
Ruby
mit
8,966
main
619
# frozen_string_literal: true class Checkout::Upsells::ProductPresenter def initialize(product) @product = product end def product_props { id: product.external_id, permalink: product.unique_permalink, name: product.name, price_cents: product.price_cents, currency_code: prod...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/receipt_presenter/mail_subject.rb
Ruby
mit
8,966
main
2,111
# frozen_string_literal: true class ReceiptPresenter::MailSubject PRODUCT_NAME_CHARACTER_LIMIT = 27 def self.build(chargeable) new(chargeable).build end def initialize(chargeable) @chargeable = chargeable @purchases = chargeable.unbundled_purchases end def build if purchases.one? b...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/receipt_presenter/item_info.rb
Ruby
mit
8,966
main
8,411
# frozen_string_literal: true class ReceiptPresenter::ItemInfo include ActionView::Helpers::TextHelper include ActionView::Helpers::UrlHelper include CurrencyHelper include PreorderHelper include ProductsHelper include BasePrice::Recurrence attr_reader :product, :purchase def initialize(purchase) ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/receipt_presenter/giftee_manage_subscription.rb
Ruby
mit
8,966
main
1,144
# frozen_string_literal: true class ReceiptPresenter::GifteeManageSubscription include ActionView::Helpers::UrlHelper include BasePrice::Recurrence def initialize(chargeable) @chargeable = chargeable end def note @_note ||= begin return unless gifted_subscription? # Get the subscriptio...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/receipt_presenter/footer_info.rb
Ruby
mit
8,966
main
1,422
# frozen_string_literal: true class ReceiptPresenter::FooterInfo include ActionView::Helpers::UrlHelper include MailerHelper include BasePrice::Recurrence def initialize(chargeable) @chargeable = chargeable end def can_manage_subscription? return false unless chargeable.is_a?(Purchase) && chargea...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/receipt_presenter/recommended_products_info.rb
Ruby
mit
8,966
main
1,557
# frozen_string_literal: true class ReceiptPresenter::RecommendedProductsInfo # It should match the value from ApplicationController#set_recommender_model_name MODEL = RecommendedProductsService::MODELS.sample def initialize(chargeable) @chargeable = chargeable @purchaser = chargeable.purchaser end ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/receipt_presenter/charge_info.rb
Ruby
mit
8,966
main
1,199
# frozen_string_literal: true class ReceiptPresenter::ChargeInfo include ActionView::Helpers::UrlHelper include CurrencyHelper include MailerHelper include ERB::Util def initialize(chargeable, for_email:, order_items_count:) @for_email = for_email @order_items_count = order_items_count @chargeab...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/receipt_presenter/payment_info.rb
Ruby
mit
8,966
main
11,922
# frozen_string_literal: true class ReceiptPresenter::PaymentInfo include ActionView::Helpers::UrlHelper include CurrencyHelper def initialize(chargeable) @chargeable = chargeable @orderable = chargeable.orderable end def present? today_payment_attributes.present? || upcoming_payment_attributes...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/receipt_presenter/shipping_info.rb
Ruby
mit
8,966
main
891
# frozen_string_literal: true class ReceiptPresenter::ShippingInfo include ActionView::Helpers::TextHelper include CurrencyHelper def initialize(chargeable) @chargeable = chargeable end def title "Shipping info" end def attributes return [] unless chargeable.require_shipping? [ ...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/admin/scheduled_payout_presenter.rb
Ruby
mit
8,966
main
886
# frozen_string_literal: true class Admin::ScheduledPayoutPresenter attr_reader :scheduled_payout def initialize(scheduled_payout:) @scheduled_payout = scheduled_payout end def props { external_id: scheduled_payout.external_id, action: scheduled_payout.action, status: scheduled_payo...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/admin/unreviewed_user_presenter.rb
Ruby
mit
8,966
main
1,608
# frozen_string_literal: true class Admin::UnreviewedUserPresenter include Rails.application.routes.url_helpers attr_reader :user def initialize(user) @user = user end def props { external_id: user.external_id, name: user.display_name, email: user.email, unpaid_balance_cent...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/admin/purchase_presenter.rb
Ruby
mit
8,966
main
8,775
# frozen_string_literal: true class Admin::PurchasePresenter attr_reader :purchase def initialize(purchase) @purchase = purchase end def list_props { external_id: purchase.external_id, formatted_display_price: purchase.formatted_display_price, formatted_gumroad_tax_amount: purchase....
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/admin/payment_presenter.rb
Ruby
mit
8,966
main
2,003
# frozen_string_literal: true class Admin::PaymentPresenter attr_reader :payment def initialize(payment:) @payment = payment end def props { external_id: payment.external_id, displayed_amount: payment.displayed_amount, payout_period_end_date: payment.payout_period_end_date, cr...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/admin/merchant_account_presenter.rb
Ruby
mit
8,966
main
2,577
# frozen_string_literal: true class Admin::MerchantAccountPresenter attr_reader :merchant_account def initialize(merchant_account:) @merchant_account = merchant_account end def props { charge_processor_id: merchant_account.charge_processor_id, charge_processor_merchant_id: merchant_accoun...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
app/presenters/admin/product_presenter/multiple_matches.rb
Ruby
mit
8,966
main
488
# frozen_string_literal: true class Admin::ProductPresenter::MultipleMatches attr_reader :product def initialize(product:) @product = product end def props { external_id: product.external_id, name: product.name, created_at: product.created_at, long_url: product.long_url, ...