Class: UspsApi::AncillaryServiceEndorsements

Inherits:
Object
  • Object
show all
Defined in:
lib/usps_api/models/ancillary_service_endorsements.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). Note: * Ancillary Service Endorsements are currently not supported when ‘holdForPickup’ is set to ‘true’. * ‘CHANGE_SERVICE_REQUESTED’ with a mail class value of ‘PRIORITY_MAIL’ currently only supports a contentType of ‘PERISHABLE’. * ‘CHANGE_SERVICE_REQUESTED’ cannot be requested with a ‘contentType’ of ‘HAZMAT’ or any hazmat shipments. * ‘CHANGE_SERVICE_REQUESTED’ with mail classes ‘PARCEL_SELECT’, ‘USPS_GROUND_ADVANTAGE’, and ‘PRIORITY_MAIL’ can only be used with extraServices ‘920’ and ‘921’. * Ancillary Service Endorsements are currently only supported with mail class values ‘PARCEL_SELECT’, ‘USPS_GROUND_ADVANTAGE’, ‘PRIORITY_MAIL’, and ‘PRIORITY_MAIL_EXPRESS’. * ‘ELECTRONIC_SERVICE_REQUESTED’ with a mail class value of ‘PARCEL_SELECT’ cannot be requested with a ‘contentType’ of ‘HAZMAT’ or any hazmat shipments.

Constant Summary collapse

ANCILLARY_SERVICE_ENDORSEMENTS =
[
  # 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



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/usps_api/models/ancillary_service_endorsements.rb', line 52

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



46
47
48
49
50
# File 'lib/usps_api/models/ancillary_service_endorsements.rb', line 46

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

  ANCILLARY_SERVICE_ENDORSEMENTS.include?(value)
end