Class: PaypalServerSdk::SubscriptionStatus

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

Overview

The status of the subscription.

Constant Summary collapse

SUBSCRIPTION_STATUS =
[
  # The subscription is created but not yet approved by the buyer.
  APPROVAL_PENDING = 'APPROVAL_PENDING'.freeze,

  # The buyer has approved the subscription.
  APPROVED = 'APPROVED'.freeze,

  # The subscription is active.
  ACTIVE = 'ACTIVE'.freeze,

  # The subscription is suspended.
  SUSPENDED = 'SUSPENDED'.freeze,

  # The subscription is cancelled.
  CANCELLED = 'CANCELLED'.freeze,

  # The subscription is expired.
  EXPIRED = 'EXPIRED'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = APPROVAL_PENDING) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/paypal_server_sdk/models/subscription_status.rb', line 35

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

  str = value.to_s.strip

  case str.downcase
  when 'approval_pending' then APPROVAL_PENDING
  when 'approved' then APPROVED
  when 'active' then ACTIVE
  when 'suspended' then SUSPENDED
  when 'cancelled' then CANCELLED
  when 'expired' then EXPIRED
  else
    default_value
  end
end

.validate(value) ⇒ Object



29
30
31
32
33
# File 'lib/paypal_server_sdk/models/subscription_status.rb', line 29

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

  true
end