Class: VisaAcceptanceMergedSpec::RiskInformation

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

Overview

This object is only needed when you are requesting both payment and DM services at same time.

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, event_type: SKIP, buyer_history: SKIP, auxiliary_data: SKIP, additional_properties: nil) ⇒ RiskInformation

Returns a new instance of RiskInformation.



66
67
68
69
70
71
72
73
74
75
76
# File 'lib/visa_acceptance_merged_spec/models/risk_information.rb', line 66

def initialize(profile: SKIP, event_type: SKIP, buyer_history: SKIP,
               auxiliary_data: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @profile = profile unless profile == SKIP
  @event_type = event_type unless event_type == SKIP
  @buyer_history = buyer_history unless buyer_history == SKIP
  @auxiliary_data = auxiliary_data unless auxiliary_data == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#auxiliary_data ⇒ Array[AuxiliaryDatum]

Specifies one of the following types of events:

  • login
  • account_creation
  • account_update For regular payment transactions, do not send this field.

Returns:



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

def auxiliary_data
  @auxiliary_data
end

#buyer_history ⇒ BuyerHistory

Specifies one of the following types of events:

  • login
  • account_creation
  • account_update For regular payment transactions, do not send this field.

Returns:



31
32
33
# File 'lib/visa_acceptance_merged_spec/models/risk_information.rb', line 31

def buyer_history
  @buyer_history
end

#event_type ⇒ String

Specifies one of the following types of events:

  • login
  • account_creation
  • account_update For regular payment transactions, do not send this field.

Returns:

  • (String)


23
24
25
# File 'lib/visa_acceptance_merged_spec/models/risk_information.rb', line 23

def event_type
  @event_type
end

#profile ⇒ Profile3

TODO: Write general description for this method

Returns:



15
16
17
# File 'lib/visa_acceptance_merged_spec/models/risk_information.rb', line 15

def profile
  @profile
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
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/risk_information.rb', line 79

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  profile = Profile3.from_hash(hash['profile']) if hash['profile']
  event_type = hash.key?('eventType') ? hash['eventType'] : SKIP
  buyer_history = BuyerHistory.from_hash(hash['buyerHistory']) if hash['buyerHistory']
  # Parameter is an array, so we need to iterate through it
  auxiliary_data = nil
  unless hash['auxiliaryData'].nil?
    auxiliary_data = []
    hash['auxiliaryData'].each do |structure|
      auxiliary_data << (AuxiliaryDatum.from_hash(structure) if structure)
    end
  end

  auxiliary_data = SKIP unless hash.key?('auxiliaryData')

  # 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.
  RiskInformation.new(profile: profile,
                      event_type: event_type,
                      buyer_history: buyer_history,
                      auxiliary_data: auxiliary_data,
                      additional_properties: additional_properties)
end

.names ⇒ Object

A mapping from model property names to API property names.



42
43
44
45
46
47
48
49
# File 'lib/visa_acceptance_merged_spec/models/risk_information.rb', line 42

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['profile'] = 'profile'
  @_hash['event_type'] = 'eventType'
  @_hash['buyer_history'] = 'buyerHistory'
  @_hash['auxiliary_data'] = 'auxiliaryData'
  @_hash
end

.nullables ⇒ Object

An array for nullable fields



62
63
64
# File 'lib/visa_acceptance_merged_spec/models/risk_information.rb', line 62

def self.nullables
  []
end

.optionals ⇒ Object

An array for optional fields



52
53
54
55
56
57
58
59
# File 'lib/visa_acceptance_merged_spec/models/risk_information.rb', line 52

def self.optionals
  %w[
    profile
    event_type
    buyer_history
    auxiliary_data
  ]
end

Instance Method Details

#inspect ⇒ Object

Provides a debugging-friendly string with detailed object information.



121
122
123
124
125
126
# File 'lib/visa_acceptance_merged_spec/models/risk_information.rb', line 121

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} profile: #{@profile.inspect}, event_type: #{@event_type.inspect},"\
  " buyer_history: #{@buyer_history.inspect}, auxiliary_data: #{@auxiliary_data.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_s ⇒ Object

Provides a human-readable string representation of the object.



113
114
115
116
117
118
# File 'lib/visa_acceptance_merged_spec/models/risk_information.rb', line 113

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} profile: #{@profile}, event_type: #{@event_type}, buyer_history:"\
  " #{@buyer_history}, auxiliary_data: #{@auxiliary_data}, additional_properties:"\
  " #{@additional_properties}>"
end