Class: AdvancedBilling::SubscriptionGroupPrepaymentMethod

Inherits:
Object
  • Object
show all
Defined in:
lib/advanced_billing/models/subscription_group_prepayment_method.rb

Overview

Subscription Group Prepayment Method.

Constant Summary collapse

SUBSCRIPTION_GROUP_PREPAYMENT_METHOD =
[
  # TODO: Write general description for CHECK
  CHECK = 'check'.freeze,

  # TODO: Write general description for CASH
  CASH = 'cash'.freeze,

  # TODO: Write general description for MONEY_ORDER
  MONEY_ORDER = 'money_order'.freeze,

  # TODO: Write general description for ACH
  ACH = 'ach'.freeze,

  # TODO: Write general description for PAYPAL_ACCOUNT
  PAYPAL_ACCOUNT = 'paypal_account'.freeze,

  # TODO: Write general description for OTHER
  OTHER = 'other'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = CHECK) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/advanced_billing/models/subscription_group_prepayment_method.rb', line 35

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

  str = value.to_s.strip

  case str.downcase
  when 'check' then CHECK
  when 'cash' then CASH
  when 'money_order' then MONEY_ORDER
  when 'ach' then ACH
  when 'paypal_account' then PAYPAL_ACCOUNT
  when 'other' then OTHER
  else
    default_value
  end
end

.validate(value) ⇒ Object



29
30
31
32
33
# File 'lib/advanced_billing/models/subscription_group_prepayment_method.rb', line 29

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

  SUBSCRIPTION_GROUP_PREPAYMENT_METHOD.include?(value)
end