Class: UspsApi::RoleName

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

Overview

  • PAYER - Payer of the Postage * RATE_HOLDER - Owner of the Contracted

Postage Rates * LABEL_OWNER - Party supplying Label MIDs used for generating tracking numbers printed on physical label * SHIPPER - Party entering package into the mailstream * PLATFORM - Platform used * RETURN_LABEL_PAYER

  • Payer of the Postage for the return label in a combined outbound/return

request. Optional if outbound and return label payer are the same. * RETURN_LABEL_RATE_HOLDER - Owner of the Contracted Postage Rates for the return label in a combined outbound/return request. Optional if outbound and return label rate holder are the same. * RETURN_LABEL_OWNER - Party supplying Label MIDs used for generating tracking numbers printed on physical label for the return label in a combined outbound/return request. Optional if outbound and return label owner are the same. * MAIL_OWNER - This role is used to specify who owns the package contents. When using the MAIL_OWNER role, the CRID must be specified. This does not populate the mail owner field in the D1 record of the Shipping Service File (SSF). Please use the ‘packageDescription.mailerOwnerMID` field to populate the D1 field. * LABEL_PROVIDER - This role is used to specify the label provider for the transaction. When using the LABEL_PROVIDER role, the CRID, accountNumber, and accountType must be specified and the only supported accountType is ’EPS’. The accountNumber must be active in the Enterprise Payment System (EPS).

Constant Summary collapse

ROLE_NAME =
[
  # TODO: Write general description for PAYER
  PAYER = 'PAYER'.freeze,

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

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

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

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

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

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

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = PAYER) ⇒ Object



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/usps_api/models/role_name.rb', line 67

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

  str = value.to_s.strip

  case str.downcase
  when 'payer' then PAYER
  when 'rate_holder' then RATE_HOLDER
  when 'label_owner' then LABEL_OWNER
  when 'shipper' then SHIPPER
  when 'mail_owner' then MAIL_OWNER
  when 'platform' then PLATFORM
  when 'return_label_payer' then RETURN_LABEL_PAYER
  when 'return_label_rate_holder' then RETURN_LABEL_RATE_HOLDER
  when 'return_label_owner' then RETURN_LABEL_OWNER
  when 'label_provider' then LABEL_PROVIDER
  else
    default_value
  end
end

.validate(value) ⇒ Object



61
62
63
64
65
# File 'lib/usps_api/models/role_name.rb', line 61

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

  ROLE_NAME.include?(value)
end