Class: CyberSourceMergedSpec::ApplicationInformation
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- CyberSourceMergedSpec::ApplicationInformation
- Defined in:
- lib/cyber_source_merged_spec/models/application_information.rb
Overview
ApplicationInformation Model.
Instance Attribute Summary collapse
-
#applications ⇒ Array[Application]
One-word description of the result of the application.
-
#r_code ⇒ String
Indicates whether the service request was successful.
-
#r_flag ⇒ String
One-word description of the result of the application.
-
#reason_code ⇒ String
Indicates the reason why a request succeeded or failed and possible action to take if a request fails.
-
#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_code: SKIP, r_code: SKIP, r_flag: SKIP, applications: SKIP, additional_properties: nil) ⇒ ApplicationInformation
constructor
A new instance of ApplicationInformation.
-
#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_code: SKIP, r_code: SKIP, r_flag: SKIP, applications: SKIP, additional_properties: nil) ⇒ ApplicationInformation
Returns a new instance of ApplicationInformation.
66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/cyber_source_merged_spec/models/application_information.rb', line 66 def initialize(status: SKIP, reason_code: SKIP, r_code: SKIP, r_flag: SKIP, applications: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @status = status unless status == SKIP @reason_code = reason_code unless reason_code == SKIP @r_code = r_code unless r_code == SKIP @r_flag = r_flag unless r_flag == SKIP @applications = applications unless applications == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#applications ⇒ Array[Application]
One-word description of the result of the application.
37 38 39 |
# File 'lib/cyber_source_merged_spec/models/application_information.rb', line 37 def applications @applications end |
#r_code ⇒ String
Indicates whether the service request was successful. Possible values:
-1: An error occurred.0: The request was declined.1: The request was successful.
29 30 31 |
# File 'lib/cyber_source_merged_spec/models/application_information.rb', line 29 def r_code @r_code end |
#r_flag ⇒ String
One-word description of the result of the application.
33 34 35 |
# File 'lib/cyber_source_merged_spec/models/application_information.rb', line 33 def r_flag @r_flag end |
#reason_code ⇒ String
Indicates the reason why a request succeeded or failed and possible action to take if a request fails. For details, see the appendix of reason codes in the documentation for the relevant payment method.
21 22 23 |
# File 'lib/cyber_source_merged_spec/models/application_information.rb', line 21 def reason_code @reason_code end |
#status ⇒ String
The status of the submitted transaction.
14 15 16 |
# File 'lib/cyber_source_merged_spec/models/application_information.rb', line 14 def status @status end |
Class Method Details
.from_element(root) ⇒ Object
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/cyber_source_merged_spec/models/application_information.rb', line 115 def self.from_element(root) status = XmlUtilities.from_element(root, 'status', String) reason_code = XmlUtilities.from_element(root, 'reasonCode', String) r_code = XmlUtilities.from_element(root, 'rCode', String) r_flag = XmlUtilities.from_element(root, 'rFlag', String) applications = XmlUtilities.from_element_to_array(root, 'Application', Application) new(status: status, reason_code: reason_code, r_code: r_code, r_flag: r_flag, applications: applications, additional_properties: additional_properties) end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 108 109 110 111 112 113 |
# File 'lib/cyber_source_merged_spec/models/application_information.rb', line 80 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. status = hash.key?('status') ? hash['status'] : SKIP reason_code = hash.key?('reasonCode') ? hash['reasonCode'] : SKIP r_code = hash.key?('rCode') ? hash['rCode'] : SKIP r_flag = hash.key?('rFlag') ? hash['rFlag'] : SKIP # Parameter is an array, so we need to iterate through it applications = nil unless hash['applications'].nil? applications = [] hash['applications'].each do |structure| applications << (Application.from_hash(structure) if structure) end end applications = SKIP unless hash.key?('applications') # 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. ApplicationInformation.new(status: status, reason_code: reason_code, r_code: r_code, r_flag: r_flag, applications: applications, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
40 41 42 43 44 45 46 47 48 |
# File 'lib/cyber_source_merged_spec/models/application_information.rb', line 40 def self.names @_hash = {} if @_hash.nil? @_hash['status'] = 'status' @_hash['reason_code'] = 'reasonCode' @_hash['r_code'] = 'rCode' @_hash['r_flag'] = 'rFlag' @_hash['applications'] = 'applications' @_hash end |
.nullables ⇒ Object
An array for nullable fields
62 63 64 |
# File 'lib/cyber_source_merged_spec/models/application_information.rb', line 62 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
51 52 53 54 55 56 57 58 59 |
# File 'lib/cyber_source_merged_spec/models/application_information.rb', line 51 def self.optionals %w[ status reason_code r_code r_flag applications ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
155 156 157 158 159 160 |
# File 'lib/cyber_source_merged_spec/models/application_information.rb', line 155 def inspect class_name = self.class.name.split('::').last "<#{class_name} status: #{@status.inspect}, reason_code: #{@reason_code.inspect}, r_code:"\ " #{@r_code.inspect}, r_flag: #{@r_flag.inspect}, applications: #{@applications.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
147 148 149 150 151 152 |
# File 'lib/cyber_source_merged_spec/models/application_information.rb', line 147 def to_s class_name = self.class.name.split('::').last "<#{class_name} status: #{@status}, reason_code: #{@reason_code}, r_code: #{@r_code},"\ " r_flag: #{@r_flag}, applications: #{@applications}, additional_properties:"\ " #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/cyber_source_merged_spec/models/application_information.rb', line 131 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, 'reasonCode', reason_code) XmlUtilities.add_as_subelement(doc, root, 'rCode', r_code) XmlUtilities.add_as_subelement(doc, root, 'rFlag', r_flag) XmlUtilities.add_array_as_subelement(doc, root, 'Application', applications) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |