Class: UspsApi::NcoaDataServicesDomesticAddress
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UspsApi::NcoaDataServicesDomesticAddress
- Defined in:
- lib/usps_api/models/ncoa_data_services_domestic_address.rb
Overview
Address fields for US locations
Instance Attribute Summary collapse
-
#city ⇒ String
City Name.
-
#delivery_point ⇒ String
Return/Standardize Delivery Point.
-
#lastline ⇒ String
Return/Standardized City State ZIP Code™.
-
#state_abbr ⇒ String
State Abbreviation.
-
#street_address ⇒ String
Primary and Secondary Address Information.
-
#urbanization ⇒ String
An area, sector, or residential development within a geographic area (typically used for addresses in Puerto Rico).
-
#zip_code ⇒ String
Return/Standardize ZIP Code™.
-
#zip_plus4 ⇒ String
This is the 4-digit component of the ZIP+4 code.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(street_address: SKIP, lastline: SKIP, urbanization: SKIP, city: SKIP, state_abbr: SKIP, zip_code: SKIP, zip_plus4: SKIP, delivery_point: SKIP, additional_properties: nil) ⇒ NcoaDataServicesDomesticAddress
constructor
A new instance of NcoaDataServicesDomesticAddress.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(street_address: SKIP, lastline: SKIP, urbanization: SKIP, city: SKIP, state_abbr: SKIP, zip_code: SKIP, zip_plus4: SKIP, delivery_point: SKIP, additional_properties: nil) ⇒ NcoaDataServicesDomesticAddress
Returns a new instance of NcoaDataServicesDomesticAddress.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/usps_api/models/ncoa_data_services_domestic_address.rb', line 87 def initialize(street_address: SKIP, lastline: SKIP, urbanization: SKIP, city: SKIP, state_abbr: SKIP, zip_code: SKIP, zip_plus4: SKIP, delivery_point: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @street_address = street_address unless street_address == SKIP @lastline = lastline unless lastline == SKIP @urbanization = urbanization unless urbanization == SKIP @city = city unless city == SKIP @state_abbr = state_abbr unless state_abbr == SKIP @zip_code = zip_code unless zip_code == SKIP @zip_plus4 = zip_plus4 unless zip_plus4 == SKIP @delivery_point = delivery_point unless delivery_point == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#city ⇒ String
City Name
27 28 29 |
# File 'lib/usps_api/models/ncoa_data_services_domestic_address.rb', line 27 def city @city end |
#delivery_point ⇒ String
Return/Standardize Delivery Point
43 44 45 |
# File 'lib/usps_api/models/ncoa_data_services_domestic_address.rb', line 43 def delivery_point @delivery_point end |
#lastline ⇒ String
Return/Standardized City State ZIP Code™
18 19 20 |
# File 'lib/usps_api/models/ncoa_data_services_domestic_address.rb', line 18 def lastline @lastline end |
#state_abbr ⇒ String
State Abbreviation
31 32 33 |
# File 'lib/usps_api/models/ncoa_data_services_domestic_address.rb', line 31 def state_abbr @state_abbr end |
#street_address ⇒ String
Primary and Secondary Address Information
14 15 16 |
# File 'lib/usps_api/models/ncoa_data_services_domestic_address.rb', line 14 def street_address @street_address end |
#urbanization ⇒ String
An area, sector, or residential development within a geographic area (typically used for addresses in Puerto Rico)
23 24 25 |
# File 'lib/usps_api/models/ncoa_data_services_domestic_address.rb', line 23 def urbanization @urbanization end |
#zip_code ⇒ String
Return/Standardize ZIP Code™
35 36 37 |
# File 'lib/usps_api/models/ncoa_data_services_domestic_address.rb', line 35 def zip_code @zip_code end |
#zip_plus4 ⇒ String
This is the 4-digit component of the ZIP+4 code.
39 40 41 |
# File 'lib/usps_api/models/ncoa_data_services_domestic_address.rb', line 39 def zip_plus4 @zip_plus4 end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/usps_api/models/ncoa_data_services_domestic_address.rb', line 106 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. street_address = hash.key?('streetAddress') ? hash['streetAddress'] : SKIP lastline = hash.key?('lastline') ? hash['lastline'] : SKIP urbanization = hash.key?('urbanization') ? hash['urbanization'] : SKIP city = hash.key?('city') ? hash['city'] : SKIP state_abbr = hash.key?('stateAbbr') ? hash['stateAbbr'] : SKIP zip_code = hash.key?('ZIPCode') ? hash['ZIPCode'] : SKIP zip_plus4 = hash.key?('ZIPPlus4') ? hash['ZIPPlus4'] : SKIP delivery_point = hash.key?('deliveryPoint') ? hash['deliveryPoint'] : SKIP # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. NcoaDataServicesDomesticAddress.new(street_address: street_address, lastline: lastline, urbanization: urbanization, city: city, state_abbr: state_abbr, zip_code: zip_code, zip_plus4: zip_plus4, delivery_point: delivery_point, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/usps_api/models/ncoa_data_services_domestic_address.rb', line 46 def self.names @_hash = {} if @_hash.nil? @_hash['street_address'] = 'streetAddress' @_hash['lastline'] = 'lastline' @_hash['urbanization'] = 'urbanization' @_hash['city'] = 'city' @_hash['state_abbr'] = 'stateAbbr' @_hash['zip_code'] = 'ZIPCode' @_hash['zip_plus4'] = 'ZIPPlus4' @_hash['delivery_point'] = 'deliveryPoint' @_hash end |
.nullables ⇒ Object
An array for nullable fields
74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/usps_api/models/ncoa_data_services_domestic_address.rb', line 74 def self.nullables %w[ street_address lastline urbanization city state_abbr zip_code zip_plus4 delivery_point ] end |
.optionals ⇒ Object
An array for optional fields
60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/usps_api/models/ncoa_data_services_domestic_address.rb', line 60 def self.optionals %w[ street_address lastline urbanization city state_abbr zip_code zip_plus4 delivery_point ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
148 149 150 151 152 153 154 155 |
# File 'lib/usps_api/models/ncoa_data_services_domestic_address.rb', line 148 def inspect class_name = self.class.name.split('::').last "<#{class_name} street_address: #{@street_address.inspect}, lastline: #{@lastline.inspect},"\ " urbanization: #{@urbanization.inspect}, city: #{@city.inspect}, state_abbr:"\ " #{@state_abbr.inspect}, zip_code: #{@zip_code.inspect}, zip_plus4: #{@zip_plus4.inspect},"\ " delivery_point: #{@delivery_point.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
139 140 141 142 143 144 145 |
# File 'lib/usps_api/models/ncoa_data_services_domestic_address.rb', line 139 def to_s class_name = self.class.name.split('::').last "<#{class_name} street_address: #{@street_address}, lastline: #{@lastline}, urbanization:"\ " #{@urbanization}, city: #{@city}, state_abbr: #{@state_abbr}, zip_code: #{@zip_code},"\ " zip_plus4: #{@zip_plus4}, delivery_point: #{@delivery_point}, additional_properties:"\ " #{@additional_properties}>" end |