Class: UspsApi::FacilityInfo
- Defined in:
- lib/usps_api/models/facility_info.rb
Overview
Address of the destination entry facility the container will be brought to.
Instance Attribute Summary collapse
-
#address ⇒ String
The address of the facility.
-
#city ⇒ String
The city the facility is located in.
-
#label ⇒ String
The name of the facility as it appears on the label.
-
#state ⇒ String
The state the facility is located in.
-
#supported_zips ⇒ String
A list of zip codes supported by the facility.
-
#zip_code ⇒ String
The 5 digit zip code the facility is located in.
-
#zip_plus4 ⇒ String
The 4-digit component of the ZIP+4 code the facility is located in.
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(label: SKIP, supported_zips: SKIP, address: SKIP, city: SKIP, state: SKIP, zip_code: SKIP, zip_plus4: SKIP) ⇒ FacilityInfo
constructor
A new instance of FacilityInfo.
-
#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(label: SKIP, supported_zips: SKIP, address: SKIP, city: SKIP, state: SKIP, zip_code: SKIP, zip_plus4: SKIP) ⇒ FacilityInfo
Returns a new instance of FacilityInfo.
71 72 73 74 75 76 77 78 79 80 |
# File 'lib/usps_api/models/facility_info.rb', line 71 def initialize(label: SKIP, supported_zips: SKIP, address: SKIP, city: SKIP, state: SKIP, zip_code: SKIP, zip_plus4: SKIP) @label = label unless label == SKIP @supported_zips = supported_zips unless supported_zips == SKIP @address = address unless address == SKIP @city = city unless city == SKIP @state = state unless state == SKIP @zip_code = zip_code unless zip_code == SKIP @zip_plus4 = zip_plus4 unless zip_plus4 == SKIP end |
Instance Attribute Details
#address ⇒ String
The address of the facility
22 23 24 |
# File 'lib/usps_api/models/facility_info.rb', line 22 def address @address end |
#city ⇒ String
The city the facility is located in
26 27 28 |
# File 'lib/usps_api/models/facility_info.rb', line 26 def city @city end |
#label ⇒ String
The name of the facility as it appears on the label
14 15 16 |
# File 'lib/usps_api/models/facility_info.rb', line 14 def label @label end |
#state ⇒ String
The state the facility is located in
30 31 32 |
# File 'lib/usps_api/models/facility_info.rb', line 30 def state @state end |
#supported_zips ⇒ String
A list of zip codes supported by the facility
18 19 20 |
# File 'lib/usps_api/models/facility_info.rb', line 18 def supported_zips @supported_zips end |
#zip_code ⇒ String
The 5 digit zip code the facility is located in
34 35 36 |
# File 'lib/usps_api/models/facility_info.rb', line 34 def zip_code @zip_code end |
#zip_plus4 ⇒ String
The 4-digit component of the ZIP+4 code the facility is located in
38 39 40 |
# File 'lib/usps_api/models/facility_info.rb', line 38 def zip_plus4 @zip_plus4 end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/usps_api/models/facility_info.rb', line 83 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. label = hash.key?('label') ? hash['label'] : SKIP supported_zips = hash.key?('supportedZips') ? hash['supportedZips'] : SKIP address = hash.key?('address') ? hash['address'] : SKIP city = hash.key?('city') ? hash['city'] : SKIP state = hash.key?('state') ? hash['state'] : SKIP zip_code = hash.key?('ZIPCode') ? hash['ZIPCode'] : SKIP zip_plus4 = hash.key?('ZIPPlus4') ? hash['ZIPPlus4'] : SKIP # Create object from extracted values. FacilityInfo.new(label: label, supported_zips: supported_zips, address: address, city: city, state: state, zip_code: zip_code, zip_plus4: zip_plus4) end |
.names ⇒ Object
A mapping from model property names to API property names.
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/usps_api/models/facility_info.rb', line 41 def self.names @_hash = {} if @_hash.nil? @_hash['label'] = 'label' @_hash['supported_zips'] = 'supportedZips' @_hash['address'] = 'address' @_hash['city'] = 'city' @_hash['state'] = 'state' @_hash['zip_code'] = 'ZIPCode' @_hash['zip_plus4'] = 'ZIPPlus4' @_hash end |
.nullables ⇒ Object
An array for nullable fields
67 68 69 |
# File 'lib/usps_api/models/facility_info.rb', line 67 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/usps_api/models/facility_info.rb', line 54 def self.optionals %w[ label supported_zips address city state zip_code zip_plus4 ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
113 114 115 116 117 118 |
# File 'lib/usps_api/models/facility_info.rb', line 113 def inspect class_name = self.class.name.split('::').last "<#{class_name} label: #{@label.inspect}, supported_zips: #{@supported_zips.inspect},"\ " address: #{@address.inspect}, city: #{@city.inspect}, state: #{@state.inspect}, zip_code:"\ " #{@zip_code.inspect}, zip_plus4: #{@zip_plus4.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
106 107 108 109 110 |
# File 'lib/usps_api/models/facility_info.rb', line 106 def to_s class_name = self.class.name.split('::').last "<#{class_name} label: #{@label}, supported_zips: #{@supported_zips}, address: #{@address},"\ " city: #{@city}, state: #{@state}, zip_code: #{@zip_code}, zip_plus4: #{@zip_plus4}>" end |