Class: Lob::UsComponents
- Inherits:
-
Object
- Object
- Lob::UsComponents
- Defined in:
- lib/lob/models/us_components.rb
Overview
A nested object containing a breakdown of each component of an address.
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#address_type ⇒ Object
Uses USPS’s [Residential Delivery Indicator (RDI)](www.usps.com/nationalpremieraccounts/rdi.htm) to identify whether an address is classified as residential or business.
-
#carrier_route ⇒ Object
A 4-character code assigned to a mail delivery route within a ZIP code.
-
#carrier_route_type ⇒ Object
The type of ‘components`.
-
#city ⇒ Object
Returns the value of attribute city.
-
#county ⇒ Object
County name of the address city.
-
#county_fips ⇒ Object
A 5-digit [FIPS county code](en.wikipedia.org/wiki/FIPS_county_code) which uniquely identifies ‘components`.
-
#default_building_address ⇒ Object
Designates whether or not the address is the default address for a building containing multiple delivery points.
-
#delivery_point_barcode ⇒ Object
A 12-digit identifier that uniquely identifies a delivery point (location where mail can be sent and received).
-
#extra_secondary_designator ⇒ Object
An extra (often unnecessary) secondary designator provided with the input address.
-
#extra_secondary_number ⇒ Object
An extra (often unnecessary) secondary number provided with the input address.
-
#latitude ⇒ Object
A positive or negative decimal indicating the geographic latitude of the address, specifying the north-to-south position of a location.
-
#longitude ⇒ Object
A positive or negative decimal indicating the geographic longitude of the address, specifying the north-to-south position of a location.
-
#pmb_designator ⇒ Object
Designator of a [CMRA-authorized](en.wikipedia.org/wiki/Commercial_mail_receiving_agency) private mailbox.
-
#pmb_number ⇒ Object
Number of a [CMRA-authorized](en.wikipedia.org/wiki/Commercial_mail_receiving_agency) private mailbox.
-
#po_box_only_flag ⇒ Object
Indicates the mailing facility for an address only supports PO Box deliveries and other forms of mail delivery are not available.
-
#primary_number ⇒ Object
The numeric or alphanumeric part of an address preceding the street name.
-
#record_type ⇒ Object
A description of the type of address.
-
#secondary_designator ⇒ Object
The standard USPS abbreviation describing the ‘components` (`STE`, `APT`, `BLDG`, etc).
-
#secondary_number ⇒ Object
Number of the apartment/unit/etc.
-
#state ⇒ Object
The [ISO 3166-2](en.wikipedia.org/wiki/ISO_3166-2) two letter code for the state.
-
#street_name ⇒ Object
The name of the street.
-
#street_postdirection ⇒ Object
Geographic direction following a street name (‘N`, `S`, `E`, `W`, `NE`, `SW`, `SE`, `NW`).
-
#street_predirection ⇒ Object
Geographic direction preceding a street name (‘N`, `S`, `E`, `W`, `NE`, `SW`, `SE`, `NW`).
-
#street_suffix ⇒ Object
The standard USPS abbreviation for the street suffix (‘ST`, `AVE`, `BLVD`, etc).
-
#zip_code ⇒ Object
The 5-digit ZIP code.
-
#zip_code_plus_4 ⇒ Object
Returns the value of attribute zip_code_plus_4.
-
#zip_code_type ⇒ Object
Returns the value of attribute zip_code_type.
Class Method Summary collapse
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ UsComponents
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ UsComponents
Initializes the object
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 |
# File 'lib/lob/models/us_components.rb', line 200 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Lob::UsComponents` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `Lob::UsComponents`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'primary_number') self.primary_number = attributes[:'primary_number'] end if attributes.key?(:'street_predirection') self.street_predirection = attributes[:'street_predirection'] end if attributes.key?(:'street_name') self.street_name = attributes[:'street_name'] end if attributes.key?(:'street_suffix') self.street_suffix = attributes[:'street_suffix'] end if attributes.key?(:'street_postdirection') self.street_postdirection = attributes[:'street_postdirection'] end if attributes.key?(:'secondary_designator') self.secondary_designator = attributes[:'secondary_designator'] end if attributes.key?(:'secondary_number') self.secondary_number = attributes[:'secondary_number'] end if attributes.key?(:'pmb_designator') self.pmb_designator = attributes[:'pmb_designator'] end if attributes.key?(:'pmb_number') self.pmb_number = attributes[:'pmb_number'] end if attributes.key?(:'extra_secondary_designator') self.extra_secondary_designator = attributes[:'extra_secondary_designator'] end if attributes.key?(:'extra_secondary_number') self.extra_secondary_number = attributes[:'extra_secondary_number'] end if attributes.key?(:'city') self.city = attributes[:'city'] end if attributes.key?(:'state') self.state = attributes[:'state'] end if attributes.key?(:'zip_code') self.zip_code = attributes[:'zip_code'] end if attributes.key?(:'zip_code_plus_4') self.zip_code_plus_4 = attributes[:'zip_code_plus_4'] end if attributes.key?(:'zip_code_type') self.zip_code_type = attributes[:'zip_code_type'] end if attributes.key?(:'delivery_point_barcode') self. = attributes[:'delivery_point_barcode'] end if attributes.key?(:'address_type') self.address_type = attributes[:'address_type'] end if attributes.key?(:'record_type') self.record_type = attributes[:'record_type'] end if attributes.key?(:'default_building_address') self.default_building_address = attributes[:'default_building_address'] end if attributes.key?(:'county') self.county = attributes[:'county'] end if attributes.key?(:'county_fips') self.county_fips = attributes[:'county_fips'] end if attributes.key?(:'carrier_route') self.carrier_route = attributes[:'carrier_route'] end if attributes.key?(:'carrier_route_type') self.carrier_route_type = attributes[:'carrier_route_type'] end if attributes.key?(:'po_box_only_flag') self.po_box_only_flag = attributes[:'po_box_only_flag'] end if attributes.key?(:'latitude') self.latitude = attributes[:'latitude'] end if attributes.key?(:'longitude') self.longitude = attributes[:'longitude'] end end |
Instance Attribute Details
#address_type ⇒ Object
Uses USPS’s [Residential Delivery Indicator (RDI)](www.usps.com/nationalpremieraccounts/rdi.htm) to identify whether an address is classified as residential or business. Possible values are: * ‘residential` –– The address is residential or a PO Box. * `commercial` –– The address is commercial. * `”` –– Not enough information provided to be determined.
68 69 70 |
# File 'lib/lob/models/us_components.rb', line 68 def address_type @address_type end |
#carrier_route ⇒ Object
A 4-character code assigned to a mail delivery route within a ZIP code.
83 84 85 |
# File 'lib/lob/models/us_components.rb', line 83 def carrier_route @carrier_route end |
#carrier_route_type ⇒ Object
The type of ‘components`. For more detailed information about each carrier route type, see [US Verification Details](#tag/US-Verification-Types).
86 87 88 |
# File 'lib/lob/models/us_components.rb', line 86 def carrier_route_type @carrier_route_type end |
#city ⇒ Object
Returns the value of attribute city.
52 53 54 |
# File 'lib/lob/models/us_components.rb', line 52 def city @city end |
#county ⇒ Object
County name of the address city.
77 78 79 |
# File 'lib/lob/models/us_components.rb', line 77 def county @county end |
#county_fips ⇒ Object
A 5-digit [FIPS county code](en.wikipedia.org/wiki/FIPS_county_code) which uniquely identifies ‘components`. It consists of a 2-digit state code and a 3-digit county code.
80 81 82 |
# File 'lib/lob/models/us_components.rb', line 80 def county_fips @county_fips end |
#default_building_address ⇒ Object
Designates whether or not the address is the default address for a building containing multiple delivery points.
74 75 76 |
# File 'lib/lob/models/us_components.rb', line 74 def default_building_address @default_building_address end |
#delivery_point_barcode ⇒ Object
A 12-digit identifier that uniquely identifies a delivery point (location where mail can be sent and received). It consists of the 5-digit ZIP code (‘zip_code`), 4-digit ZIP+4 add-on (`zip_code_plus_4`), 2-digit delivery point, and 1-digit delivery point check digit.
65 66 67 |
# File 'lib/lob/models/us_components.rb', line 65 def @delivery_point_barcode end |
#extra_secondary_designator ⇒ Object
An extra (often unnecessary) secondary designator provided with the input address.
47 48 49 |
# File 'lib/lob/models/us_components.rb', line 47 def extra_secondary_designator @extra_secondary_designator end |
#extra_secondary_number ⇒ Object
An extra (often unnecessary) secondary number provided with the input address.
50 51 52 |
# File 'lib/lob/models/us_components.rb', line 50 def extra_secondary_number @extra_secondary_number end |
#latitude ⇒ Object
A positive or negative decimal indicating the geographic latitude of the address, specifying the north-to-south position of a location. This should be used with ‘longitude` to pinpoint locations on a map. Will not be returned for undeliverable addresses or military addresses (state is `AA`, `AE`, or `AP`).
92 93 94 |
# File 'lib/lob/models/us_components.rb', line 92 def latitude @latitude end |
#longitude ⇒ Object
A positive or negative decimal indicating the geographic longitude of the address, specifying the north-to-south position of a location. This should be used with ‘latitude` to pinpoint locations on a map. Will not be returned for undeliverable addresses or military addresses (state is `AA`, `AE`, or `AP`).
95 96 97 |
# File 'lib/lob/models/us_components.rb', line 95 def longitude @longitude end |
#pmb_designator ⇒ Object
Designator of a [CMRA-authorized](en.wikipedia.org/wiki/Commercial_mail_receiving_agency) private mailbox.
41 42 43 |
# File 'lib/lob/models/us_components.rb', line 41 def pmb_designator @pmb_designator end |
#pmb_number ⇒ Object
Number of a [CMRA-authorized](en.wikipedia.org/wiki/Commercial_mail_receiving_agency) private mailbox.
44 45 46 |
# File 'lib/lob/models/us_components.rb', line 44 def pmb_number @pmb_number end |
#po_box_only_flag ⇒ Object
Indicates the mailing facility for an address only supports PO Box deliveries and other forms of mail delivery are not available.
89 90 91 |
# File 'lib/lob/models/us_components.rb', line 89 def po_box_only_flag @po_box_only_flag end |
#primary_number ⇒ Object
The numeric or alphanumeric part of an address preceding the street name. Often the house, building, or PO Box number.
20 21 22 |
# File 'lib/lob/models/us_components.rb', line 20 def primary_number @primary_number end |
#record_type ⇒ Object
A description of the type of address. Populated if a DPV match is made (‘deliverability_analysis` is `Y`, `S`, or `D`). For more detailed information about each record type, see [US Verification Details](#tag/US-Verification-Types).
71 72 73 |
# File 'lib/lob/models/us_components.rb', line 71 def record_type @record_type end |
#secondary_designator ⇒ Object
The standard USPS abbreviation describing the ‘components` (`STE`, `APT`, `BLDG`, etc).
35 36 37 |
# File 'lib/lob/models/us_components.rb', line 35 def secondary_designator @secondary_designator end |
#secondary_number ⇒ Object
Number of the apartment/unit/etc.
38 39 40 |
# File 'lib/lob/models/us_components.rb', line 38 def secondary_number @secondary_number end |
#state ⇒ Object
The [ISO 3166-2](en.wikipedia.org/wiki/ISO_3166-2) two letter code for the state.
55 56 57 |
# File 'lib/lob/models/us_components.rb', line 55 def state @state end |
#street_name ⇒ Object
The name of the street.
26 27 28 |
# File 'lib/lob/models/us_components.rb', line 26 def street_name @street_name end |
#street_postdirection ⇒ Object
Geographic direction following a street name (‘N`, `S`, `E`, `W`, `NE`, `SW`, `SE`, `NW`).
32 33 34 |
# File 'lib/lob/models/us_components.rb', line 32 def street_postdirection @street_postdirection end |
#street_predirection ⇒ Object
Geographic direction preceding a street name (‘N`, `S`, `E`, `W`, `NE`, `SW`, `SE`, `NW`).
23 24 25 |
# File 'lib/lob/models/us_components.rb', line 23 def street_predirection @street_predirection end |
#street_suffix ⇒ Object
The standard USPS abbreviation for the street suffix (‘ST`, `AVE`, `BLVD`, etc).
29 30 31 |
# File 'lib/lob/models/us_components.rb', line 29 def street_suffix @street_suffix end |
#zip_code ⇒ Object
The 5-digit ZIP code
58 59 60 |
# File 'lib/lob/models/us_components.rb', line 58 def zip_code @zip_code end |
#zip_code_plus_4 ⇒ Object
Returns the value of attribute zip_code_plus_4.
60 61 62 |
# File 'lib/lob/models/us_components.rb', line 60 def zip_code_plus_4 @zip_code_plus_4 end |
#zip_code_type ⇒ Object
Returns the value of attribute zip_code_type.
62 63 64 |
# File 'lib/lob/models/us_components.rb', line 62 def zip_code_type @zip_code_type end |
Class Method Details
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
153 154 155 |
# File 'lib/lob/models/us_components.rb', line 153 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/lob/models/us_components.rb', line 120 def self.attribute_map { :'primary_number' => :'primary_number', :'street_predirection' => :'street_predirection', :'street_name' => :'street_name', :'street_suffix' => :'street_suffix', :'street_postdirection' => :'street_postdirection', :'secondary_designator' => :'secondary_designator', :'secondary_number' => :'secondary_number', :'pmb_designator' => :'pmb_designator', :'pmb_number' => :'pmb_number', :'extra_secondary_designator' => :'extra_secondary_designator', :'extra_secondary_number' => :'extra_secondary_number', :'city' => :'city', :'state' => :'state', :'zip_code' => :'zip_code', :'zip_code_plus_4' => :'zip_code_plus_4', :'zip_code_type' => :'zip_code_type', :'delivery_point_barcode' => :'delivery_point_barcode', :'address_type' => :'address_type', :'record_type' => :'record_type', :'default_building_address' => :'default_building_address', :'county' => :'county', :'county_fips' => :'county_fips', :'carrier_route' => :'carrier_route', :'carrier_route_type' => :'carrier_route_type', :'po_box_only_flag' => :'po_box_only_flag', :'latitude' => :'latitude', :'longitude' => :'longitude' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
662 663 664 |
# File 'lib/lob/models/us_components.rb', line 662 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
191 192 193 194 195 196 |
# File 'lib/lob/models/us_components.rb', line 191 def self.openapi_nullable Set.new([ :'latitude', :'longitude' ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/lob/models/us_components.rb', line 158 def self.openapi_types { :'primary_number' => :'String', :'street_predirection' => :'String', :'street_name' => :'String', :'street_suffix' => :'String', :'street_postdirection' => :'String', :'secondary_designator' => :'String', :'secondary_number' => :'String', :'pmb_designator' => :'String', :'pmb_number' => :'String', :'extra_secondary_designator' => :'String', :'extra_secondary_number' => :'String', :'city' => :'String', :'state' => :'String', :'zip_code' => :'String', :'zip_code_plus_4' => :'String', :'zip_code_type' => :'ZipCodeType', :'delivery_point_barcode' => :'String', :'address_type' => :'String', :'record_type' => :'String', :'default_building_address' => :'Boolean', :'county' => :'String', :'county_fips' => :'String', :'carrier_route' => :'String', :'carrier_route_type' => :'String', :'po_box_only_flag' => :'String', :'latitude' => :'Float', :'longitude' => :'Float' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 |
# File 'lib/lob/models/us_components.rb', line 614 def ==(o) return true if self.equal?(o) self.class == o.class && primary_number == o.primary_number && street_predirection == o.street_predirection && street_name == o.street_name && street_suffix == o.street_suffix && street_postdirection == o.street_postdirection && secondary_designator == o.secondary_designator && secondary_number == o.secondary_number && pmb_designator == o.pmb_designator && pmb_number == o.pmb_number && extra_secondary_designator == o.extra_secondary_designator && extra_secondary_number == o.extra_secondary_number && city == o.city && state == o.state && zip_code == o.zip_code && zip_code_plus_4 == o.zip_code_plus_4 && zip_code_type == o.zip_code_type && == o. && address_type == o.address_type && record_type == o.record_type && default_building_address == o.default_building_address && county == o.county && county_fips == o.county_fips && carrier_route == o.carrier_route && carrier_route_type == o.carrier_route_type && po_box_only_flag == o.po_box_only_flag && latitude == o.latitude && longitude == o.longitude end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 |
# File 'lib/lob/models/us_components.rb', line 701 def _deserialize(type, value) case type.to_sym when :Time Time.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model # models (e.g. Pet) or oneOf klass = Lob.const_get(type) klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
772 773 774 775 776 777 778 779 780 781 782 783 784 |
# File 'lib/lob/models/us_components.rb', line 772 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 |
# File 'lib/lob/models/us_components.rb', line 669 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) self.class.openapi_types.each_pair do |key, type| if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) self.send("#{key}=", nil) # // guardrails-disable-line elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) # // guardrails-disable-line end elsif !attributes[self.class.attribute_map[key]].nil? && type.kind_of?(Array) for base_type in type do res = _deserialize(base_type, attributes[self.class.attribute_map[key]]) if !res.nil? self.send("#{key}=", res) # // guardrails-disable-line break end end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) # // guardrails-disable-line end end self end |
#eql?(o) ⇒ Boolean
648 649 650 |
# File 'lib/lob/models/us_components.rb', line 648 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
654 655 656 |
# File 'lib/lob/models/us_components.rb', line 654 def hash [primary_number, street_predirection, street_name, street_suffix, street_postdirection, secondary_designator, secondary_number, pmb_designator, pmb_number, extra_secondary_designator, extra_secondary_number, city, state, zip_code, zip_code_plus_4, zip_code_type, , address_type, record_type, default_building_address, county, county_fips, carrier_route, carrier_route_type, po_box_only_flag, latitude, longitude].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 |
# File 'lib/lob/models/us_components.rb', line 324 def list_invalid_properties invalid_properties = Array.new if @primary_number.nil? invalid_properties.push('invalid value for "primary_number", primary_number cannot be nil.') end if @street_predirection.nil? invalid_properties.push('invalid value for "street_predirection", street_predirection cannot be nil.') end if @street_name.nil? invalid_properties.push('invalid value for "street_name", street_name cannot be nil.') end if @street_suffix.nil? invalid_properties.push('invalid value for "street_suffix", street_suffix cannot be nil.') end if @street_postdirection.nil? invalid_properties.push('invalid value for "street_postdirection", street_postdirection cannot be nil.') end if @secondary_designator.nil? invalid_properties.push('invalid value for "secondary_designator", secondary_designator cannot be nil.') end if @secondary_number.nil? invalid_properties.push('invalid value for "secondary_number", secondary_number cannot be nil.') end if @pmb_designator.nil? invalid_properties.push('invalid value for "pmb_designator", pmb_designator cannot be nil.') end if @pmb_number.nil? invalid_properties.push('invalid value for "pmb_number", pmb_number cannot be nil.') end if @extra_secondary_designator.nil? invalid_properties.push('invalid value for "extra_secondary_designator", extra_secondary_designator cannot be nil.') end if @extra_secondary_number.nil? invalid_properties.push('invalid value for "extra_secondary_number", extra_secondary_number cannot be nil.') end if @city.nil? invalid_properties.push('invalid value for "city", city cannot be nil.') end if @city.to_s.length > 200 invalid_properties.push('invalid value for "city", the character length must be smaller than or equal to 200.') end if @state.nil? invalid_properties.push('invalid value for "state", state cannot be nil.') end if @state.to_s.length > 2 invalid_properties.push('invalid value for "state", the character length must be smaller than or equal to 2.') end if @zip_code.nil? invalid_properties.push('invalid value for "zip_code", zip_code cannot be nil.') end pattern = Regexp.new(/(^$)|(^\d{5}$)/) if @zip_code !~ pattern invalid_properties.push("invalid value for \"zip_code\", must conform to the pattern #{pattern}.") end if @zip_code_plus_4.nil? invalid_properties.push('invalid value for "zip_code_plus_4", zip_code_plus_4 cannot be nil.') end pattern = Regexp.new(/^(\d{4})?$/) if @zip_code_plus_4 !~ pattern invalid_properties.push("invalid value for \"zip_code_plus_4\", must conform to the pattern #{pattern}.") end if @zip_code_type.nil? invalid_properties.push('invalid value for "zip_code_type", zip_code_type cannot be nil.') end if @delivery_point_barcode.nil? invalid_properties.push('invalid value for "delivery_point_barcode", delivery_point_barcode cannot be nil.') end if @address_type.nil? invalid_properties.push('invalid value for "address_type", address_type cannot be nil.') end if @record_type.nil? invalid_properties.push('invalid value for "record_type", record_type cannot be nil.') end if @default_building_address.nil? invalid_properties.push('invalid value for "default_building_address", default_building_address cannot be nil.') end if @county.nil? invalid_properties.push('invalid value for "county", county cannot be nil.') end if @county_fips.nil? invalid_properties.push('invalid value for "county_fips", county_fips cannot be nil.') end if @carrier_route.nil? invalid_properties.push('invalid value for "carrier_route", carrier_route cannot be nil.') end if @carrier_route_type.nil? invalid_properties.push('invalid value for "carrier_route_type", carrier_route_type cannot be nil.') end if @po_box_only_flag.nil? invalid_properties.push('invalid value for "po_box_only_flag", po_box_only_flag cannot be nil.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
748 749 750 |
# File 'lib/lob/models/us_components.rb', line 748 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
754 755 756 757 758 759 760 761 762 763 764 765 766 |
# File 'lib/lob/models/us_components.rb', line 754 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) # // guardrails-disable-line if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
742 743 744 |
# File 'lib/lob/models/us_components.rb', line 742 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 |
# File 'lib/lob/models/us_components.rb', line 449 def valid? return false if @primary_number.nil? return false if @street_predirection.nil? street_predirection_validator = EnumAttributeValidator.new('String', ["N", "S", "E", "W", "NE", "SW", "SE", "NW", ""]) return false unless street_predirection_validator.valid?(@street_predirection) return false if @street_name.nil? return false if @street_suffix.nil? return false if @street_postdirection.nil? street_postdirection_validator = EnumAttributeValidator.new('String', ["N", "S", "E", "W", "NE", "SW", "SE", "NW", ""]) return false unless street_postdirection_validator.valid?(@street_postdirection) return false if @secondary_designator.nil? return false if @secondary_number.nil? return false if @pmb_designator.nil? return false if @pmb_number.nil? return false if @extra_secondary_designator.nil? return false if @extra_secondary_number.nil? return false if @city.nil? return false if @city.to_s.length > 200 return false if @state.nil? return false if @state.to_s.length > 2 return false if @zip_code.nil? return false if @zip_code !~ Regexp.new(/(^$)|(^\d{5}$)/) return false if @zip_code_plus_4.nil? return false if @zip_code_plus_4 !~ Regexp.new(/^(\d{4})?$/) return false if @zip_code_type.nil? return false if @delivery_point_barcode.nil? return false if @address_type.nil? address_type_validator = EnumAttributeValidator.new('String', ["residential", "commercial", ""]) return false unless address_type_validator.valid?(@address_type) return false if @record_type.nil? record_type_validator = EnumAttributeValidator.new('String', ["street", "highrise", "firm", "po_box", "rural_route", "general_delivery", ""]) return false unless record_type_validator.valid?(@record_type) return false if @default_building_address.nil? return false if @county.nil? return false if @county_fips.nil? return false if @carrier_route.nil? return false if @carrier_route_type.nil? carrier_route_type_validator = EnumAttributeValidator.new('String', ["city_delivery", "rural_route", "highway_contract", "po_box", "general_delivery", ""]) return false unless carrier_route_type_validator.valid?(@carrier_route_type) return false if @po_box_only_flag.nil? po_box_only_flag_validator = EnumAttributeValidator.new('String', ["Y", "N", ""]) return false unless po_box_only_flag_validator.valid?(@po_box_only_flag) true end |