Class: UspsApi::MailingService
- Inherits:
-
Object
- Object
- UspsApi::MailingService
- Defined in:
- lib/usps_api/models/mailing_service.rb
Overview
mailingService.
Constant Summary collapse
- MAILING_SERVICE =
[ # TODO: Write general description for CARRIER_SERVICES CARRIER_SERVICES = 'CARRIER_SERVICES'.freeze, # TODO: Write general description for GENERAL_DELIVERY GENERAL_DELIVERY = 'GENERAL_DELIVERY'.freeze, # TODO: Write general description for GLOBAL_EXPRESS_GUARANTEED GLOBAL_EXPRESS_GUARANTEED = 'GLOBAL_EXPRESS_GUARANTEED'.freeze, # TODO: Write general description for LABEL_BROKER LABEL_BROKER = 'LABEL_BROKER'.freeze, # TODO: Write general description for LABEL_BROKER_SELFSERVICE_KIOSK LABEL_BROKER_SELFSERVICE_KIOSK = 'LABEL_BROKER_SELF-SERVICE_KIOSK'.freeze, # TODO: Write general description for PRIORITY_MAIL_INTERNATIONAL PRIORITY_MAIL_INTERNATIONAL = 'PRIORITY_MAIL_INTERNATIONAL'.freeze, # TODO: Write general description for PO_BOX PO_BOX = 'PO_BOX'.freeze, # TODO: Write general description for SELFSERVICE_KIOSK SELFSERVICE_KIOSK = 'SELF-SERVICE_KIOSK'.freeze, # TODO: Write general description for USPS_CONNECT_LOCAL USPS_CONNECT_LOCAL = 'USPS_CONNECT_LOCAL'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = CARRIER_SERVICES) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/usps_api/models/mailing_service.rb', line 44 def self.from_value(value, default_value = CARRIER_SERVICES) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'carrier_services' then CARRIER_SERVICES when 'general_delivery' then GENERAL_DELIVERY when 'global_express_guaranteed' then GLOBAL_EXPRESS_GUARANTEED when 'label_broker' then LABEL_BROKER when 'label_broker_selfservice_kiosk' then LABEL_BROKER_SELFSERVICE_KIOSK when 'priority_mail_international' then PRIORITY_MAIL_INTERNATIONAL when 'po_box' then PO_BOX when 'selfservice_kiosk' then SELFSERVICE_KIOSK when 'usps_connect_local' then USPS_CONNECT_LOCAL else default_value end end |
.validate(value) ⇒ Object
38 39 40 41 42 |
# File 'lib/usps_api/models/mailing_service.rb', line 38 def self.validate(value) return false if value.nil? MAILING_SERVICE.include?(value) end |