Class: UspsApi::Status5

Inherits:
Object
  • Object
show all
Defined in:
lib/usps_api/models/status5.rb

Overview

Current status of the subscription. USPS will post notifications to the supplied listenerURL. If the listenerURL cannot be reached or is invalid, USPS will change the status of the subscription to SUSPENDED. The customer has the option of changing the status to DISABLED. It is recommended the customer change the status to DISABLED if they know their endpoint will not be active, i.e operational maintenance.

Constant Summary collapse

STATUS5 =
[
  # TODO: Write general description for DISABLED
  DISABLED = 'DISABLED'.freeze,

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = DISABLED) ⇒ Object



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

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

  str = value.to_s.strip

  case str.downcase
  when 'disabled' then DISABLED
  when 'enabled' then ENABLED
  when 'suspended' then SUSPENDED
  else
    default_value
  end
end

.validate(value) ⇒ Object



25
26
27
28
29
# File 'lib/usps_api/models/status5.rb', line 25

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

  STATUS5.include?(value)
end