Class: UspsApi::SubscriptionsNcoaChangeOfAddressDetailFields1

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

Overview

Shared attributes between internal and external requests.

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(new_street_address: SKIP, new_last_line: SKIP, new_city: SKIP, new_state_abbrevation: SKIP, new_zip_code: SKIP, move_effective_date: SKIP, new_zip_plus4: SKIP, new_urbanization: SKIP) ⇒ SubscriptionsNcoaChangeOfAddressDetailFields1

Returns a new instance of SubscriptionsNcoaChangeOfAddressDetailFields1.



77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/usps_api/models/subscriptions_ncoa_change_of_address_detail_fields1.rb', line 77

def initialize(new_street_address: SKIP, new_last_line: SKIP,
               new_city: SKIP, new_state_abbrevation: SKIP,
               new_zip_code: SKIP, move_effective_date: SKIP,
               new_zip_plus4: SKIP, new_urbanization: SKIP)
  @new_street_address = new_street_address unless new_street_address == SKIP
  @new_last_line = new_last_line unless new_last_line == SKIP
  @new_city = new_city unless new_city == SKIP
  @new_state_abbrevation = new_state_abbrevation unless new_state_abbrevation == SKIP
  @new_zip_code = new_zip_code unless new_zip_code == SKIP
  @move_effective_date = move_effective_date unless move_effective_date == SKIP
  @new_zip_plus4 = new_zip_plus4 unless new_zip_plus4 == SKIP
  @new_urbanization = new_urbanization unless new_urbanization == SKIP
end

Instance Attribute Details

#move_effective_dateDate

Date move is created.

Returns:

  • (Date)


34
35
36
# File 'lib/usps_api/models/subscriptions_ncoa_change_of_address_detail_fields1.rb', line 34

def move_effective_date
  @move_effective_date
end

#new_cityString

New City.

Returns:

  • (String)


22
23
24
# File 'lib/usps_api/models/subscriptions_ncoa_change_of_address_detail_fields1.rb', line 22

def new_city
  @new_city
end

#new_last_lineString

New City State ZIP.

Returns:

  • (String)


18
19
20
# File 'lib/usps_api/models/subscriptions_ncoa_change_of_address_detail_fields1.rb', line 18

def new_last_line
  @new_last_line
end

#new_state_abbrevationString

The two-character state code.

Returns:

  • (String)


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

def new_state_abbrevation
  @new_state_abbrevation
end

#new_street_addressString

New Street Address.

Returns:

  • (String)


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

def new_street_address
  @new_street_address
end

#new_urbanizationString

New Urbanization.

Returns:

  • (String)


42
43
44
# File 'lib/usps_api/models/subscriptions_ncoa_change_of_address_detail_fields1.rb', line 42

def new_urbanization
  @new_urbanization
end

#new_zip_codeString

New ZIP Codeu2122.

Returns:

  • (String)


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

def new_zip_code
  @new_zip_code
end

#new_zip_plus4String

New ZIP Addon.

Returns:

  • (String)


38
39
40
# File 'lib/usps_api/models/subscriptions_ncoa_change_of_address_detail_fields1.rb', line 38

def new_zip_plus4
  @new_zip_plus4
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/usps_api/models/subscriptions_ncoa_change_of_address_detail_fields1.rb', line 92

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  new_street_address =
    hash.key?('newStreetAddress') ? hash['newStreetAddress'] : SKIP
  new_last_line = hash.key?('newLastLine') ? hash['newLastLine'] : SKIP
  new_city = hash.key?('newCity') ? hash['newCity'] : SKIP
  new_state_abbrevation =
    hash.key?('newStateAbbrevation') ? hash['newStateAbbrevation'] : SKIP
  new_zip_code = hash.key?('newZIPCode') ? hash['newZIPCode'] : SKIP
  move_effective_date =
    hash.key?('moveEffectiveDate') ? hash['moveEffectiveDate'] : SKIP
  new_zip_plus4 = hash.key?('newZIPPlus4') ? hash['newZIPPlus4'] : SKIP
  new_urbanization =
    hash.key?('newUrbanization') ? hash['newUrbanization'] : SKIP

  # Create object from extracted values.
  SubscriptionsNcoaChangeOfAddressDetailFields1.new(new_street_address: new_street_address,
                                                    new_last_line: new_last_line,
                                                    new_city: new_city,
                                                    new_state_abbrevation: new_state_abbrevation,
                                                    new_zip_code: new_zip_code,
                                                    move_effective_date: move_effective_date,
                                                    new_zip_plus4: new_zip_plus4,
                                                    new_urbanization: new_urbanization)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['new_street_address'] = 'newStreetAddress'
  @_hash['new_last_line'] = 'newLastLine'
  @_hash['new_city'] = 'newCity'
  @_hash['new_state_abbrevation'] = 'newStateAbbrevation'
  @_hash['new_zip_code'] = 'newZIPCode'
  @_hash['move_effective_date'] = 'moveEffectiveDate'
  @_hash['new_zip_plus4'] = 'newZIPPlus4'
  @_hash['new_urbanization'] = 'newUrbanization'
  @_hash
end

.nullablesObject

An array for nullable fields



73
74
75
# File 'lib/usps_api/models/subscriptions_ncoa_change_of_address_detail_fields1.rb', line 73

def self.nullables
  []
end

.optionalsObject

An array for optional fields



59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/usps_api/models/subscriptions_ncoa_change_of_address_detail_fields1.rb', line 59

def self.optionals
  %w[
    new_street_address
    new_last_line
    new_city
    new_state_abbrevation
    new_zip_code
    move_effective_date
    new_zip_plus4
    new_urbanization
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



131
132
133
134
135
136
137
138
# File 'lib/usps_api/models/subscriptions_ncoa_change_of_address_detail_fields1.rb', line 131

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} new_street_address: #{@new_street_address.inspect}, new_last_line:"\
  " #{@new_last_line.inspect}, new_city: #{@new_city.inspect}, new_state_abbrevation:"\
  " #{@new_state_abbrevation.inspect}, new_zip_code: #{@new_zip_code.inspect},"\
  " move_effective_date: #{@move_effective_date.inspect}, new_zip_plus4:"\
  " #{@new_zip_plus4.inspect}, new_urbanization: #{@new_urbanization.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



121
122
123
124
125
126
127
128
# File 'lib/usps_api/models/subscriptions_ncoa_change_of_address_detail_fields1.rb', line 121

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} new_street_address: #{@new_street_address}, new_last_line:"\
  " #{@new_last_line}, new_city: #{@new_city}, new_state_abbrevation:"\
  " #{@new_state_abbrevation}, new_zip_code: #{@new_zip_code}, move_effective_date:"\
  " #{@move_effective_date}, new_zip_plus4: #{@new_zip_plus4}, new_urbanization:"\
  " #{@new_urbanization}>"
end