Class: UspsApi::AncillaryServiceEndorsements1

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

Overview

Endorsements allow the sender to obtain the addressee’s new (forwarding) address (provided the appropriate endorsement is used and if the addressee filed a Change-of-Address Order with the Postal Service) or the reason for non-delivery. For more information see [PostalPro](postalpro.usps.com/address-quality/ancillary-service-end orsements)

Constant Summary collapse

ANCILLARY_SERVICE_ENDORSEMENTS1 =
[
  # TODO: Write general description for CHANGE_SERVICE_REQUESTED
  CHANGE_SERVICE_REQUESTED = 'CHANGE_SERVICE_REQUESTED'.freeze,

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

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

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = CHANGE_SERVICE_REQUESTED) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/usps_api/models/ancillary_service_endorsements1.rb', line 40

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

  str = value.to_s.strip

  case str.downcase
  when 'change_service_requested' then CHANGE_SERVICE_REQUESTED
  when 'address_service_requested' then ADDRESS_SERVICE_REQUESTED
  when 'electronic_service_requested' then ELECTRONIC_SERVICE_REQUESTED
  when 'return_service_requested' then RETURN_SERVICE_REQUESTED
  when 'temp_return_service_requested' then TEMP_RETURN_SERVICE_REQUESTED
  when 'forwarding_service_requested' then FORWARDING_SERVICE_REQUESTED
  else
    default_value
  end
end

.validate(value) ⇒ Object



34
35
36
37
38
# File 'lib/usps_api/models/ancillary_service_endorsements1.rb', line 34

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

  ANCILLARY_SERVICE_ENDORSEMENTS1.include?(value)
end