Class: CyberSourceMergedSpec::AuxiliaryDatum

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

Overview

Contains auxiliary key-value pairs.

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(key: SKIP, value: SKIP, additional_properties: nil) ⇒ AuxiliaryDatum

Returns a new instance of AuxiliaryDatum.



57
58
59
60
61
62
63
64
# File 'lib/cyber_source_merged_spec/models/auxiliary_datum.rb', line 57

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

  @key = key unless key == SKIP
  @value = value unless value == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#keyString

Fields that you can use to send additional data to Risk services. Warning Auxiliary fields are not intended to and MUST NOT be used to capture personally identifying information. Accordingly, merchants are prohibited from capturing, obtaining, and/or transmitting any personally identifying information in or via the auxiliary data fields. Personally identifying information includes, but is not limited to, address, credit card number, social security number, driver's license number, state-issued identification number, passport number, and card verification numbers (CVV, CVC2, CVV2, CID, CVN). In the event CyberSource discovers that a merchant is capturing and/or transmitting personally identifying information via the auxiliary data fields, whether or not intentionally, CyberSource WILL immediately suspend the merchant's account, which will result in a rejection of any and all transaction requests submitted by the merchant after the point of suspension.

Returns:

  • (String)


30
31
32
# File 'lib/cyber_source_merged_spec/models/auxiliary_datum.rb', line 30

def key
  @key
end

#valueString

String value for the key

Returns:

  • (String)


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

def value
  @value
end

Class Method Details

.from_element(root) ⇒ Object



87
88
89
90
91
92
93
94
# File 'lib/cyber_source_merged_spec/models/auxiliary_datum.rb', line 87

def self.from_element(root)
  key = XmlUtilities.from_element(root, 'key', String)
  value = XmlUtilities.from_element(root, 'value', String)

  new(key: key,
      value: value,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/cyber_source_merged_spec/models/auxiliary_datum.rb', line 67

def self.from_hash(hash)
  return nil unless hash

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

.namesObject

A mapping from model property names to API property names.



37
38
39
40
41
42
# File 'lib/cyber_source_merged_spec/models/auxiliary_datum.rb', line 37

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['key'] = 'key'
  @_hash['value'] = 'value'
  @_hash
end

.nullablesObject

An array for nullable fields



53
54
55
# File 'lib/cyber_source_merged_spec/models/auxiliary_datum.rb', line 53

def self.nullables
  []
end

.optionalsObject

An array for optional fields



45
46
47
48
49
50
# File 'lib/cyber_source_merged_spec/models/auxiliary_datum.rb', line 45

def self.optionals
  %w[
    key
    value
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



115
116
117
118
119
# File 'lib/cyber_source_merged_spec/models/auxiliary_datum.rb', line 115

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

#to_sObject

Provides a human-readable string representation of the object.



108
109
110
111
112
# File 'lib/cyber_source_merged_spec/models/auxiliary_datum.rb', line 108

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

#to_xml_element(doc, root_name) ⇒ Object



96
97
98
99
100
101
102
103
104
105
# File 'lib/cyber_source_merged_spec/models/auxiliary_datum.rb', line 96

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

  XmlUtilities.add_as_subelement(doc, root, 'key', key)
  XmlUtilities.add_as_subelement(doc, root, 'value', value)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end