Class: UspsApi::SubscriptionsNcoaTheAddresseeInformation

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/usps_api/models/subscriptions_ncoa_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, last_line: SKIP, urbanization: SKIP, additional_properties: nil) ⇒ SubscriptionsNcoaTheAddresseeInformation

Returns a new instance of SubscriptionsNcoaTheAddresseeInformation.



65
66
67
68
69
70
71
72
73
74
75
# File 'lib/usps_api/models/subscriptions_ncoa_the_addressee_information.rb', line 65

def initialize(full_name: SKIP, street_address: SKIP, last_line: SKIP,
               urbanization: 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
  @last_line = last_line unless last_line == SKIP
  @urbanization = urbanization unless urbanization == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#full_nameString

“The full name of the addressee. This can be a person or a business. If the subscription is for a person, the full name should include the first name, middle initial (if applicable), and last name. If the subscription is for a business, the full name should be the business name. The full name should not include any part of the address such as street or city.

It should only include the name of the person or business associated with the address.“

Returns:

  • (String)


21
22
23
# File 'lib/usps_api/models/subscriptions_ncoa_the_addressee_information.rb', line 21

def full_name
  @full_name
end

#last_lineString

City State ZIP Code

Returns:

  • (String)


30
31
32
# File 'lib/usps_api/models/subscriptions_ncoa_the_addressee_information.rb', line 30

def last_line
  @last_line
end

#street_addressString

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

Returns:

  • (String)


26
27
28
# File 'lib/usps_api/models/subscriptions_ncoa_the_addressee_information.rb', line 26

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)


35
36
37
# File 'lib/usps_api/models/subscriptions_ncoa_the_addressee_information.rb', line 35

def urbanization
  @urbanization
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/usps_api/models/subscriptions_ncoa_the_addressee_information.rb', line 78

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
  last_line = hash.key?('lastLine') ? hash['lastLine'] : SKIP
  urbanization = hash.key?('urbanization') ? hash['urbanization'] : 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.
  SubscriptionsNcoaTheAddresseeInformation.new(full_name: full_name,
                                               street_address: street_address,
                                               last_line: last_line,
                                               urbanization: urbanization,
                                               additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



38
39
40
41
42
43
44
45
# File 'lib/usps_api/models/subscriptions_ncoa_the_addressee_information.rb', line 38

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

.nullablesObject

An array for nullable fields



58
59
60
61
62
63
# File 'lib/usps_api/models/subscriptions_ncoa_the_addressee_information.rb', line 58

def self.nullables
  %w[
    street_address
    urbanization
  ]
end

.optionalsObject

An array for optional fields



48
49
50
51
52
53
54
55
# File 'lib/usps_api/models/subscriptions_ncoa_the_addressee_information.rb', line 48

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



111
112
113
114
115
116
# File 'lib/usps_api/models/subscriptions_ncoa_the_addressee_information.rb', line 111

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

#to_sObject

Provides a human-readable string representation of the object.



103
104
105
106
107
108
# File 'lib/usps_api/models/subscriptions_ncoa_the_addressee_information.rb', line 103

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