Class: UspsApi::ShipperVisibilityMethod

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

Overview

When generating labels for a third party shipper the label provider must capture and provide contact details of the individual or entity to whom they provide the label. There are two methods for reporting shipper information to USPS: 1. The label provider creates a unique USPS Mailer ID (MID) using the name, validated address, phone, and email contact information of each shipper. When using this method the Mailer ID should be submitted in the MID field in the LABEL_OWNER role when generating the payment authorization token and this field should be populated with ‘MID_INFORMATION’ 2. An alternative method allows for the label provider to assign a unique alphanumeric value known as a platformUserId to each shipper and to report the platformUserId together with the required shipper contact details. When using this method the shipper contact details are required in the ‘senderAddress` object (including `streetAddress`, `city`, `state`, `ZIPCode`, `phone`, `email`, `platformUserId` & `firstName`/`lastName` or `firm`) and this field should be populated with ’SENDER_INFORMATION’.

Constant Summary collapse

SHIPPER_VISIBILITY_METHOD =
[
  # TODO: Write general description for SENDER_INFORMATION
  SENDER_INFORMATION = 'SENDER_INFORMATION'.freeze,

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = SENDER_INFORMATION) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/usps_api/models/shipper_visibility_method.rb', line 37

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

  str = value.to_s.strip

  case str.downcase
  when 'sender_information' then SENDER_INFORMATION
  when 'mid_information' then MID_INFORMATION
  else
    default_value
  end
end

.validate(value) ⇒ Object



31
32
33
34
35
# File 'lib/usps_api/models/shipper_visibility_method.rb', line 31

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

  SHIPPER_VISIBILITY_METHOD.include?(value)
end