Class: PaypalServerSdk::IntervalUnit

Inherits:
Object
  • Object
show all
Defined in:
lib/paypal_server_sdk/models/interval_unit.rb

Overview

The interval at which the subscription is charged or billed.

Constant Summary collapse

INTERVAL_UNIT =
[
  # A daily billing cycle.

  DAY = 'DAY'.freeze,

  # A weekly billing cycle.

  WEEK = 'WEEK'.freeze,

  # A monthly billing cycle.

  MONTH = 'MONTH'.freeze,

  # A yearly billing cycle.

  YEAR = 'YEAR'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = DAY) ⇒ Object



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

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

  str = value.to_s.strip

  case str.downcase
  when 'day' then DAY
  when 'week' then WEEK
  when 'month' then MONTH
  when 'year' then YEAR
  else
    default_value
  end
end

.validate(value) ⇒ Object



23
24
25
26
27
# File 'lib/paypal_server_sdk/models/interval_unit.rb', line 23

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

  true
end