Class: CyberSourceMergedSpec::Fingerprint

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

Overview

Fingerprint 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(true_ipaddress: SKIP, hash: SKIP, smart_id: SKIP, additional_properties: nil) ⇒ Fingerprint

Returns a new instance of Fingerprint.



63
64
65
66
67
68
69
70
71
72
# File 'lib/cyber_source_merged_spec/models/fingerprint.rb', line 63

def initialize(true_ipaddress: SKIP, hash: SKIP, smart_id: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @true_ipaddress = true_ipaddress unless true_ipaddress == SKIP
  @hash = hash unless hash == SKIP
  @smart_id = smart_id unless smart_id == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#hashString

The unique identifier of the device that is returned in the riskInformation.providers.fingerprint.device_fingerprint_hash API reply field. For more details about this field, see the device_fingerprint_hash field description in the Device Fingerprinting Guide on the CyberSource Business Center. Click Decision Manager > Documentation > Guides > Device Fingerprinting Guide (PDF link).

Returns:

  • (String)


29
30
31
# File 'lib/cyber_source_merged_spec/models/fingerprint.rb', line 29

def hash
  @hash
end

#smart_idString

The device identifier generated from attributes collected during profiling. Returned by a 3rd party when you use device fingerprinting. For details, see the device_fingerprint_smart_id field description in [CyberSource Decision Manager Device Fingerprinting Guide.](https://www.cybersource.com/developers/documentation/fraud_managem ent)

Returns:

  • (String)


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

def smart_id
  @smart_id
end

#true_ipaddressString

Customer’s true IP address detected by the application. For details, see the true_ipaddress field description in Device Fingerprinting Guide on the CyberSource Business Center. Click Decision Manager > Documentation > Guides > Device Fingerprinting Guide (PDF link).

Returns:

  • (String)


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

def true_ipaddress
  @true_ipaddress
end

Class Method Details

.from_element(root) ⇒ Object



98
99
100
101
102
103
104
105
106
107
# File 'lib/cyber_source_merged_spec/models/fingerprint.rb', line 98

def self.from_element(root)
  true_ipaddress = XmlUtilities.from_element(root, 'true_ipaddress', String)
  hash = XmlUtilities.from_element(root, 'hash', String)
  smart_id = XmlUtilities.from_element(root, 'smartId', String)

  new(true_ipaddress: true_ipaddress,
      hash: hash,
      smart_id: smart_id,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/cyber_source_merged_spec/models/fingerprint.rb', line 75

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  true_ipaddress =
    hash.key?('true_ipaddress') ? hash['true_ipaddress'] : SKIP
  hash = hash.key?('hash') ? hash['hash'] : SKIP
  smart_id = hash.key?('smartId') ? hash['smartId'] : 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.
  Fingerprint.new(true_ipaddress: true_ipaddress,
                  hash: hash,
                  smart_id: smart_id,
                  additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



41
42
43
44
45
46
47
# File 'lib/cyber_source_merged_spec/models/fingerprint.rb', line 41

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['true_ipaddress'] = 'true_ipaddress'
  @_hash['hash'] = 'hash'
  @_hash['smart_id'] = 'smartId'
  @_hash
end

.nullablesObject

An array for nullable fields



59
60
61
# File 'lib/cyber_source_merged_spec/models/fingerprint.rb', line 59

def self.nullables
  []
end

.optionalsObject

An array for optional fields



50
51
52
53
54
55
56
# File 'lib/cyber_source_merged_spec/models/fingerprint.rb', line 50

def self.optionals
  %w[
    true_ipaddress
    hash
    smart_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



130
131
132
133
134
# File 'lib/cyber_source_merged_spec/models/fingerprint.rb', line 130

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} true_ipaddress: #{@true_ipaddress.inspect}, hash: #{@hash.inspect},"\
  " smart_id: #{@smart_id.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



123
124
125
126
127
# File 'lib/cyber_source_merged_spec/models/fingerprint.rb', line 123

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} true_ipaddress: #{@true_ipaddress}, hash: #{@hash}, smart_id: #{@smart_id},"\
  " additional_properties: #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



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

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

  XmlUtilities.add_as_subelement(doc, root, 'true_ipaddress',
                                 true_ipaddress)
  XmlUtilities.add_as_subelement(doc, root, 'hash', hash)
  XmlUtilities.add_as_subelement(doc, root, 'smartId', smart_id)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end