- C
- F
- N
- R
- U
Attributes
| [R] | days | |
| [R] | site |
Class Public methods
new(args = {}) Link
Source: show
# File app/services/service/site_performance_stats.rb, line 5 def initialize(args = {}) @site = args.fetch(:site) @days = args.fetch(:days) @days_ago = @days.days.ago @client_id = Rails.application.secrets.stripe_platform["client_id"] @account_params = Rails.env.development? ? {} : @site.stripe_account_params end
Instance Public methods
currency() Link
Source: show
# File app/services/service/site_performance_stats.rb, line 59 def currency @currency ||= @site.settings.members["default_currency"] end
failed_payments_by_status(status) Link
Source: show
# File app/services/service/site_performance_stats.rb, line 34 def failed_payments_by_status(status) @failed_payments ||= Hash.new do |hash, key| hash[key] = @site.failed_payments .includes(:member) .public_send(key) .updated_since(@days_ago) .next_payment_attempt_null_or_future end @failed_payments[status] end
new_members() Link
Source: show
# File app/services/service/site_performance_stats.rb, line 13 def new_members Action::MemberSearcher.new(site, days_ago: @days_ago, plan_status: "default").results.size end
revenue_lost() Link
Source: show
# File app/services/service/site_performance_stats.rb, line 55 def revenue_lost revenue_for(category: "lost") end
revenue_recovering() Link
Source: show
# File app/services/service/site_performance_stats.rb, line 51 def revenue_recovering revenue_for(category: "recovering") end
revenue_saved() Link
Dunning Details
Source: show
# File app/services/service/site_performance_stats.rb, line 47 def revenue_saved revenue_for(category: "saved") end
revenues_generated() Link
Source: show
# File app/services/service/site_performance_stats.rb, line 17 def revenues_generated return 0 if @account_params.blank? @valid_charges = @site.events .charge_created .where("events.created_at >= ?", @days_ago) .pluck(Arel.sql("details -> 'charge_id'")) gross_volume - volume_refunded rescue Stripe::PermissionError 0 end