Class: CyberSourceMergedSpec::Decision
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- CyberSourceMergedSpec::Decision
- Defined in:
- lib/cyber_source_merged_spec/models/decision.rb
Overview
Decision Model.
Instance Attribute Summary collapse
-
#message ⇒ String
The detail message related to the status and reason listed above.
-
#reason ⇒ String
The reason of the status.
-
#status ⇒ String
The status of the submitted transaction.
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(status: SKIP, reason: SKIP, message: SKIP, additional_properties: nil) ⇒ Decision
constructor
A new instance of Decision.
-
#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(status: SKIP, reason: SKIP, message: SKIP, additional_properties: nil) ⇒ Decision
Returns a new instance of Decision.
69 70 71 72 73 74 75 76 77 78 |
# File 'lib/cyber_source_merged_spec/models/decision.rb', line 69 def initialize(status: SKIP, reason: SKIP, message: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @status = status unless status == SKIP @reason = reason unless reason == SKIP @message = unless == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#message ⇒ String
The detail message related to the status and reason listed above.
44 45 46 |
# File 'lib/cyber_source_merged_spec/models/decision.rb', line 44 def @message end |
#reason ⇒ String
The reason of the status. Possible values:
EXPIRED_CARDSCORE_EXCEEDS_THRESHOLDDECISION_PROFILE_REVIEWDECISION_PROFILE_REJECTCONSUMER_AUTHENTICATION_REQUIREDINVALID_MERCHANT_CONFIGURATIONCONSUMER_AUTHENTICATION_FAILEDDECISION_PROFILE_CHALLENGECUSTOMER_WATCHLIST_MATCHADDRESS_COUNTRY_WATCHLIST_MATCHEMAIL_COUNTRY_WATCHLIST_MATCHIP_COUNTRY_WATCHLIST_MATCH
40 41 42 |
# File 'lib/cyber_source_merged_spec/models/decision.rb', line 40 def reason @reason end |
#status ⇒ String
The status of the submitted transaction. Possible values:
- `ACCEPTED`
- `REJECTED`
- `PENDING_REVIEW`
- `DECLINED`
- `PENDING_AUTHENTICATION`
- `INVALID_REQUEST`
- `AUTHENTICATION_FAILED`
- `CHALLENGE`
23 24 25 |
# File 'lib/cyber_source_merged_spec/models/decision.rb', line 23 def status @status end |
Class Method Details
.from_element(root) ⇒ Object
103 104 105 106 107 108 109 110 111 112 |
# File 'lib/cyber_source_merged_spec/models/decision.rb', line 103 def self.from_element(root) status = XmlUtilities.from_element(root, 'status', String) reason = XmlUtilities.from_element(root, 'reason', String) = XmlUtilities.from_element(root, 'message', String) new(status: status, reason: reason, message: , additional_properties: additional_properties) end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/cyber_source_merged_spec/models/decision.rb', line 81 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. status = hash.key?('status') ? hash['status'] : SKIP reason = hash.key?('reason') ? hash['reason'] : SKIP = hash.key?('message') ? hash['message'] : 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. Decision.new(status: status, reason: reason, message: , additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
47 48 49 50 51 52 53 |
# File 'lib/cyber_source_merged_spec/models/decision.rb', line 47 def self.names @_hash = {} if @_hash.nil? @_hash['status'] = 'status' @_hash['reason'] = 'reason' @_hash['message'] = 'message' @_hash end |
.nullables ⇒ Object
An array for nullable fields
65 66 67 |
# File 'lib/cyber_source_merged_spec/models/decision.rb', line 65 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
56 57 58 59 60 61 62 |
# File 'lib/cyber_source_merged_spec/models/decision.rb', line 56 def self.optionals %w[ status reason message ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
134 135 136 137 138 |
# File 'lib/cyber_source_merged_spec/models/decision.rb', line 134 def inspect class_name = self.class.name.split('::').last "<#{class_name} status: #{@status.inspect}, reason: #{@reason.inspect}, message:"\ " #{@message.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
127 128 129 130 131 |
# File 'lib/cyber_source_merged_spec/models/decision.rb', line 127 def to_s class_name = self.class.name.split('::').last "<#{class_name} status: #{@status}, reason: #{@reason}, message: #{@message},"\ " additional_properties: #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/cyber_source_merged_spec/models/decision.rb', line 114 def to_xml_element(doc, root_name) root = doc.create_element(root_name) XmlUtilities.add_as_subelement(doc, root, 'status', status) XmlUtilities.add_as_subelement(doc, root, 'reason', reason) XmlUtilities.add_as_subelement(doc, root, 'message', ) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |