Class: AdvancedBilling::InvoiceRole

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

Overview

Invoice Role.

Constant Summary collapse

INVOICE_ROLE =
[
  # TODO: Write general description for UNSET
  UNSET = 'unset'.freeze,

  # TODO: Write general description for SIGNUP
  SIGNUP = 'signup'.freeze,

  # TODO: Write general description for RENEWAL
  RENEWAL = 'renewal'.freeze,

  # TODO: Write general description for USAGE
  USAGE = 'usage'.freeze,

  # TODO: Write general description for REACTIVATION
  REACTIVATION = 'reactivation'.freeze,

  # TODO: Write general description for PRORATION
  PRORATION = 'proration'.freeze,

  # TODO: Write general description for MIGRATION
  MIGRATION = 'migration'.freeze,

  # TODO: Write general description for ADHOC
  ADHOC = 'adhoc'.freeze,

  # TODO: Write general description for BACKPORT
  BACKPORT = 'backport'.freeze,

  # TODO: Write general description for BACKPORTBALANCERECONCILIATION
  BACKPORTBALANCERECONCILIATION = 'backport-balance-reconciliation'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = UNSET) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/advanced_billing/models/invoice_role.rb', line 47

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

  str = value.to_s.strip

  case str.downcase
  when 'unset' then UNSET
  when 'signup' then SIGNUP
  when 'renewal' then RENEWAL
  when 'usage' then USAGE
  when 'reactivation' then REACTIVATION
  when 'proration' then PRORATION
  when 'migration' then MIGRATION
  when 'adhoc' then ADHOC
  when 'backport' then BACKPORT
  when 'backportbalancereconciliation' then BACKPORTBALANCERECONCILIATION
  else
    default_value
  end
end

.validate(value) ⇒ Object



41
42
43
44
45
# File 'lib/advanced_billing/models/invoice_role.rb', line 41

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

  INVOICE_ROLE.include?(value)
end