Class: CyberSourceMergedSpec::RiskInformation1

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

Overview

Contains the result of risk assessment.

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(profile: SKIP, rules: SKIP, info_codes: SKIP, velocity: SKIP, case_priority: SKIP, local_time: SKIP, score: SKIP, ip_address: SKIP, providers: SKIP, travel: SKIP, processor_results: SKIP, additional_properties: nil) ⇒ RiskInformation1

Returns a new instance of RiskInformation1.



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/cyber_source_merged_spec/models/risk_information1.rb', line 128

def initialize(profile: SKIP, rules: SKIP, info_codes: SKIP, velocity: SKIP,
               case_priority: SKIP, local_time: SKIP, score: SKIP,
               ip_address: SKIP, providers: SKIP, travel: SKIP,
               processor_results: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @profile = profile unless profile == SKIP
  @rules = rules unless rules == SKIP
  @info_codes = info_codes unless info_codes == SKIP
  @velocity = velocity unless velocity == SKIP
  @case_priority = case_priority unless case_priority == SKIP
  @local_time = local_time unless local_time == SKIP
  @score = score unless score == SKIP
  @ip_address = ip_address unless ip_address == SKIP
  @providers = providers unless providers == SKIP
  @travel = travel unless travel == SKIP
  @processor_results = processor_results unless processor_results == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#case_priorityInteger

You receive this field only if you subscribe to the Enhanced Case Management service. The priority level ranges from 1 (highest) to 5 (lowest); the default value is 3. If you do not assign a priority to your rules or to your profiles, the default value is given to the order. For all possible values, see the decision_case_priority field description in the Decision Manager Using the SCMP API Developer Guide on the CyberSource Business Center. Click Decision Manager > Documentation > Guides > Decision Manager Using the SCMP API Developer Guide (PDF link).

Returns:

  • (Integer)


38
39
40
# File 'lib/cyber_source_merged_spec/models/risk_information1.rb', line 38

def case_priority
  @case_priority
end

#info_codesInfoCodes

TODO: Write general description for this method

Returns:



22
23
24
# File 'lib/cyber_source_merged_spec/models/risk_information1.rb', line 22

def info_codes
  @info_codes
end

#ip_addressIpAddress

Contains detailed response information about the customer's IP address.

Returns:



60
61
62
# File 'lib/cyber_source_merged_spec/models/risk_information1.rb', line 60

def ip_address
  @ip_address
end

#local_timeString

The customer's local time (hh:mm:ss), which is calculated from the transaction request time and the customer's billing address. For details, see the score_time_local field description in the Decision Manager Using the SCMP API Developer Guide on the CyberSource Business Center.

Returns:

  • (String)


47
48
49
# File 'lib/cyber_source_merged_spec/models/risk_information1.rb', line 47

def local_time
  @local_time
end

#processor_resultsProcessorResults

Name of the 3rd party provider, for example, Emailage. For all possible values, see the decision_provider_#_name field description in the Decision Manager Using the SCMP API Developer Guide on the CyberSource Business Center. Click Decision Manager > Documentation > Guides > Decision Manager Using the SCMP API Developer Guide (PDF link).

Returns:



87
88
89
# File 'lib/cyber_source_merged_spec/models/risk_information1.rb', line 87

def processor_results
  @processor_results
end

#profileProfile1

TODO: Write general description for this method

Returns:



14
15
16
# File 'lib/cyber_source_merged_spec/models/risk_information1.rb', line 14

def profile
  @profile
end

#providersHash[String, String]

Name of the 3rd party provider, for example, Emailage. For all possible values, see the decision_provider_#_name field description in the Decision Manager Using the SCMP API Developer Guide on the CyberSource Business Center. Click Decision Manager > Documentation > Guides > Decision Manager Using the SCMP API Developer Guide (PDF link).

Returns:

  • (Hash[String, String])


69
70
71
# File 'lib/cyber_source_merged_spec/models/risk_information1.rb', line 69

def providers
  @providers
end

#rulesArray[Rule]

TODO: Write general description for this method

Returns:



18
19
20
# File 'lib/cyber_source_merged_spec/models/risk_information1.rb', line 18

def rules
  @rules
end

#scoreScore

The customer's local time (hh:mm:ss), which is calculated from the transaction request time and the customer's billing address. For details, see the score_time_local field description in the Decision Manager Using the SCMP API Developer Guide on the CyberSource Business Center.

Returns:



56
57
58
# File 'lib/cyber_source_merged_spec/models/risk_information1.rb', line 56

def score
  @score
end

#travelTravel

Name of the 3rd party provider, for example, Emailage. For all possible values, see the decision_provider_#_name field description in the Decision Manager Using the SCMP API Developer Guide on the CyberSource Business Center. Click Decision Manager > Documentation > Guides > Decision Manager Using the SCMP API Developer Guide (PDF link).

Returns:



78
79
80
# File 'lib/cyber_source_merged_spec/models/risk_information1.rb', line 78

def travel
  @travel
end

#velocityVelocity

TODO: Write general description for this method

Returns:



26
27
28
# File 'lib/cyber_source_merged_spec/models/risk_information1.rb', line 26

def velocity
  @velocity
end

Class Method Details

.from_element(root) ⇒ Object



198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/cyber_source_merged_spec/models/risk_information1.rb', line 198

def self.from_element(root)
  profile = XmlUtilities.from_element(root, 'Profile1', Profile1)
  rules = XmlUtilities.from_element_to_array(root, 'Rule', Rule)
  info_codes = XmlUtilities.from_element(root, 'InfoCodes', InfoCodes)
  velocity = XmlUtilities.from_element(root, 'Velocity', Velocity)
  case_priority = XmlUtilities.from_element(root, 'casePriority', Integer)
  local_time = XmlUtilities.from_element(root, 'localTime', String)
  score = XmlUtilities.from_element(root, 'Score', Score)
  ip_address = XmlUtilities.from_element(root, 'IpAddress', IpAddress)
  providers = XmlUtilities.from_element_to_hash(root, 'providers', Hash)
  travel = XmlUtilities.from_element(root, 'Travel', Travel)
  processor_results = XmlUtilities.from_element(root, 'ProcessorResults',
                                                ProcessorResults)

  new(profile: profile,
      rules: rules,
      info_codes: info_codes,
      velocity: velocity,
      case_priority: case_priority,
      local_time: local_time,
      score: score,
      ip_address: ip_address,
      providers: providers,
      travel: travel,
      processor_results: processor_results,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



150
151
152
153
154
155
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
189
190
191
192
193
194
195
196
# File 'lib/cyber_source_merged_spec/models/risk_information1.rb', line 150

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  profile = Profile1.from_hash(hash['profile']) if hash['profile']
  # Parameter is an array, so we need to iterate through it
  rules = nil
  unless hash['rules'].nil?
    rules = []
    hash['rules'].each do |structure|
      rules << (Rule.from_hash(structure) if structure)
    end
  end

  rules = SKIP unless hash.key?('rules')
  info_codes = InfoCodes.from_hash(hash['infoCodes']) if hash['infoCodes']
  velocity = Velocity.from_hash(hash['velocity']) if hash['velocity']
  case_priority = hash.key?('casePriority') ? hash['casePriority'] : SKIP
  local_time = hash.key?('localTime') ? hash['localTime'] : SKIP
  score = Score.from_hash(hash['score']) if hash['score']
  ip_address = IpAddress.from_hash(hash['ipAddress']) if hash['ipAddress']
  providers = hash.key?('providers') ? hash['providers'] : SKIP
  travel = Travel.from_hash(hash['travel']) if hash['travel']
  processor_results = ProcessorResults.from_hash(hash['processorResults']) if
    hash['processorResults']

  # 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.
  RiskInformation1.new(profile: profile,
                       rules: rules,
                       info_codes: info_codes,
                       velocity: velocity,
                       case_priority: case_priority,
                       local_time: local_time,
                       score: score,
                       ip_address: ip_address,
                       providers: providers,
                       travel: travel,
                       processor_results: processor_results,
                       additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/cyber_source_merged_spec/models/risk_information1.rb', line 90

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['profile'] = 'profile'
  @_hash['rules'] = 'rules'
  @_hash['info_codes'] = 'infoCodes'
  @_hash['velocity'] = 'velocity'
  @_hash['case_priority'] = 'casePriority'
  @_hash['local_time'] = 'localTime'
  @_hash['score'] = 'score'
  @_hash['ip_address'] = 'ipAddress'
  @_hash['providers'] = 'providers'
  @_hash['travel'] = 'travel'
  @_hash['processor_results'] = 'processorResults'
  @_hash
end

.nullablesObject

An array for nullable fields



124
125
126
# File 'lib/cyber_source_merged_spec/models/risk_information1.rb', line 124

def self.nullables
  []
end

.optionalsObject

An array for optional fields



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/cyber_source_merged_spec/models/risk_information1.rb', line 107

def self.optionals
  %w[
    profile
    rules
    info_codes
    velocity
    case_priority
    local_time
    score
    ip_address
    providers
    travel
    processor_results
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



258
259
260
261
262
263
264
265
266
# File 'lib/cyber_source_merged_spec/models/risk_information1.rb', line 258

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} profile: #{@profile.inspect}, rules: #{@rules.inspect}, info_codes:"\
  " #{@info_codes.inspect}, velocity: #{@velocity.inspect}, case_priority:"\
  " #{@case_priority.inspect}, local_time: #{@local_time.inspect}, score: #{@score.inspect},"\
  " ip_address: #{@ip_address.inspect}, providers: #{@providers.inspect}, travel:"\
  " #{@travel.inspect}, processor_results: #{@processor_results.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



248
249
250
251
252
253
254
255
# File 'lib/cyber_source_merged_spec/models/risk_information1.rb', line 248

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} profile: #{@profile}, rules: #{@rules}, info_codes: #{@info_codes},"\
  " velocity: #{@velocity}, case_priority: #{@case_priority}, local_time: #{@local_time},"\
  " score: #{@score}, ip_address: #{@ip_address}, providers: #{@providers}, travel:"\
  " #{@travel}, processor_results: #{@processor_results}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/cyber_source_merged_spec/models/risk_information1.rb', line 226

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

  XmlUtilities.add_as_subelement(doc, root, 'Profile1', profile)
  XmlUtilities.add_array_as_subelement(doc, root, 'Rule', rules)
  XmlUtilities.add_as_subelement(doc, root, 'InfoCodes', info_codes)
  XmlUtilities.add_as_subelement(doc, root, 'Velocity', velocity)
  XmlUtilities.add_as_subelement(doc, root, 'casePriority', case_priority)
  XmlUtilities.add_as_subelement(doc, root, 'localTime', local_time)
  XmlUtilities.add_as_subelement(doc, root, 'Score', score)
  XmlUtilities.add_as_subelement(doc, root, 'IpAddress', ip_address)
  XmlUtilities.add_hash_as_subelement(doc, root, 'providers', providers)
  XmlUtilities.add_as_subelement(doc, root, 'Travel', travel)
  XmlUtilities.add_as_subelement(doc, root, 'ProcessorResults',
                                 processor_results)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end