Class: CyberSourceMergedSpec::Authorization
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- CyberSourceMergedSpec::Authorization
- Defined in:
- lib/cyber_source_merged_spec/models/authorization.rb
Overview
Authorization Info Values
Instance Attribute Summary collapse
-
#amount ⇒ String
Authorization Amount.
-
#authorization_request_id ⇒ String
Authorization Request Id.
-
#code ⇒ String
Authorization Code.
-
#currency_code ⇒ String
Valid ISO 4217 ALPHA-3 currency code.
-
#rcode ⇒ String
Authorization RCode.
-
#request_id ⇒ String
An unique identification number assigned by CyberSource to identify the submitted request.
-
#time ⇒ DateTime
Authorization Date.
-
#transaction_reference_number ⇒ String
Authorization Transaction Reference Number.
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(request_id: SKIP, transaction_reference_number: SKIP, time: SKIP, authorization_request_id: SKIP, amount: SKIP, currency_code: SKIP, code: SKIP, rcode: SKIP, additional_properties: nil) ⇒ Authorization
constructor
A new instance of Authorization.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_time ⇒ Object
-
#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(request_id: SKIP, transaction_reference_number: SKIP, time: SKIP, authorization_request_id: SKIP, amount: SKIP, currency_code: SKIP, code: SKIP, rcode: SKIP, additional_properties: nil) ⇒ Authorization
Returns a new instance of Authorization.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/cyber_source_merged_spec/models/authorization.rb', line 79 def initialize(request_id: SKIP, transaction_reference_number: SKIP, time: SKIP, authorization_request_id: SKIP, amount: SKIP, currency_code: SKIP, code: SKIP, rcode: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @request_id = request_id unless request_id == SKIP unless transaction_reference_number == SKIP @transaction_reference_number = transaction_reference_number end @time = time unless time == SKIP @authorization_request_id = unless == SKIP @amount = amount unless amount == SKIP @currency_code = currency_code unless currency_code == SKIP @code = code unless code == SKIP @rcode = rcode unless rcode == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#amount ⇒ String
Authorization Amount
32 33 34 |
# File 'lib/cyber_source_merged_spec/models/authorization.rb', line 32 def amount @amount end |
#authorization_request_id ⇒ String
Authorization Request Id
28 29 30 |
# File 'lib/cyber_source_merged_spec/models/authorization.rb', line 28 def @authorization_request_id end |
#code ⇒ String
Authorization Code
40 41 42 |
# File 'lib/cyber_source_merged_spec/models/authorization.rb', line 40 def code @code end |
#currency_code ⇒ String
Valid ISO 4217 ALPHA-3 currency code
36 37 38 |
# File 'lib/cyber_source_merged_spec/models/authorization.rb', line 36 def currency_code @currency_code end |
#rcode ⇒ String
Authorization RCode
44 45 46 |
# File 'lib/cyber_source_merged_spec/models/authorization.rb', line 44 def rcode @rcode end |
#request_id ⇒ String
An unique identification number assigned by CyberSource to identify the submitted request.
16 17 18 |
# File 'lib/cyber_source_merged_spec/models/authorization.rb', line 16 def request_id @request_id end |
#time ⇒ DateTime
Authorization Date
24 25 26 |
# File 'lib/cyber_source_merged_spec/models/authorization.rb', line 24 def time @time end |
#transaction_reference_number ⇒ String
Authorization Transaction Reference Number
20 21 22 |
# File 'lib/cyber_source_merged_spec/models/authorization.rb', line 20 def transaction_reference_number @transaction_reference_number end |
Class Method Details
.from_element(root) ⇒ Object
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/cyber_source_merged_spec/models/authorization.rb', line 143 def self.from_element(root) request_id = XmlUtilities.from_element(root, 'requestId', String) transaction_reference_number = XmlUtilities.from_element( root, 'transactionReferenceNumber', String ) time = XmlUtilities.from_element(root, 'time', String, datetime_format: 'rfc3339') = XmlUtilities.from_element( root, 'authorizationRequestId', String ) amount = XmlUtilities.from_element(root, 'amount', String) currency_code = XmlUtilities.from_element(root, 'currencyCode', String) code = XmlUtilities.from_element(root, 'code', String) rcode = XmlUtilities.from_element(root, 'rcode', String) new(request_id: request_id, transaction_reference_number: transaction_reference_number, time: time, authorization_request_id: , amount: amount, currency_code: currency_code, code: code, rcode: rcode, additional_properties: additional_properties) end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/cyber_source_merged_spec/models/authorization.rb', line 101 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. request_id = hash.key?('requestId') ? hash['requestId'] : SKIP transaction_reference_number = hash.key?('transactionReferenceNumber') ? hash['transactionReferenceNumber'] : SKIP time = if hash.key?('time') (DateTimeHelper.from_rfc3339(hash['time']) if hash['time']) else SKIP end = hash.key?('authorizationRequestId') ? hash['authorizationRequestId'] : SKIP amount = hash.key?('amount') ? hash['amount'] : SKIP currency_code = hash.key?('currencyCode') ? hash['currencyCode'] : SKIP code = hash.key?('code') ? hash['code'] : SKIP rcode = hash.key?('rcode') ? hash['rcode'] : 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. Authorization.new(request_id: request_id, transaction_reference_number: transaction_reference_number, time: time, authorization_request_id: , amount: amount, currency_code: currency_code, code: code, rcode: rcode, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/cyber_source_merged_spec/models/authorization.rb', line 47 def self.names @_hash = {} if @_hash.nil? @_hash['request_id'] = 'requestId' @_hash['transaction_reference_number'] = 'transactionReferenceNumber' @_hash['time'] = 'time' @_hash['authorization_request_id'] = 'authorizationRequestId' @_hash['amount'] = 'amount' @_hash['currency_code'] = 'currencyCode' @_hash['code'] = 'code' @_hash['rcode'] = 'rcode' @_hash end |
.nullables ⇒ Object
An array for nullable fields
75 76 77 |
# File 'lib/cyber_source_merged_spec/models/authorization.rb', line 75 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/cyber_source_merged_spec/models/authorization.rb', line 61 def self.optionals %w[ request_id transaction_reference_number time authorization_request_id amount currency_code code rcode ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
199 200 201 202 203 204 205 206 |
# File 'lib/cyber_source_merged_spec/models/authorization.rb', line 199 def inspect class_name = self.class.name.split('::').last "<#{class_name} request_id: #{@request_id.inspect}, transaction_reference_number:"\ " #{@transaction_reference_number.inspect}, time: #{@time.inspect},"\ " authorization_request_id: #{@authorization_request_id.inspect}, amount:"\ " #{@amount.inspect}, currency_code: #{@currency_code.inspect}, code: #{@code.inspect},"\ " rcode: #{@rcode.inspect}, additional_properties: #{@additional_properties}>" end |
#to_custom_time ⇒ Object
139 140 141 |
# File 'lib/cyber_source_merged_spec/models/authorization.rb', line 139 def to_custom_time DateTimeHelper.to_rfc3339(time) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
190 191 192 193 194 195 196 |
# File 'lib/cyber_source_merged_spec/models/authorization.rb', line 190 def to_s class_name = self.class.name.split('::').last "<#{class_name} request_id: #{@request_id}, transaction_reference_number:"\ " #{@transaction_reference_number}, time: #{@time}, authorization_request_id:"\ " #{@authorization_request_id}, amount: #{@amount}, currency_code: #{@currency_code}, code:"\ " #{@code}, rcode: #{@rcode}, additional_properties: #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/cyber_source_merged_spec/models/authorization.rb', line 169 def to_xml_element(doc, root_name) root = doc.create_element(root_name) XmlUtilities.add_as_subelement(doc, root, 'requestId', request_id) XmlUtilities.add_as_subelement(doc, root, 'transactionReferenceNumber', transaction_reference_number) XmlUtilities.add_as_subelement(doc, root, 'time', time, datetime_format: 'rfc3339') XmlUtilities.add_as_subelement(doc, root, 'authorizationRequestId', ) XmlUtilities.add_as_subelement(doc, root, 'amount', amount) XmlUtilities.add_as_subelement(doc, root, 'currencyCode', currency_code) XmlUtilities.add_as_subelement(doc, root, 'code', code) XmlUtilities.add_as_subelement(doc, root, 'rcode', rcode) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |