Class: ModernTreasury::LedgerTransactionReversalCreateRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ModernTreasury::LedgerTransactionReversalCreateRequest
- Defined in:
- lib/modern_treasury/models/ledger_transaction_reversal_create_request.rb
Overview
LedgerTransactionReversalCreateRequest Model.
Instance Attribute Summary collapse
-
#description ⇒ String
An optional free-form description for the reversal ledger transaction.
-
#effective_at ⇒ DateTime
The timestamp (ISO8601 format) at which the reversal ledger transaction happened for reporting purposes.
-
#external_id ⇒ String
Must be unique within the ledger.
-
#ledgerable_id ⇒ UUID | String
Specify this if you’d like to link the reversal ledger transaction to a Payment object like Return or Reversal.
-
#ledgerable_type ⇒ LedgerableType5Enum
Specify this if you’d like to link the reversal ledger transaction to a Payment object like Return or Reversal.
-
#metadata ⇒ Hash[String, String]
Additional data to be added to the reversal ledger transaction as key-value pairs.
-
#status ⇒ Status15Enum
Status of the reversal ledger transaction.
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(description = SKIP, status = SKIP, metadata = SKIP, effective_at = SKIP, external_id = SKIP, ledgerable_type = SKIP, ledgerable_id = SKIP) ⇒ LedgerTransactionReversalCreateRequest
constructor
A new instance of LedgerTransactionReversalCreateRequest.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_effective_at ⇒ Object
-
#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(description = SKIP, status = SKIP, metadata = SKIP, effective_at = SKIP, external_id = SKIP, ledgerable_type = SKIP, ledgerable_id = SKIP) ⇒ LedgerTransactionReversalCreateRequest
Returns a new instance of LedgerTransactionReversalCreateRequest.
81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/modern_treasury/models/ledger_transaction_reversal_create_request.rb', line 81 def initialize(description = SKIP, status = SKIP, = SKIP, effective_at = SKIP, external_id = SKIP, ledgerable_type = SKIP, ledgerable_id = SKIP) @description = description unless description == SKIP @status = status unless status == SKIP @metadata = unless == SKIP @effective_at = effective_at unless effective_at == SKIP @external_id = external_id unless external_id == SKIP @ledgerable_type = ledgerable_type unless ledgerable_type == SKIP @ledgerable_id = ledgerable_id unless ledgerable_id == SKIP end |
Instance Attribute Details
#description ⇒ String
An optional free-form description for the reversal ledger transaction. Maximum of 1000 characters allowed.
16 17 18 |
# File 'lib/modern_treasury/models/ledger_transaction_reversal_create_request.rb', line 16 def description @description end |
#effective_at ⇒ DateTime
The timestamp (ISO8601 format) at which the reversal ledger transaction happened for reporting purposes. It defaults to the ‘effective_at` of the original ledger transaction if not provided.
32 33 34 |
# File 'lib/modern_treasury/models/ledger_transaction_reversal_create_request.rb', line 32 def effective_at @effective_at end |
#external_id ⇒ String
Must be unique within the ledger.
36 37 38 |
# File 'lib/modern_treasury/models/ledger_transaction_reversal_create_request.rb', line 36 def external_id @external_id end |
#ledgerable_id ⇒ UUID | String
Specify this if you’d like to link the reversal ledger transaction to a Payment object like Return or Reversal.
46 47 48 |
# File 'lib/modern_treasury/models/ledger_transaction_reversal_create_request.rb', line 46 def ledgerable_id @ledgerable_id end |
#ledgerable_type ⇒ LedgerableType5Enum
Specify this if you’d like to link the reversal ledger transaction to a Payment object like Return or Reversal.
41 42 43 |
# File 'lib/modern_treasury/models/ledger_transaction_reversal_create_request.rb', line 41 def ledgerable_type @ledgerable_type end |
#metadata ⇒ Hash[String, String]
Additional data to be added to the reversal ledger transaction as key-value pairs. Both the key and value must be strings.
26 27 28 |
# File 'lib/modern_treasury/models/ledger_transaction_reversal_create_request.rb', line 26 def @metadata end |
#status ⇒ Status15Enum
Status of the reversal ledger transaction. It defaults to ‘posted` if not provided.
21 22 23 |
# File 'lib/modern_treasury/models/ledger_transaction_reversal_create_request.rb', line 21 def status @status end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/modern_treasury/models/ledger_transaction_reversal_create_request.rb', line 94 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. description = hash.key?('description') ? hash['description'] : SKIP status = hash.key?('status') ? hash['status'] : SKIP = hash.key?('metadata') ? hash['metadata'] : SKIP effective_at = if hash.key?('effective_at') (DateTimeHelper.from_rfc3339(hash['effective_at']) if hash['effective_at']) else SKIP end external_id = hash.key?('external_id') ? hash['external_id'] : SKIP ledgerable_type = hash.key?('ledgerable_type') ? hash['ledgerable_type'] : SKIP ledgerable_id = hash.key?('ledgerable_id') ? hash['ledgerable_id'] : SKIP # Create object from extracted values. LedgerTransactionReversalCreateRequest.new(description, status, , effective_at, external_id, ledgerable_type, ledgerable_id) end |
.names ⇒ Object
A mapping from model property names to API property names.
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/modern_treasury/models/ledger_transaction_reversal_create_request.rb', line 49 def self.names @_hash = {} if @_hash.nil? @_hash['description'] = 'description' @_hash['status'] = 'status' @_hash['metadata'] = 'metadata' @_hash['effective_at'] = 'effective_at' @_hash['external_id'] = 'external_id' @_hash['ledgerable_type'] = 'ledgerable_type' @_hash['ledgerable_id'] = 'ledgerable_id' @_hash end |
.nullables ⇒ Object
An array for nullable fields
75 76 77 78 79 |
# File 'lib/modern_treasury/models/ledger_transaction_reversal_create_request.rb', line 75 def self.nullables %w[ effective_at ] end |
.optionals ⇒ Object
An array for optional fields
62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/modern_treasury/models/ledger_transaction_reversal_create_request.rb', line 62 def self.optionals %w[ description status metadata effective_at external_id ledgerable_type ledgerable_id ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
134 135 136 137 138 139 140 |
# File 'lib/modern_treasury/models/ledger_transaction_reversal_create_request.rb', line 134 def inspect class_name = self.class.name.split('::').last "<#{class_name} description: #{@description.inspect}, status: #{@status.inspect}, metadata:"\ " #{@metadata.inspect}, effective_at: #{@effective_at.inspect}, external_id:"\ " #{@external_id.inspect}, ledgerable_type: #{@ledgerable_type.inspect}, ledgerable_id:"\ " #{@ledgerable_id.inspect}>" end |
#to_custom_effective_at ⇒ Object
121 122 123 |
# File 'lib/modern_treasury/models/ledger_transaction_reversal_create_request.rb', line 121 def to_custom_effective_at DateTimeHelper.to_rfc3339(effective_at) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
126 127 128 129 130 131 |
# File 'lib/modern_treasury/models/ledger_transaction_reversal_create_request.rb', line 126 def to_s class_name = self.class.name.split('::').last "<#{class_name} description: #{@description}, status: #{@status}, metadata: #{@metadata},"\ " effective_at: #{@effective_at}, external_id: #{@external_id}, ledgerable_type:"\ " #{@ledgerable_type}, ledgerable_id: #{@ledgerable_id}>" end |