Class: CyberSourceMergedSpec::Weights

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

Overview

Weights 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(address: SKIP, company: SKIP, name: SKIP, additional_properties: nil) ⇒ Weights

Returns a new instance of Weights.



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

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

  @address = address unless address == SKIP
  @company = company unless company == SKIP
  @name = name unless name == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#addressString

Degree of correlation between a customer’s address and an entry in the DPL before a match occurs. This field can contain one of the following values:

  • exact: The address must be identical to the entry in the DPL.
  • high: (default) The address cannot differ significantly from the entry in the DPL.
  • medium: The address can differ slightly more from the entry in the DPL.
  • low: The address can differ significantly from the entry in the DPL.

Returns:

  • (String)


20
21
22
# File 'lib/cyber_source_merged_spec/models/weights.rb', line 20

def address
  @address
end

#companyString

Degree of correlation between a company address and an entry in the DPL before a match occurs. This field can contain one of the following values:

  • exact: The company name must be identical to the entry in the DPL.
  • high: (default) The company name cannot differ significantly from the entry in the DPL.
  • medium: The company name can differ slightly more from the entry in the DPL.
  • low: The company name can differ significantly from the entry in the DPL.

Returns:

  • (String)


32
33
34
# File 'lib/cyber_source_merged_spec/models/weights.rb', line 32

def company
  @company
end

#nameString

Degree of correlation between a customer’s name and an entry in the DPL before a match occurs. This field can contain one of the following values:

  • exact: The name must be identical to the entry in the DPL.
  • high: (default) The name cannot differ significantly from the entry in the DPL.
  • medium: The name can differ slightly more from the entry in the DPL.
  • low: The name can differ significantly the entry in the DPL.

Returns:

  • (String)


42
43
44
# File 'lib/cyber_source_merged_spec/models/weights.rb', line 42

def name
  @name
end

Class Method Details

.from_element(root) ⇒ Object



101
102
103
104
105
106
107
108
109
110
# File 'lib/cyber_source_merged_spec/models/weights.rb', line 101

def self.from_element(root)
  address = XmlUtilities.from_element(root, 'address', String)
  company = XmlUtilities.from_element(root, 'company', String)
  name = XmlUtilities.from_element(root, 'name', String)

  new(address: address,
      company: company,
      name: name,
      additional_properties: additional_properties)
end

.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
# File 'lib/cyber_source_merged_spec/models/weights.rb', line 79

def self.from_hash(hash)
  return nil unless hash

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

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['address'] = 'address'
  @_hash['company'] = 'company'
  @_hash['name'] = 'name'
  @_hash
end

.nullablesObject

An array for nullable fields



63
64
65
# File 'lib/cyber_source_merged_spec/models/weights.rb', line 63

def self.nullables
  []
end

.optionalsObject

An array for optional fields



54
55
56
57
58
59
60
# File 'lib/cyber_source_merged_spec/models/weights.rb', line 54

def self.optionals
  %w[
    address
    company
    name
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



132
133
134
135
136
# File 'lib/cyber_source_merged_spec/models/weights.rb', line 132

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

#to_sObject

Provides a human-readable string representation of the object.



125
126
127
128
129
# File 'lib/cyber_source_merged_spec/models/weights.rb', line 125

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

#to_xml_element(doc, root_name) ⇒ Object



112
113
114
115
116
117
118
119
120
121
122
# File 'lib/cyber_source_merged_spec/models/weights.rb', line 112

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

  XmlUtilities.add_as_subelement(doc, root, 'address', address)
  XmlUtilities.add_as_subelement(doc, root, 'company', company)
  XmlUtilities.add_as_subelement(doc, root, 'name', name)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end