Class: UspsApi::AddressesAddressResponse1
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UspsApi::AddressesAddressResponse1
- Defined in:
- lib/usps_api/models/addresses_address_response1.rb
Overview
Standardizes street addresses including city and street abbreviations, and provides missing information such as ZIP Code™ and ZIP + 4®.
Instance Attribute Summary collapse
-
#additional_info ⇒ AddressesAddressAdditionalInformation1
Extra information about the request.
-
#address ⇒ AddressesDomesticAddress
Address fields for US locations.
-
#firm_name ⇒ String
This is the firm/business name at the address.
-
#warnings ⇒ Array[String]
Array of warnings.
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(firm_name: SKIP, address: SKIP, additional_info: SKIP, warnings: SKIP) ⇒ AddressesAddressResponse1
constructor
A new instance of AddressesAddressResponse1.
-
#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(firm_name: SKIP, address: SKIP, additional_info: SKIP, warnings: SKIP) ⇒ AddressesAddressResponse1
Returns a new instance of AddressesAddressResponse1.
54 55 56 57 58 59 60 |
# File 'lib/usps_api/models/addresses_address_response1.rb', line 54 def initialize(firm_name: SKIP, address: SKIP, additional_info: SKIP, warnings: SKIP) @firm_name = firm_name unless firm_name == SKIP @address = address unless address == SKIP @additional_info = additional_info unless additional_info == SKIP @warnings = warnings unless warnings == SKIP end |
Instance Attribute Details
#additional_info ⇒ AddressesAddressAdditionalInformation1
Extra information about the request.
23 24 25 |
# File 'lib/usps_api/models/addresses_address_response1.rb', line 23 def additional_info @additional_info end |
#address ⇒ AddressesDomesticAddress
Address fields for US locations
19 20 21 |
# File 'lib/usps_api/models/addresses_address_response1.rb', line 19 def address @address end |
#firm_name ⇒ String
This is the firm/business name at the address.
15 16 17 |
# File 'lib/usps_api/models/addresses_address_response1.rb', line 15 def firm_name @firm_name end |
#warnings ⇒ Array[String]
Array of warnings
27 28 29 |
# File 'lib/usps_api/models/addresses_address_response1.rb', line 27 def warnings @warnings end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/usps_api/models/addresses_address_response1.rb', line 63 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. firm_name = hash.key?('firmName') ? hash['firmName'] : SKIP address = AddressesDomesticAddress.from_hash(hash['address']) if hash['address'] additional_info = AddressesAddressAdditionalInformation1.from_hash(hash['additionalInfo']) if hash['additionalInfo'] warnings = hash.key?('warnings') ? hash['warnings'] : SKIP # Create object from extracted values. AddressesAddressResponse1.new(firm_name: firm_name, address: address, additional_info: additional_info, warnings: warnings) end |
.names ⇒ Object
A mapping from model property names to API property names.
30 31 32 33 34 35 36 37 |
# File 'lib/usps_api/models/addresses_address_response1.rb', line 30 def self.names @_hash = {} if @_hash.nil? @_hash['firm_name'] = 'firmName' @_hash['address'] = 'address' @_hash['additional_info'] = 'additionalInfo' @_hash['warnings'] = 'warnings' @_hash end |
.nullables ⇒ Object
An array for nullable fields
50 51 52 |
# File 'lib/usps_api/models/addresses_address_response1.rb', line 50 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
40 41 42 43 44 45 46 47 |
# File 'lib/usps_api/models/addresses_address_response1.rb', line 40 def self.optionals %w[ firm_name address additional_info warnings ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
88 89 90 91 92 |
# File 'lib/usps_api/models/addresses_address_response1.rb', line 88 def inspect class_name = self.class.name.split('::').last "<#{class_name} firm_name: #{@firm_name.inspect}, address: #{@address.inspect},"\ " additional_info: #{@additional_info.inspect}, warnings: #{@warnings.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
81 82 83 84 85 |
# File 'lib/usps_api/models/addresses_address_response1.rb', line 81 def to_s class_name = self.class.name.split('::').last "<#{class_name} firm_name: #{@firm_name}, address: #{@address}, additional_info:"\ " #{@additional_info}, warnings: #{@warnings}>" end |