Class: UspsApi::RecordsResponse
- Defined in:
- lib/usps_api/models/records_response.rb
Overview
The Returned List of records
Instance Attribute Summary collapse
-
#coa_beyond_months_count ⇒ Integer
Number of Records matched with a new address but outside requested number of Months.
-
#coa_found_count ⇒ Integer
Number of Records matched but no new address was available (e.g., MLNA, BCNO, new side wouldn’t +4 code).
-
#coa_match_count ⇒ Integer
Number of Records returning a new address (within requested number of Months).
-
#coa_no_match_count ⇒ Integer
Number of Records with no COA found on file.
-
#coa_not_allowed_match_count ⇒ Integer
Number of Records returned for COA match not allowed (e.g., middle name mismatch, conflicting directions, etc).
-
#number_of_months ⇒ Integer
Number of months passed for MED for Change of Address.
-
#record_count ⇒ Integer
Number of Records in records Array returned to customer.
-
#records ⇒ Array[Records]
Contains the records.
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(number_of_months: SKIP, record_count: SKIP, coa_beyond_months_count: SKIP, coa_match_count: SKIP, coa_no_match_count: SKIP, coa_found_count: SKIP, coa_not_allowed_match_count: SKIP, records: SKIP, additional_properties: nil) ⇒ RecordsResponse
constructor
A new instance of RecordsResponse.
-
#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(number_of_months: SKIP, record_count: SKIP, coa_beyond_months_count: SKIP, coa_match_count: SKIP, coa_no_match_count: SKIP, coa_found_count: SKIP, coa_not_allowed_match_count: SKIP, records: SKIP, additional_properties: nil) ⇒ RecordsResponse
Returns a new instance of RecordsResponse.
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/usps_api/models/records_response.rb', line 81 def initialize(number_of_months: SKIP, record_count: SKIP, coa_beyond_months_count: SKIP, coa_match_count: SKIP, coa_no_match_count: SKIP, coa_found_count: SKIP, coa_not_allowed_match_count: SKIP, records: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @number_of_months = number_of_months unless number_of_months == SKIP @record_count = record_count unless record_count == SKIP @coa_beyond_months_count = coa_beyond_months_count unless coa_beyond_months_count == SKIP @coa_match_count = coa_match_count unless coa_match_count == SKIP @coa_no_match_count = coa_no_match_count unless coa_no_match_count == SKIP @coa_found_count = coa_found_count unless coa_found_count == SKIP unless coa_not_allowed_match_count == SKIP @coa_not_allowed_match_count = coa_not_allowed_match_count end @records = records unless records == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#coa_beyond_months_count ⇒ Integer
Number of Records matched with a new address but outside requested number of Months.
23 24 25 |
# File 'lib/usps_api/models/records_response.rb', line 23 def coa_beyond_months_count @coa_beyond_months_count end |
#coa_found_count ⇒ Integer
Number of Records matched but no new address was available (e.g., MLNA, BCNO, new side wouldn’t +4 code).
37 38 39 |
# File 'lib/usps_api/models/records_response.rb', line 37 def coa_found_count @coa_found_count end |
#coa_match_count ⇒ Integer
Number of Records returning a new address (within requested number of Months).
28 29 30 |
# File 'lib/usps_api/models/records_response.rb', line 28 def coa_match_count @coa_match_count end |
#coa_no_match_count ⇒ Integer
Number of Records with no COA found on file.
32 33 34 |
# File 'lib/usps_api/models/records_response.rb', line 32 def coa_no_match_count @coa_no_match_count end |
#coa_not_allowed_match_count ⇒ Integer
Number of Records returned for COA match not allowed (e.g., middle name mismatch, conflicting directions, etc).
42 43 44 |
# File 'lib/usps_api/models/records_response.rb', line 42 def coa_not_allowed_match_count @coa_not_allowed_match_count end |
#number_of_months ⇒ Integer
Number of months passed for MED for Change of Address
14 15 16 |
# File 'lib/usps_api/models/records_response.rb', line 14 def number_of_months @number_of_months end |
#record_count ⇒ Integer
Number of Records in records Array returned to customer.
18 19 20 |
# File 'lib/usps_api/models/records_response.rb', line 18 def record_count @record_count end |
#records ⇒ Array[Records]
Contains the records
46 47 48 |
# File 'lib/usps_api/models/records_response.rb', line 46 def records @records end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 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 |
# File 'lib/usps_api/models/records_response.rb', line 104 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. number_of_months = hash.key?('numberOfMonths') ? hash['numberOfMonths'] : SKIP record_count = hash.key?('recordCount') ? hash['recordCount'] : SKIP coa_beyond_months_count = hash.key?('COABeyondMonthsCount') ? hash['COABeyondMonthsCount'] : SKIP coa_match_count = hash.key?('COAMatchCount') ? hash['COAMatchCount'] : SKIP coa_no_match_count = hash.key?('COANoMatchCount') ? hash['COANoMatchCount'] : SKIP coa_found_count = hash.key?('COAFoundCount') ? hash['COAFoundCount'] : SKIP coa_not_allowed_match_count = hash.key?('COANotAllowedMatchCount') ? hash['COANotAllowedMatchCount'] : SKIP # Parameter is an array, so we need to iterate through it records = nil unless hash['records'].nil? records = [] hash['records'].each do |structure| records << (Records.from_hash(structure) if structure) end end records = SKIP unless hash.key?('records') # 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. RecordsResponse.new(number_of_months: number_of_months, record_count: record_count, coa_beyond_months_count: coa_beyond_months_count, coa_match_count: coa_match_count, coa_no_match_count: coa_no_match_count, coa_found_count: coa_found_count, coa_not_allowed_match_count: coa_not_allowed_match_count, records: records, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/usps_api/models/records_response.rb', line 49 def self.names @_hash = {} if @_hash.nil? @_hash['number_of_months'] = 'numberOfMonths' @_hash['record_count'] = 'recordCount' @_hash['coa_beyond_months_count'] = 'COABeyondMonthsCount' @_hash['coa_match_count'] = 'COAMatchCount' @_hash['coa_no_match_count'] = 'COANoMatchCount' @_hash['coa_found_count'] = 'COAFoundCount' @_hash['coa_not_allowed_match_count'] = 'COANotAllowedMatchCount' @_hash['records'] = 'records' @_hash end |
.nullables ⇒ Object
An array for nullable fields
77 78 79 |
# File 'lib/usps_api/models/records_response.rb', line 77 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/usps_api/models/records_response.rb', line 63 def self.optionals %w[ number_of_months record_count coa_beyond_months_count coa_match_count coa_no_match_count coa_found_count coa_not_allowed_match_count records ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
162 163 164 165 166 167 168 169 170 |
# File 'lib/usps_api/models/records_response.rb', line 162 def inspect class_name = self.class.name.split('::').last "<#{class_name} number_of_months: #{@number_of_months.inspect}, record_count:"\ " #{@record_count.inspect}, coa_beyond_months_count: #{@coa_beyond_months_count.inspect},"\ " coa_match_count: #{@coa_match_count.inspect}, coa_no_match_count:"\ " #{@coa_no_match_count.inspect}, coa_found_count: #{@coa_found_count.inspect},"\ " coa_not_allowed_match_count: #{@coa_not_allowed_match_count.inspect}, records:"\ " #{@records.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
152 153 154 155 156 157 158 159 |
# File 'lib/usps_api/models/records_response.rb', line 152 def to_s class_name = self.class.name.split('::').last "<#{class_name} number_of_months: #{@number_of_months}, record_count: #{@record_count},"\ " coa_beyond_months_count: #{@coa_beyond_months_count}, coa_match_count:"\ " #{@coa_match_count}, coa_no_match_count: #{@coa_no_match_count}, coa_found_count:"\ " #{@coa_found_count}, coa_not_allowed_match_count: #{@coa_not_allowed_match_count},"\ " records: #{@records}, additional_properties: #{@additional_properties}>" end |