Class: AdvancedBilling::SubscriptionListInclude

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

Overview

Subscription List Include.

Constant Summary collapse

SUBSCRIPTION_LIST_INCLUDE =
[
  # TODO: Write general description for SELF_SERVICE_PAGE_TOKEN
  SELF_SERVICE_PAGE_TOKEN = 'self_service_page_token'.freeze,

  # TODO: Write general description for CURRENT_ACCOUNT_BALANCE_IN_CENTS
  CURRENT_ACCOUNT_BALANCE_IN_CENTS = 'current_account_balance_in_cents'.freeze,

  # TODO: Write general description for CURRENT_BILLING_AMOUNT
  CURRENT_BILLING_AMOUNT = 'current_billing_amount'.freeze,

  # TODO: Write general description for COUPONS
  COUPONS = 'coupons'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = SELF_SERVICE_PAGE_TOKEN) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/advanced_billing/models/subscription_list_include.rb', line 29

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

  str = value.to_s.strip

  case str.downcase
  when 'self_service_page_token' then SELF_SERVICE_PAGE_TOKEN
  when 'current_account_balance_in_cents' then CURRENT_ACCOUNT_BALANCE_IN_CENTS
  when 'current_billing_amount' then CURRENT_BILLING_AMOUNT
  when 'coupons' then COUPONS
  else
    default_value
  end
end

.validate(value) ⇒ Object



23
24
25
26
27
# File 'lib/advanced_billing/models/subscription_list_include.rb', line 23

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

  SUBSCRIPTION_LIST_INCLUDE.include?(value)
end