Class: ApiReference::ChangeOption

Inherits:
Object
  • Object
show all
Defined in:
lib/api_reference/models/change_option.rb

Overview

Determines when the change takes effect. Note that if effective_date is specified, this defaults to effective_date. Otherwise, this defaults to immediate unless it's explicitly set to upcoming_invoice.

Constant Summary collapse

CHANGE_OPTION =
[
  # TODO: Write general description for IMMEDIATE
  IMMEDIATE = 'immediate'.freeze,

  # TODO: Write general description for UPCOMING_INVOICE
  UPCOMING_INVOICE = 'upcoming_invoice'.freeze,

  # TODO: Write general description for EFFECTIVE_DATE
  EFFECTIVE_DATE = 'effective_date'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = IMMEDIATE) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/api_reference/models/change_option.rb', line 28

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

  str = value.to_s.strip

  case str.downcase
  when 'immediate' then IMMEDIATE
  when 'upcoming_invoice' then UPCOMING_INVOICE
  when 'effective_date' then EFFECTIVE_DATE
  else
    default_value
  end
end

.validate(value) ⇒ Object



22
23
24
25
26
# File 'lib/api_reference/models/change_option.rb', line 22

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

  true
end