Class: UnivapayClientSdk::SubscriptionSimulationPeriod

Inherits:
Object
  • Object
show all
Defined in:
lib/univapay_client_sdk/models/subscription_simulation_period.rb

Overview

Billing frequency for the simulated schedule. Includes bimonthly, which is not offered on SubscriptionPeriod for live subscription creation.

Constant Summary collapse

SUBSCRIPTION_SIMULATION_PERIOD =
[
  # TODO: Write general description for DAILY
  DAILY = 'daily'.freeze,

  # TODO: Write general description for WEEKLY
  WEEKLY = 'weekly'.freeze,

  # TODO: Write general description for BIWEEKLY
  BIWEEKLY = 'biweekly'.freeze,

  # TODO: Write general description for MONTHLY
  MONTHLY = 'monthly'.freeze,

  # TODO: Write general description for BIMONTHLY
  BIMONTHLY = 'bimonthly'.freeze,

  # TODO: Write general description for QUARTERLY
  QUARTERLY = 'quarterly'.freeze,

  # TODO: Write general description for SEMIANNUALLY
  SEMIANNUALLY = 'semiannually'.freeze,

  # TODO: Write general description for ANNUALLY
  ANNUALLY = 'annually'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = DAILY) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/univapay_client_sdk/models/subscription_simulation_period.rb', line 42

def self.from_value(value, default_value = DAILY)
  return default_value if value.nil?

  str = value.to_s.strip

  case str.downcase
  when 'daily' then DAILY
  when 'weekly' then WEEKLY
  when 'biweekly' then BIWEEKLY
  when 'monthly' then MONTHLY
  when 'bimonthly' then BIMONTHLY
  when 'quarterly' then QUARTERLY
  when 'semiannually' then SEMIANNUALLY
  when 'annually' then ANNUALLY
  else
    default_value
  end
end

.validate(value) ⇒ Object



36
37
38
39
40
# File 'lib/univapay_client_sdk/models/subscription_simulation_period.rb', line 36

def self.validate(value)
  return false if value.nil?

  SUBSCRIPTION_SIMULATION_PERIOD.include?(value)
end