Class: AdvancedBilling::ProformaInvoiceRole

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

Overview

‘proforma’ value is deprecated in favor of proforma_adhoc and proforma_automatic

Constant Summary collapse

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

  # TODO: Write general description for PROFORMA
  PROFORMA = 'proforma'.freeze,

  # TODO: Write general description for PROFORMA_ADHOC
  PROFORMA_ADHOC = 'proforma_adhoc'.freeze,

  # TODO: Write general description for PROFORMA_AUTOMATIC
  PROFORMA_AUTOMATIC = 'proforma_automatic'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = UNSET) ⇒ Object



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

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 'proforma' then PROFORMA
  when 'proforma_adhoc' then PROFORMA_ADHOC
  when 'proforma_automatic' then PROFORMA_AUTOMATIC
  else
    default_value
  end
end

.validate(value) ⇒ Object



24
25
26
27
28
# File 'lib/advanced_billing/models/proforma_invoice_role.rb', line 24

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

  PROFORMA_INVOICE_ROLE.include?(value)
end