Class: VisaAcceptanceMergedSpec::InfoCodes

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/visa_acceptance_merged_spec/models/info_codes.rb

Overview

InfoCodes 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(velocity: SKIP, address: SKIP, customer_list: SKIP, device_behavior: SKIP, identity_change: SKIP, internet: SKIP, phone: SKIP, suspicious: SKIP, global_velocity: SKIP, additional_properties: nil) ⇒ InfoCodes

Returns a new instance of InfoCodes.



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/visa_acceptance_merged_spec/models/info_codes.rb', line 93

def initialize(velocity: SKIP, address: SKIP, customer_list: SKIP,
               device_behavior: SKIP, identity_change: SKIP, internet: SKIP,
               phone: SKIP, suspicious: SKIP, global_velocity: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @velocity = velocity unless velocity == SKIP
  @address = address unless address == SKIP
  @customer_list = customer_list unless customer_list == SKIP
  @device_behavior = device_behavior unless device_behavior == SKIP
  @identity_change = identity_change unless identity_change == SKIP
  @internet = internet unless internet == SKIP
  @phone = phone unless phone == SKIP
  @suspicious = suspicious unless suspicious == SKIP
  @global_velocity = global_velocity unless global_velocity == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#addressArray[String]

Indicates a mismatch between the customer’s billing and shipping addresses.

Returns:

  • (Array[String])


22
23
24
# File 'lib/visa_acceptance_merged_spec/models/info_codes.rb', line 22

def address
  @address
end

#customer_listArray[String]

Indicates that customer information is associated with transactions that are either on the negative or the positive list.

Returns:

  • (Array[String])


28
29
30
# File 'lib/visa_acceptance_merged_spec/models/info_codes.rb', line 28

def customer_list
  @customer_list
end

#device_behaviorArray[String]

Indicates the device behavior information code(s) returned from device fingerprinting.

Returns:

  • (Array[String])


33
34
35
# File 'lib/visa_acceptance_merged_spec/models/info_codes.rb', line 33

def device_behavior
  @device_behavior
end

#global_velocityArray[String]

Indicates that the customer has a high purchase frequency.

Returns:

  • (Array[String])


56
57
58
# File 'lib/visa_acceptance_merged_spec/models/info_codes.rb', line 56

def global_velocity
  @global_velocity
end

#identity_changeArray[String]

Indicates excessive identity changes. The threshold is variable depending on the identity elements being compared.

Returns:

  • (Array[String])


39
40
41
# File 'lib/visa_acceptance_merged_spec/models/info_codes.rb', line 39

def identity_change
  @identity_change
end

#internetArray[String]

Indicates a problem with the customer’s email address, IP address, or billing address.

Returns:

  • (Array[String])


44
45
46
# File 'lib/visa_acceptance_merged_spec/models/info_codes.rb', line 44

def internet
  @internet
end

#phoneArray[String]

Indicates a problem with the customer’s phone number.

Returns:

  • (Array[String])


48
49
50
# File 'lib/visa_acceptance_merged_spec/models/info_codes.rb', line 48

def phone
  @phone
end

#suspiciousArray[String]

Indicates that the customer provided potentially suspicious information.

Returns:

  • (Array[String])


52
53
54
# File 'lib/visa_acceptance_merged_spec/models/info_codes.rb', line 52

def suspicious
  @suspicious
end

#velocityArray[String]

List of information codes triggered by the order. These information codes were generated when you created the order and product velocity rules and are returned so that you can associate them with the rules.

Returns:

  • (Array[String])


17
18
19
# File 'lib/visa_acceptance_merged_spec/models/info_codes.rb', line 17

def velocity
  @velocity
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
# File 'lib/visa_acceptance_merged_spec/models/info_codes.rb', line 113

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  velocity = hash.key?('velocity') ? hash['velocity'] : SKIP
  address = hash.key?('address') ? hash['address'] : SKIP
  customer_list = hash.key?('customerList') ? hash['customerList'] : SKIP
  device_behavior =
    hash.key?('deviceBehavior') ? hash['deviceBehavior'] : SKIP
  identity_change =
    hash.key?('identityChange') ? hash['identityChange'] : SKIP
  internet = hash.key?('internet') ? hash['internet'] : SKIP
  phone = hash.key?('phone') ? hash['phone'] : SKIP
  suspicious = hash.key?('suspicious') ? hash['suspicious'] : SKIP
  global_velocity =
    hash.key?('globalVelocity') ? hash['globalVelocity'] : 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.
  InfoCodes.new(velocity: velocity,
                address: address,
                customer_list: customer_list,
                device_behavior: device_behavior,
                identity_change: identity_change,
                internet: internet,
                phone: phone,
                suspicious: suspicious,
                global_velocity: global_velocity,
                additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['velocity'] = 'velocity'
  @_hash['address'] = 'address'
  @_hash['customer_list'] = 'customerList'
  @_hash['device_behavior'] = 'deviceBehavior'
  @_hash['identity_change'] = 'identityChange'
  @_hash['internet'] = 'internet'
  @_hash['phone'] = 'phone'
  @_hash['suspicious'] = 'suspicious'
  @_hash['global_velocity'] = 'globalVelocity'
  @_hash
end

.nullablesObject

An array for nullable fields



89
90
91
# File 'lib/visa_acceptance_merged_spec/models/info_codes.rb', line 89

def self.nullables
  []
end

.optionalsObject

An array for optional fields



74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/visa_acceptance_merged_spec/models/info_codes.rb', line 74

def self.optionals
  %w[
    velocity
    address
    customer_list
    device_behavior
    identity_change
    internet
    phone
    suspicious
    global_velocity
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



160
161
162
163
164
165
166
167
# File 'lib/visa_acceptance_merged_spec/models/info_codes.rb', line 160

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} velocity: #{@velocity.inspect}, address: #{@address.inspect},"\
  " customer_list: #{@customer_list.inspect}, device_behavior: #{@device_behavior.inspect},"\
  " identity_change: #{@identity_change.inspect}, internet: #{@internet.inspect}, phone:"\
  " #{@phone.inspect}, suspicious: #{@suspicious.inspect}, global_velocity:"\
  " #{@global_velocity.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



151
152
153
154
155
156
157
# File 'lib/visa_acceptance_merged_spec/models/info_codes.rb', line 151

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} velocity: #{@velocity}, address: #{@address}, customer_list:"\
  " #{@customer_list}, device_behavior: #{@device_behavior}, identity_change:"\
  " #{@identity_change}, internet: #{@internet}, phone: #{@phone}, suspicious: #{@suspicious},"\
  " global_velocity: #{@global_velocity}, additional_properties: #{@additional_properties}>"
end