Class: UspsApi::AddressesAddressAdditionalInformation

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

Overview

Extra information about the request.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(delivery_point: SKIP, carrier_route: SKIP, dpv_confirmation: SKIP, dpvcmra: SKIP, business: SKIP, central_delivery_point: SKIP, vacant: SKIP) ⇒ AddressesAddressAdditionalInformation

Returns a new instance of AddressesAddressAdditionalInformation.



103
104
105
106
107
108
109
110
111
112
113
# File 'lib/usps_api/models/addresses_address_additional_information.rb', line 103

def initialize(delivery_point: SKIP, carrier_route: SKIP,
               dpv_confirmation: SKIP, dpvcmra: SKIP, business: SKIP,
               central_delivery_point: SKIP, vacant: SKIP)
  @delivery_point = delivery_point unless delivery_point == SKIP
  @carrier_route = carrier_route unless carrier_route == SKIP
  @dpv_confirmation = dpv_confirmation unless dpv_confirmation == SKIP
  @dpvcmra = dpvcmra unless dpvcmra == SKIP
  @business = business unless business == SKIP
  @central_delivery_point = central_delivery_point unless central_delivery_point == SKIP
  @vacant = vacant unless vacant == SKIP
end

Instance Attribute Details

#businessBusiness

Indicates whether this is a business address.

  • ‘Y` - The address is a business address.

  • ‘N` - The address is not a business address.

Returns:



56
57
58
# File 'lib/usps_api/models/addresses_address_additional_information.rb', line 56

def business
  @business
end

#carrier_routeString

This is the carrier route code (values unspecified).

Returns:

  • (String)


23
24
25
# File 'lib/usps_api/models/addresses_address_additional_information.rb', line 23

def carrier_route
  @carrier_route
end

#central_delivery_pointCentralDeliveryPoint

Central Delivery is for all business office buildings and/or industrial/professional parks. This may include call windows, horizontal locked mail receptacles, and cluster box units.

  • ‘Y` - The address is a central delivery point.

  • ‘N` - The address is not a central delivery point.



64
65
66
# File 'lib/usps_api/models/addresses_address_additional_information.rb', line 64

def central_delivery_point
  @central_delivery_point
end

#delivery_pointString

A specific set of digits between 00 and 99 is assigned to every address that is combined with the ZIP + 4® Code to provide a unique identifier for every delivery address. A street address does not necessarily represent a single delivery point because a street address such as one for an apartment building may have several delivery points.

Returns:

  • (String)


19
20
21
# File 'lib/usps_api/models/addresses_address_additional_information.rb', line 19

def delivery_point
  @delivery_point
end

#dpv_confirmationDpvConfirmation

The DPV Confirmation indicator identifies whether the address provided maps to a known USPS address record, whether the USPS delivers to the address or not. If the USPS does not deliver to the address, the USPS may deliver to a PO Box instead. ‘carrierRoute` values of `R777` and `R779`, for example, may require the shipper to ask the recipient where they receive their USPS mail, which may be different than their physical address.

  • ‘Y` - Address was DPV confirmed for both primary and (if present)

secondary numbers. A value of ‘Y` does not necessarily imply that USPS delivers to that address.

  • ‘D` - Address was DPV confirmed for the primary number only, and the

secondary number information was missing.

  • ‘S` - Address was DPV confirmed for the primary number only, and the

secondary number information was present but not confirmed.

  • ‘N` - Both primary and (if present) secondary number information failed

to DPV confirm.

Returns:



42
43
44
# File 'lib/usps_api/models/addresses_address_additional_information.rb', line 42

def dpv_confirmation
  @dpv_confirmation
end

#dpvcmraDpvcmra

Indicates if the location is a [Commercial Mail Receiving Agency (CMRA)](faq.usps.com/s/article/Commercial-Mail-Receiving-Agency-CM RA).

* `Y` - Address was found in the CMRA table.
* `N` - Address was not found in the CMRA table.

Returns:



50
51
52
# File 'lib/usps_api/models/addresses_address_additional_information.rb', line 50

def dpvcmra
  @dpvcmra
end

#vacantVacant

Indicates whether the location designated by the address is occupied.

  • ‘Y` - The address is not occupied.

  • ‘N` - The address is occupied.

Returns:



70
71
72
# File 'lib/usps_api/models/addresses_address_additional_information.rb', line 70

def vacant
  @vacant
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/usps_api/models/addresses_address_additional_information.rb', line 116

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  delivery_point = hash.key?('deliveryPoint') ? hash['deliveryPoint'] : SKIP
  carrier_route = hash.key?('carrierRoute') ? hash['carrierRoute'] : SKIP
  dpv_confirmation =
    hash.key?('DPVConfirmation') ? hash['DPVConfirmation'] : SKIP
  dpvcmra = hash.key?('DPVCMRA') ? hash['DPVCMRA'] : SKIP
  business = hash.key?('business') ? hash['business'] : SKIP
  central_delivery_point =
    hash.key?('centralDeliveryPoint') ? hash['centralDeliveryPoint'] : SKIP
  vacant = hash.key?('vacant') ? hash['vacant'] : SKIP

  # Create object from extracted values.
  AddressesAddressAdditionalInformation.new(delivery_point: delivery_point,
                                            carrier_route: carrier_route,
                                            dpv_confirmation: dpv_confirmation,
                                            dpvcmra: dpvcmra,
                                            business: business,
                                            central_delivery_point: central_delivery_point,
                                            vacant: vacant)
end

.namesObject

A mapping from model property names to API property names.



73
74
75
76
77
78
79
80
81
82
83
# File 'lib/usps_api/models/addresses_address_additional_information.rb', line 73

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['delivery_point'] = 'deliveryPoint'
  @_hash['carrier_route'] = 'carrierRoute'
  @_hash['dpv_confirmation'] = 'DPVConfirmation'
  @_hash['dpvcmra'] = 'DPVCMRA'
  @_hash['business'] = 'business'
  @_hash['central_delivery_point'] = 'centralDeliveryPoint'
  @_hash['vacant'] = 'vacant'
  @_hash
end

.nullablesObject

An array for nullable fields



99
100
101
# File 'lib/usps_api/models/addresses_address_additional_information.rb', line 99

def self.nullables
  []
end

.optionalsObject

An array for optional fields



86
87
88
89
90
91
92
93
94
95
96
# File 'lib/usps_api/models/addresses_address_additional_information.rb', line 86

def self.optionals
  %w[
    delivery_point
    carrier_route
    dpv_confirmation
    dpvcmra
    business
    central_delivery_point
    vacant
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



149
150
151
152
153
154
155
# File 'lib/usps_api/models/addresses_address_additional_information.rb', line 149

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} delivery_point: #{@delivery_point.inspect}, carrier_route:"\
  " #{@carrier_route.inspect}, dpv_confirmation: #{@dpv_confirmation.inspect}, dpvcmra:"\
  " #{@dpvcmra.inspect}, business: #{@business.inspect}, central_delivery_point:"\
  " #{@central_delivery_point.inspect}, vacant: #{@vacant.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



141
142
143
144
145
146
# File 'lib/usps_api/models/addresses_address_additional_information.rb', line 141

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} delivery_point: #{@delivery_point}, carrier_route: #{@carrier_route},"\
  " dpv_confirmation: #{@dpv_confirmation}, dpvcmra: #{@dpvcmra}, business: #{@business},"\
  " central_delivery_point: #{@central_delivery_point}, vacant: #{@vacant}>"
end