Class: UspsApi::BusinessService

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

Overview

businessService.

Constant Summary collapse

BUSINESS_SERVICE =
[
  # TODO: Write general description for BULK_MAIL_ACCEPTANCE
  BULK_MAIL_ACCEPTANCE = 'BULK_MAIL_ACCEPTANCE'.freeze,

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

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

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = BULK_MAIL_ACCEPTANCE) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/usps_api/models/business_service.rb', line 35

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

  str = value.to_s.strip

  case str.downcase
  when 'bulk_mail_acceptance' then BULK_MAIL_ACCEPTANCE
  when 'business_reply_mail_account_balance' then BUSINESS_REPLY_MAIL_ACCOUNT_BALANCE
  when 'bulk_mail_account_balance' then BULK_MAIL_ACCOUNT_BALANCE
  when 'bulk_mail_new_permit' then BULK_MAIL_NEW_PERMIT
  when 'business_reply_mail_new_permit' then BUSINESS_REPLY_MAIL_NEW_PERMIT
  when 'call_referral' then CALL_REFERRAL
  else
    default_value
  end
end

.validate(value) ⇒ Object



29
30
31
32
33
# File 'lib/usps_api/models/business_service.rb', line 29

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

  BUSINESS_SERVICE.include?(value)
end