Class: ModernTreasury::ReversalCreateRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ModernTreasury::ReversalCreateRequest
- Defined in:
- lib/modern_treasury/models/reversal_create_request.rb
Overview
ReversalCreateRequest Model.
Instance Attribute Summary collapse
-
#ledger_transaction ⇒ LedgerTransactionCreateRequest
Additional data represented as key-value pairs.
-
#metadata ⇒ Hash[String, String]
Additional data represented as key-value pairs.
-
#reason ⇒ Reason1Enum
The reason for the reversal.
Class Method Summary collapse
-
.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(reason = nil, metadata = SKIP, ledger_transaction = SKIP) ⇒ ReversalCreateRequest
constructor
A new instance of ReversalCreateRequest.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the 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(reason = nil, metadata = SKIP, ledger_transaction = SKIP) ⇒ ReversalCreateRequest
Returns a new instance of ReversalCreateRequest.
50 51 52 53 54 |
# File 'lib/modern_treasury/models/reversal_create_request.rb', line 50 def initialize(reason = nil, = SKIP, ledger_transaction = SKIP) @reason = reason @metadata = unless == SKIP @ledger_transaction = ledger_transaction unless ledger_transaction == SKIP end |
Instance Attribute Details
#ledger_transaction ⇒ LedgerTransactionCreateRequest
Additional data represented as key-value pairs. Both the key and value must be strings.
26 27 28 |
# File 'lib/modern_treasury/models/reversal_create_request.rb', line 26 def ledger_transaction @ledger_transaction end |
#metadata ⇒ Hash[String, String]
Additional data represented as key-value pairs. Both the key and value must be strings.
21 22 23 |
# File 'lib/modern_treasury/models/reversal_create_request.rb', line 21 def @metadata end |
#reason ⇒ Reason1Enum
The reason for the reversal. Must be one of ‘duplicate`, `incorrect_amount`, `incorrect_receiving_account`, `date_earlier_than_intended`, `date_later_than_intended`.
16 17 18 |
# File 'lib/modern_treasury/models/reversal_create_request.rb', line 16 def reason @reason end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/modern_treasury/models/reversal_create_request.rb', line 57 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. reason = hash.key?('reason') ? hash['reason'] : nil = hash.key?('metadata') ? hash['metadata'] : SKIP ledger_transaction = LedgerTransactionCreateRequest.from_hash(hash['ledger_transaction']) if hash['ledger_transaction'] # Create object from extracted values. ReversalCreateRequest.new(reason, , ledger_transaction) end |
.names ⇒ Object
A mapping from model property names to API property names.
29 30 31 32 33 34 35 |
# File 'lib/modern_treasury/models/reversal_create_request.rb', line 29 def self.names @_hash = {} if @_hash.nil? @_hash['reason'] = 'reason' @_hash['metadata'] = 'metadata' @_hash['ledger_transaction'] = 'ledger_transaction' @_hash end |
.nullables ⇒ Object
An array for nullable fields
46 47 48 |
# File 'lib/modern_treasury/models/reversal_create_request.rb', line 46 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
38 39 40 41 42 43 |
# File 'lib/modern_treasury/models/reversal_create_request.rb', line 38 def self.optionals %w[ metadata ledger_transaction ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
80 81 82 83 84 |
# File 'lib/modern_treasury/models/reversal_create_request.rb', line 80 def inspect class_name = self.class.name.split('::').last "<#{class_name} reason: #{@reason.inspect}, metadata: #{@metadata.inspect},"\ " ledger_transaction: #{@ledger_transaction.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
73 74 75 76 77 |
# File 'lib/modern_treasury/models/reversal_create_request.rb', line 73 def to_s class_name = self.class.name.split('::').last "<#{class_name} reason: #{@reason}, metadata: #{@metadata}, ledger_transaction:"\ " #{@ledger_transaction}>" end |