Class: FdxV660Api::RecurringPaymentDurationType

Inherits:
Object
  • Object
show all
Defined in:
lib/fdx_v660_api/models/recurring_payment_duration_type.rb

Overview

Describes if the recurring payment has an end or will occur a fixed number of times

Constant Summary collapse

RECURRING_PAYMENT_DURATION_TYPE =
[
  # TODO: Write general description for ENDDATE
  ENDDATE = 'ENDDATE'.freeze,

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = ENDDATE) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/fdx_v660_api/models/recurring_payment_duration_type.rb', line 27

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

  str = value.to_s.strip

  case str.downcase
  when 'enddate' then ENDDATE
  when 'noend' then NOEND
  when 'numberoftimes' then NUMBEROFTIMES
  else
    default_value
  end
end

.validate(value) ⇒ Object



21
22
23
24
25
# File 'lib/fdx_v660_api/models/recurring_payment_duration_type.rb', line 21

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

  true
end