77 lines
2.2 KiB
Ruby
77 lines
2.2 KiB
Ruby
module JamRuby
|
|
class SubscriptionDefinitions
|
|
JAM_SILVER = 'jamsubsilver'
|
|
JAM_SILVER_WITH_TRIAL = 'jamsubsilvertrial'
|
|
JAM_GOLD = 'jamsubgold'
|
|
JAM_GOLD_WITH_TRIAL = 'jamsubgoldtrial'
|
|
JAM_PLATINUM = 'jamsubplatinum'
|
|
JAM_PLATINUM_WITH_TRIAL = 'jamsubplatinumtrial'
|
|
|
|
# ALL IN HOURS
|
|
FREE_PLAY_TIME_PER_SESSION = 1
|
|
FREE_PLAY_TIME_PER_MONTH = 4
|
|
SILVER_PLAY_TIME_PER_SESSION = nil # unlimited
|
|
SILVER_PLAY_TIME_PER_MONTH = 10
|
|
GOLD_PLAY_TIME_PER_SESSION = nil # unlimited
|
|
GOLD_PLAY_TIME_PER_MONTH = nil # unlimited
|
|
PLATINUM_PLAY_TIME_PER_SESSION = nil # unlimited
|
|
PLATINUM_PLAY_TIME_PER_MONTH = nil # unlimited
|
|
|
|
|
|
FREE_PLAN = {
|
|
play_time_per_month: FREE_PLAY_TIME_PER_MONTH,
|
|
play_time_per_session: FREE_PLAY_TIME_PER_SESSION,
|
|
recording: false,
|
|
video: 'no',
|
|
audio_bitrate: '128',
|
|
broadcasting: 'no',
|
|
max_players: 4
|
|
|
|
}
|
|
|
|
SILVER_PLAN = {
|
|
play_time_per_month: SILVER_PLAY_TIME_PER_MONTH,
|
|
play_time_per_session: SILVER_PLAY_TIME_PER_SESSION,
|
|
recording: false,
|
|
video: 'cif',
|
|
audio_bitrate: '192',
|
|
broadcasting: 'free',
|
|
max_players: 6
|
|
}
|
|
|
|
GOLD_PLAN = {
|
|
play_time_per_month: GOLD_PLAY_TIME_PER_MONTH,
|
|
play_time_per_session: GOLD_PLAY_TIME_PER_SESSION,
|
|
recording: true,
|
|
video: '720p',
|
|
audio_bitrate: '256',
|
|
broadcasting: 'free',
|
|
max_players: nil
|
|
}
|
|
|
|
PLATINUM_PLAN = {
|
|
play_time_per_month: PLATINUM_PLAY_TIME_PER_MONTH,
|
|
play_time_per_session: PLATINUM_PLAY_TIME_PER_SESSION,
|
|
recording: true,
|
|
video: '1080p',
|
|
audio_bitrate: '512',
|
|
broadcasting: 'busking',
|
|
max_players: nil
|
|
}
|
|
|
|
def self.rules(plan_code)
|
|
if plan_code == nil
|
|
FREE_PLAN
|
|
elsif plan_code == JAM_SILVER || plan_code == JAM_SILVER_WITH_TRIAL
|
|
SILVER_PLAN
|
|
elsif plan_code == JAM_GOLD || plan_code == JAM_GOLD_WITH_TRIAL
|
|
GOLD_PLAN
|
|
elsif plan_code == JAM_PLATINUM || plan_code == JAM_PLATINUM_WITH_TRIAL
|
|
PLATINUM_PLAN
|
|
else
|
|
raise "unknown plan #{plan_code}"
|
|
end
|
|
end
|
|
end
|
|
end
|