Class: CyberSourceMergedSpec::ResponseStatus
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- CyberSourceMergedSpec::ResponseStatus
- Defined in:
- lib/cyber_source_merged_spec/models/response_status.rb
Overview
ResponseStatus Model.
Instance Attribute Summary collapse
-
#correlation_id ⇒ String
API correlation ID.
-
#details ⇒ Array[Detail73]
API correlation ID.
-
#message ⇒ String
Error Message.
-
#reason ⇒ String
Error Reason Code.
-
#status ⇒ Float
HTTP Status code.
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, correlation_id: SKIP, details: SKIP, additional_properties: nil) ⇒ ResponseStatus
constructor
A new instance of ResponseStatus.
-
#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, correlation_id: SKIP, details: SKIP, additional_properties: nil) ⇒ ResponseStatus
Returns a new instance of ResponseStatus.
59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/cyber_source_merged_spec/models/response_status.rb', line 59 def initialize(status: SKIP, reason: SKIP, message: SKIP, correlation_id: SKIP, details: 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 @correlation_id = correlation_id unless correlation_id == SKIP @details = details unless details == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#correlation_id ⇒ String
API correlation ID.
26 27 28 |
# File 'lib/cyber_source_merged_spec/models/response_status.rb', line 26 def correlation_id @correlation_id end |
#details ⇒ Array[Detail73]
API correlation ID.
30 31 32 |
# File 'lib/cyber_source_merged_spec/models/response_status.rb', line 30 def details @details end |
#message ⇒ String
Error Message.
22 23 24 |
# File 'lib/cyber_source_merged_spec/models/response_status.rb', line 22 def @message end |
#reason ⇒ String
Error Reason Code.
18 19 20 |
# File 'lib/cyber_source_merged_spec/models/response_status.rb', line 18 def reason @reason end |
#status ⇒ Float
HTTP Status code.
14 15 16 |
# File 'lib/cyber_source_merged_spec/models/response_status.rb', line 14 def status @status end |
Class Method Details
.from_element(root) ⇒ Object
109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/cyber_source_merged_spec/models/response_status.rb', line 109 def self.from_element(root) status = XmlUtilities.from_element(root, 'status', Float) reason = XmlUtilities.from_element(root, 'reason', String) = XmlUtilities.from_element(root, 'message', String) correlation_id = XmlUtilities.from_element(root, 'correlationId', String) details = XmlUtilities.from_element_to_array(root, 'Detail73', Detail73) new(status: status, reason: reason, message: , correlation_id: correlation_id, details: details, additional_properties: additional_properties) end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
74 75 76 77 78 79 80 81 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 |
# File 'lib/cyber_source_merged_spec/models/response_status.rb', line 74 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 correlation_id = hash.key?('correlationId') ? hash['correlationId'] : SKIP # Parameter is an array, so we need to iterate through it details = nil unless hash['details'].nil? details = [] hash['details'].each do |structure| details << (Detail73.from_hash(structure) if structure) end end details = SKIP unless hash.key?('details') # 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. ResponseStatus.new(status: status, reason: reason, message: , correlation_id: correlation_id, details: details, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 41 |
# File 'lib/cyber_source_merged_spec/models/response_status.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['status'] = 'status' @_hash['reason'] = 'reason' @_hash['message'] = 'message' @_hash['correlation_id'] = 'correlationId' @_hash['details'] = 'details' @_hash end |
.nullables ⇒ Object
An array for nullable fields
55 56 57 |
# File 'lib/cyber_source_merged_spec/models/response_status.rb', line 55 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
44 45 46 47 48 49 50 51 52 |
# File 'lib/cyber_source_merged_spec/models/response_status.rb', line 44 def self.optionals %w[ status reason message correlation_id details ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
147 148 149 150 151 152 |
# File 'lib/cyber_source_merged_spec/models/response_status.rb', line 147 def inspect class_name = self.class.name.split('::').last "<#{class_name} status: #{@status.inspect}, reason: #{@reason.inspect}, message:"\ " #{@message.inspect}, correlation_id: #{@correlation_id.inspect}, details:"\ " #{@details.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
139 140 141 142 143 144 |
# File 'lib/cyber_source_merged_spec/models/response_status.rb', line 139 def to_s class_name = self.class.name.split('::').last "<#{class_name} status: #{@status}, reason: #{@reason}, message: #{@message},"\ " correlation_id: #{@correlation_id}, details: #{@details}, additional_properties:"\ " #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/cyber_source_merged_spec/models/response_status.rb', line 124 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, 'correlationId', correlation_id) XmlUtilities.add_array_as_subelement(doc, root, 'Detail73', details) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |