Class: UspsApi::NcoaDataServicesTheAddresseeInformation

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

Overview

The name and address of the user to search for.

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(full_name: SKIP, street_address: SKIP, lastline: SKIP, urbanization: SKIP, record_id: SKIP, additional_properties: nil) ⇒ NcoaDataServicesTheAddresseeInformation

Returns a new instance of NcoaDataServicesTheAddresseeInformation.



67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/usps_api/models/ncoa_data_services_the_addressee_information.rb', line 67

def initialize(full_name: SKIP, street_address: SKIP, lastline: SKIP,
               urbanization: SKIP, record_id: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @full_name = full_name unless full_name == SKIP
  @street_address = street_address unless street_address == SKIP
  @lastline = lastline unless lastline == SKIP
  @urbanization = urbanization unless urbanization == SKIP
  @record_id = record_id unless record_id == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#full_nameString

COA Full Name (Prefix, First Name, Middle Name, Last Name, Suffix)

Returns:

  • (String)


14
15
16
# File 'lib/usps_api/models/ncoa_data_services_the_addressee_information.rb', line 14

def full_name
  @full_name
end

#lastlineString

City State ZIP Code™

Returns:

  • (String)


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

def lastline
  @lastline
end

#record_idString

ID/Keyline/etc – anything to identify the customer record

Returns:

  • (String)


32
33
34
# File 'lib/usps_api/models/ncoa_data_services_the_addressee_information.rb', line 32

def record_id
  @record_id
end

#street_addressString

The number of a building along with the name of the road or street on which it is located.

Returns:

  • (String)


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

def street_address
  @street_address
end

#urbanizationString

An area, sector, or residential development within a geographic area (typically used for addresses in Puerto Rico)

Returns:

  • (String)


28
29
30
# File 'lib/usps_api/models/ncoa_data_services_the_addressee_information.rb', line 28

def urbanization
  @urbanization
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/usps_api/models/ncoa_data_services_the_addressee_information.rb', line 82

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  full_name = hash.key?('fullName') ? hash['fullName'] : SKIP
  street_address = hash.key?('streetAddress') ? hash['streetAddress'] : SKIP
  lastline = hash.key?('lastline') ? hash['lastline'] : SKIP
  urbanization = hash.key?('urbanization') ? hash['urbanization'] : SKIP
  record_id = hash.key?('recordID') ? hash['recordID'] : 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.
  NcoaDataServicesTheAddresseeInformation.new(full_name: full_name,
                                              street_address: street_address,
                                              lastline: lastline,
                                              urbanization: urbanization,
                                              record_id: record_id,
                                              additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



35
36
37
38
39
40
41
42
43
# File 'lib/usps_api/models/ncoa_data_services_the_addressee_information.rb', line 35

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['full_name'] = 'fullName'
  @_hash['street_address'] = 'streetAddress'
  @_hash['lastline'] = 'lastline'
  @_hash['urbanization'] = 'urbanization'
  @_hash['record_id'] = 'recordID'
  @_hash
end

.nullablesObject

An array for nullable fields



57
58
59
60
61
62
63
64
65
# File 'lib/usps_api/models/ncoa_data_services_the_addressee_information.rb', line 57

def self.nullables
  %w[
    full_name
    street_address
    lastline
    urbanization
    record_id
  ]
end

.optionalsObject

An array for optional fields



46
47
48
49
50
51
52
53
54
# File 'lib/usps_api/models/ncoa_data_services_the_addressee_information.rb', line 46

def self.optionals
  %w[
    full_name
    street_address
    lastline
    urbanization
    record_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



117
118
119
120
121
122
123
# File 'lib/usps_api/models/ncoa_data_services_the_addressee_information.rb', line 117

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} full_name: #{@full_name.inspect}, street_address:"\
  " #{@street_address.inspect}, lastline: #{@lastline.inspect}, urbanization:"\
  " #{@urbanization.inspect}, record_id: #{@record_id.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



109
110
111
112
113
114
# File 'lib/usps_api/models/ncoa_data_services_the_addressee_information.rb', line 109

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} full_name: #{@full_name}, street_address: #{@street_address}, lastline:"\
  " #{@lastline}, urbanization: #{@urbanization}, record_id: #{@record_id},"\
  " additional_properties: #{@additional_properties}>"
end