This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :sidekiq do | |
desc "Clear queued jobs in Sidekiq and reset all stats" | |
task :reset => :environment do | |
Sidekiq::Queue.all.each &:clear | |
Sidekiq::Stats.new.reset | |
Sidekiq::RetrySet.new.clear | |
Sidekiq::ScheduledSet.new.clear | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TenantWebhooksBraintreeController < ApplicationController | |
protect_from_forgery :except => :process_webhook | |
skip_before_action :verify_authenticity_token | |
before_action :verify_event | |
require 'pp' | |
def process_webhook | |
case @event.kind |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module TenantServices | |
class SubscriptionServicePaypal | |
def initialize(params) | |
@subscription = params[:subscription] | |
@coupon = params[:coupon] | |
@paypal_token = params[:paypal_token] | |
@plan = @subscription.subscription_plan | |
@customer = @subscription.customer | |
@site = @subscription.site |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module TenantServices | |
class CheckoutService | |
def initialize(params) | |
@site = params[:site] | |
@cart = params[:cart] | |
@customer = params[:customer] | |
@coupon_code = params[:coupon_code] | |
@selected_country = params[:selected_country] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CustomerNotification < ApplicationRecord | |
belongs_to :site | |
belongs_to :customer | |
belongs_to :notifyable, polymorphic: true | |
acts_as_tenant :site | |
validates_uniqueness_to_tenant :customer_id, scope: [:notifyable_id, :notifyable_type] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Customer < ApplicationRecord | |
has_many :following_playlists, class_name:'PlaylistFollower', dependent: :destroy | |
def follow_playlist!(playlist_id) | |
following_playlists.create(playlist_id: playlist_id) | |
end | |
def unfollow_playlist!(playlist_id) | |
following_playlists.find_by(playlist_id: playlist_id).destroy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Playlist < ApplicationRecord | |
belongs_to :site | |
belongs_to :customer | |
belongs_to :user | |
acts_as_tenant :site | |
validates_presence_of :title, :content | |
attr_accessor :spam_answer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BookmarksController < ApplicationController | |
BOOKMARKABLES = { | |
'Course' => Course, | |
'Lesson' => Lesson, | |
'Post' => Post, | |
'LiveStream' => LiveStream, | |
'Download' => Download, | |
'Project' => Project, | |
'Exercise' => Exercise, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module TenantServices | |
class AccessService | |
def initialize(params) | |
@site = params[:site] | |
@customer = params[:customer] | |
@user = params[:user] | |
@record = params[:record] | |
@feature = params[:feature] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GiftCard < ApplicationRecord | |
belongs_to :site | |
belongs_to :subscription_plan, optional: true | |
acts_as_tenant :site | |
include ProductConcern | |
include ImageUploader[:image] | |
enum status: { draft:0, published:1} |
NewerOlder