Class: CyberSourceMergedSpec::RiskInformation10
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- CyberSourceMergedSpec::RiskInformation10
- Defined in:
- lib/cyber_source_merged_spec/models/risk_information10.rb
Overview
RiskInformation10 Model.
Instance Attribute Summary collapse
-
#local_time ⇒ String
Time that the transaction was submitted in local time.
-
#passive_profile ⇒ PassiveProfile
TODO: Write general description for this method.
-
#passive_rules ⇒ Array[PassiveRule]
TODO: Write general description for this method.
-
#profile ⇒ Profile4
TODO: Write general description for this method.
-
#rules ⇒ Array[Rule2]
TODO: Write general description for this method.
-
#score ⇒ Score2
TODO: Write general description for this method.
Class Method Summary collapse
- .from_element(root) ⇒ Object
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(profile: SKIP, rules: SKIP, passive_profile: SKIP, passive_rules: SKIP, score: SKIP, local_time: SKIP, additional_properties: nil) ⇒ RiskInformation10
constructor
A new instance of RiskInformation10.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
- #to_xml_element(doc, root_name) ⇒ Object
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, rules: SKIP, passive_profile: SKIP, passive_rules: SKIP, score: SKIP, local_time: SKIP, additional_properties: nil) ⇒ RiskInformation10
Returns a new instance of RiskInformation10.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/cyber_source_merged_spec/models/risk_information10.rb', line 66 def initialize(profile: SKIP, rules: SKIP, passive_profile: SKIP, passive_rules: SKIP, score: SKIP, local_time: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @profile = profile unless profile == SKIP @rules = rules unless rules == SKIP @passive_profile = passive_profile unless passive_profile == SKIP @passive_rules = passive_rules unless passive_rules == SKIP @score = score unless score == SKIP @local_time = local_time unless local_time == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#local_time ⇒ String
Time that the transaction was submitted in local time. Generated by Cybersource.
35 36 37 |
# File 'lib/cyber_source_merged_spec/models/risk_information10.rb', line 35 def local_time @local_time end |
#passive_profile ⇒ PassiveProfile
TODO: Write general description for this method
22 23 24 |
# File 'lib/cyber_source_merged_spec/models/risk_information10.rb', line 22 def passive_profile @passive_profile end |
#passive_rules ⇒ Array[PassiveRule]
TODO: Write general description for this method
26 27 28 |
# File 'lib/cyber_source_merged_spec/models/risk_information10.rb', line 26 def passive_rules @passive_rules end |
#profile ⇒ Profile4
TODO: Write general description for this method
14 15 16 |
# File 'lib/cyber_source_merged_spec/models/risk_information10.rb', line 14 def profile @profile end |
#rules ⇒ Array[Rule2]
TODO: Write general description for this method
18 19 20 |
# File 'lib/cyber_source_merged_spec/models/risk_information10.rb', line 18 def rules @rules end |
#score ⇒ Score2
TODO: Write general description for this method
30 31 32 |
# File 'lib/cyber_source_merged_spec/models/risk_information10.rb', line 30 def score @score end |
Class Method Details
.from_element(root) ⇒ Object
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/cyber_source_merged_spec/models/risk_information10.rb', line 128 def self.from_element(root) profile = XmlUtilities.from_element(root, 'Profile4', Profile4) rules = XmlUtilities.from_element_to_array(root, 'Rule2', Rule2) passive_profile = XmlUtilities.from_element(root, 'PassiveProfile', PassiveProfile) passive_rules = XmlUtilities.from_element_to_array(root, 'PassiveRule', PassiveRule) score = XmlUtilities.from_element(root, 'Score2', Score2) local_time = XmlUtilities.from_element(root, 'localTime', String) new(profile: profile, rules: rules, passive_profile: passive_profile, passive_rules: passive_rules, score: score, local_time: local_time, additional_properties: additional_properties) end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/cyber_source_merged_spec/models/risk_information10.rb', line 82 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. profile = Profile4.from_hash(hash['profile']) if hash['profile'] # Parameter is an array, so we need to iterate through it rules = nil unless hash['rules'].nil? rules = [] hash['rules'].each do |structure| rules << (Rule2.from_hash(structure) if structure) end end rules = SKIP unless hash.key?('rules') passive_profile = PassiveProfile.from_hash(hash['passiveProfile']) if hash['passiveProfile'] # Parameter is an array, so we need to iterate through it passive_rules = nil unless hash['passiveRules'].nil? passive_rules = [] hash['passiveRules'].each do |structure| passive_rules << (PassiveRule.from_hash(structure) if structure) end end passive_rules = SKIP unless hash.key?('passiveRules') score = Score2.from_hash(hash['score']) if hash['score'] local_time = hash.key?('localTime') ? hash['localTime'] : 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. RiskInformation10.new(profile: profile, rules: rules, passive_profile: passive_profile, passive_rules: passive_rules, score: score, local_time: local_time, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/cyber_source_merged_spec/models/risk_information10.rb', line 38 def self.names @_hash = {} if @_hash.nil? @_hash['profile'] = 'profile' @_hash['rules'] = 'rules' @_hash['passive_profile'] = 'passiveProfile' @_hash['passive_rules'] = 'passiveRules' @_hash['score'] = 'score' @_hash['local_time'] = 'localTime' @_hash end |
.nullables ⇒ Object
An array for nullable fields
62 63 64 |
# File 'lib/cyber_source_merged_spec/models/risk_information10.rb', line 62 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/cyber_source_merged_spec/models/risk_information10.rb', line 50 def self.optionals %w[ profile rules passive_profile passive_rules score local_time ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
173 174 175 176 177 178 179 |
# File 'lib/cyber_source_merged_spec/models/risk_information10.rb', line 173 def inspect class_name = self.class.name.split('::').last "<#{class_name} profile: #{@profile.inspect}, rules: #{@rules.inspect}, passive_profile:"\ " #{@passive_profile.inspect}, passive_rules: #{@passive_rules.inspect}, score:"\ " #{@score.inspect}, local_time: #{@local_time.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
165 166 167 168 169 170 |
# File 'lib/cyber_source_merged_spec/models/risk_information10.rb', line 165 def to_s class_name = self.class.name.split('::').last "<#{class_name} profile: #{@profile}, rules: #{@rules}, passive_profile:"\ " #{@passive_profile}, passive_rules: #{@passive_rules}, score: #{@score}, local_time:"\ " #{@local_time}, additional_properties: #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/cyber_source_merged_spec/models/risk_information10.rb', line 147 def to_xml_element(doc, root_name) root = doc.create_element(root_name) XmlUtilities.add_as_subelement(doc, root, 'Profile4', profile) XmlUtilities.add_array_as_subelement(doc, root, 'Rule2', rules) XmlUtilities.add_as_subelement(doc, root, 'PassiveProfile', passive_profile) XmlUtilities.add_array_as_subelement(doc, root, 'PassiveRule', passive_rules) XmlUtilities.add_as_subelement(doc, root, 'Score2', score) XmlUtilities.add_as_subelement(doc, root, 'localTime', local_time) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |