Class: CyberSourceMergedSpec::RiskAddressVerificationInformation

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/cyber_source_merged_spec/models/risk_address_verification_information.rb

Overview

RiskAddressVerificationInformation Model.

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(address_type: SKIP, bar_code: SKIP, applicable_region: SKIP, error_code: SKIP, status_code: SKIP, care_of: SKIP, match_score: SKIP, standard_address: SKIP, additional_properties: nil) ⇒ RiskAddressVerificationInformation

Returns a new instance of RiskAddressVerificationInformation.



137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/cyber_source_merged_spec/models/risk_address_verification_information.rb', line 137

def initialize(address_type: SKIP, bar_code: SKIP, applicable_region: SKIP,
               error_code: SKIP, status_code: SKIP, care_of: SKIP,
               match_score: SKIP, standard_address: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @address_type = address_type unless address_type == SKIP
  @bar_code = bar_code unless bar_code == SKIP
  @applicable_region = applicable_region unless applicable_region == SKIP
  @error_code = error_code unless error_code == SKIP
  @status_code = status_code unless status_code == SKIP
  @care_of = care_of unless care_of == SKIP
  @match_score = match_score unless match_score == SKIP
  @standard_address = standard_address unless standard_address == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#address_typeString

Contains the record type of the postal code with which the address was matched.

U.S. Addresses

Depending on the quantity and quality of the address information provided, this field contains one or two characters:

  • One character: sufficient correct information was provided to result in accurate matching.
  • Two characters: standardization would provide a better address if more or better input address information were available. The second character is D (default). Blank fields are unassigned. When an address cannot be standardized, how the input data was parsed determines the address type. In this case, standardization may indicate a street, rural route, highway contract, general delivery, or PO box.

All Other Countries

This field contains one of the following values:

  • P: Post.
  • S: Street.
  • x: Unknown.

Returns:

  • (String)


34
35
36
# File 'lib/cyber_source_merged_spec/models/risk_address_verification_information.rb', line 34

def address_type
  @address_type
end

#applicable_regionString

Value can be

  • Canada
  • US
  • International The values of errorCode and statusCode mean different things depending on the applicable region. Refer to the guide for more info.

Returns:

  • (String)


68
69
70
# File 'lib/cyber_source_merged_spec/models/risk_address_verification_information.rb', line 68

def applicable_region
  @applicable_region
end

#bar_codeBarCode

Contains the record type of the postal code with which the address was matched.

U.S. Addresses

Depending on the quantity and quality of the address information provided, this field contains one or two characters:

  • One character: sufficient correct information was provided to result in accurate matching.
  • Two characters: standardization would provide a better address if more or better input address information were available. The second character is D (default). Blank fields are unassigned. When an address cannot be standardized, how the input data was parsed determines the address type. In this case, standardization may indicate a street, rural route, highway contract, general delivery, or PO box.

All Other Countries

This field contains one of the following values:

  • P: Post.
  • S: Street.
  • x: Unknown.

Returns:



58
59
60
# File 'lib/cyber_source_merged_spec/models/risk_address_verification_information.rb', line 58

def bar_code
  @bar_code
end

#care_ofString

Care of data dropped from the standard address.

Returns:

  • (String)


86
87
88
# File 'lib/cyber_source_merged_spec/models/risk_address_verification_information.rb', line 86

def care_of
  @care_of
end

#error_codeString

Four-character error code returned for Canadian, US and international addresses. For possible values, see Verification Services guide. The meaning of the errorCode depends on value of applicableRegion.

Returns:

  • (String)


75
76
77
# File 'lib/cyber_source_merged_spec/models/risk_address_verification_information.rb', line 75

def error_code
  @error_code
end

#match_scoreInteger

Indicates the probable correctness of the address match. Returned for U.S. and Canadian addresses. Returns a value from 0-9, where 0 is most likely to be correct and 9 is least likely to be correct, or -1 if there is no address match.

Returns:

  • (Integer)


94
95
96
# File 'lib/cyber_source_merged_spec/models/risk_address_verification_information.rb', line 94

def match_score
  @match_score
end

#standard_addressStandardAddress

Indicates the probable correctness of the address match. Returned for U.S. and Canadian addresses. Returns a value from 0-9, where 0 is most likely to be correct and 9 is least likely to be correct, or -1 if there is no address match.

Returns:



102
103
104
# File 'lib/cyber_source_merged_spec/models/risk_address_verification_information.rb', line 102

def standard_address
  @standard_address
end

#status_codeString

Four-to-ten character status code returned for Canadian, US and international addresses. For possible values, see Verification Services guide. The meaning of the errorCode depends on value of applicableRegion.

Returns:

  • (String)


82
83
84
# File 'lib/cyber_source_merged_spec/models/risk_address_verification_information.rb', line 82

def status_code
  @status_code
end

Class Method Details

.from_element(root) ⇒ Object



190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'lib/cyber_source_merged_spec/models/risk_address_verification_information.rb', line 190

def self.from_element(root)
  address_type = XmlUtilities.from_element(root, 'addressType', String)
  bar_code = XmlUtilities.from_element(root, 'BarCode', BarCode)
  applicable_region = XmlUtilities.from_element(root, 'applicableRegion',
                                                String)
  error_code = XmlUtilities.from_element(root, 'errorCode', String)
  status_code = XmlUtilities.from_element(root, 'statusCode', String)
  care_of = XmlUtilities.from_element(root, 'careOf', String)
  match_score = XmlUtilities.from_element(root, 'matchScore', Integer)
  standard_address = XmlUtilities.from_element(root, 'StandardAddress',
                                               StandardAddress)

  new(address_type: address_type,
      bar_code: bar_code,
      applicable_region: applicable_region,
      error_code: error_code,
      status_code: status_code,
      care_of: care_of,
      match_score: match_score,
      standard_address: standard_address,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



156
157
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/cyber_source_merged_spec/models/risk_address_verification_information.rb', line 156

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  address_type = hash.key?('addressType') ? hash['addressType'] : SKIP
  bar_code = BarCode.from_hash(hash['barCode']) if hash['barCode']
  applicable_region =
    hash.key?('applicableRegion') ? hash['applicableRegion'] : SKIP
  error_code = hash.key?('errorCode') ? hash['errorCode'] : SKIP
  status_code = hash.key?('statusCode') ? hash['statusCode'] : SKIP
  care_of = hash.key?('careOf') ? hash['careOf'] : SKIP
  match_score = hash.key?('matchScore') ? hash['matchScore'] : SKIP
  standard_address = StandardAddress.from_hash(hash['standardAddress']) if
    hash['standardAddress']

  # 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.
  RiskAddressVerificationInformation.new(address_type: address_type,
                                         bar_code: bar_code,
                                         applicable_region: applicable_region,
                                         error_code: error_code,
                                         status_code: status_code,
                                         care_of: care_of,
                                         match_score: match_score,
                                         standard_address: standard_address,
                                         additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/cyber_source_merged_spec/models/risk_address_verification_information.rb', line 105

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['address_type'] = 'addressType'
  @_hash['bar_code'] = 'barCode'
  @_hash['applicable_region'] = 'applicableRegion'
  @_hash['error_code'] = 'errorCode'
  @_hash['status_code'] = 'statusCode'
  @_hash['care_of'] = 'careOf'
  @_hash['match_score'] = 'matchScore'
  @_hash['standard_address'] = 'standardAddress'
  @_hash
end

.nullablesObject

An array for nullable fields



133
134
135
# File 'lib/cyber_source_merged_spec/models/risk_address_verification_information.rb', line 133

def self.nullables
  []
end

.optionalsObject

An array for optional fields



119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/cyber_source_merged_spec/models/risk_address_verification_information.rb', line 119

def self.optionals
  %w[
    address_type
    bar_code
    applicable_region
    error_code
    status_code
    care_of
    match_score
    standard_address
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



242
243
244
245
246
247
248
249
# File 'lib/cyber_source_merged_spec/models/risk_address_verification_information.rb', line 242

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} address_type: #{@address_type.inspect}, bar_code: #{@bar_code.inspect},"\
  " applicable_region: #{@applicable_region.inspect}, error_code: #{@error_code.inspect},"\
  " status_code: #{@status_code.inspect}, care_of: #{@care_of.inspect}, match_score:"\
  " #{@match_score.inspect}, standard_address: #{@standard_address.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



233
234
235
236
237
238
239
# File 'lib/cyber_source_merged_spec/models/risk_address_verification_information.rb', line 233

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} address_type: #{@address_type}, bar_code: #{@bar_code}, applicable_region:"\
  " #{@applicable_region}, error_code: #{@error_code}, status_code: #{@status_code}, care_of:"\
  " #{@care_of}, match_score: #{@match_score}, standard_address: #{@standard_address},"\
  " additional_properties: #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/cyber_source_merged_spec/models/risk_address_verification_information.rb', line 213

def to_xml_element(doc, root_name)
  root = doc.create_element(root_name)

  XmlUtilities.add_as_subelement(doc, root, 'addressType', address_type)
  XmlUtilities.add_as_subelement(doc, root, 'BarCode', bar_code)
  XmlUtilities.add_as_subelement(doc, root, 'applicableRegion',
                                 applicable_region)
  XmlUtilities.add_as_subelement(doc, root, 'errorCode', error_code)
  XmlUtilities.add_as_subelement(doc, root, 'statusCode', status_code)
  XmlUtilities.add_as_subelement(doc, root, 'careOf', care_of)
  XmlUtilities.add_as_subelement(doc, root, 'matchScore', match_score)
  XmlUtilities.add_as_subelement(doc, root, 'StandardAddress',
                                 standard_address)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end