Class: ModernTreasury::LedgerTransactionUpdateRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ModernTreasury::LedgerTransactionUpdateRequest
- Defined in:
- lib/modern_treasury/models/ledger_transaction_update_request.rb
Overview
LedgerTransactionUpdateRequest Model.
Instance Attribute Summary collapse
-
#description ⇒ String
An optional description for internal use.
-
#effective_at ⇒ Date
The timestamp (ISO8601 format) at which the ledger transaction happened for reporting purposes.
-
#ledger_entries ⇒ Array[LedgerEntryCreateRequest]
An array of ledger entry objects.
-
#metadata ⇒ Hash[String, String]
Additional data represented as key-value pairs.
-
#status ⇒ Status11
To post a ledger transaction at creation, use ‘posted`.
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, ledger_entries: SKIP, additional_properties: nil) ⇒ LedgerTransactionUpdateRequest
constructor
A new instance of LedgerTransactionUpdateRequest.
-
#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(description: SKIP, status: SKIP, metadata: SKIP, effective_at: SKIP, ledger_entries: SKIP, additional_properties: nil) ⇒ LedgerTransactionUpdateRequest
Returns a new instance of LedgerTransactionUpdateRequest.
63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/modern_treasury/models/ledger_transaction_update_request.rb', line 63 def initialize(description: SKIP, status: SKIP, metadata: SKIP, effective_at: SKIP, ledger_entries: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @description = description unless description == SKIP @status = status unless status == SKIP @metadata = unless == SKIP @effective_at = effective_at unless effective_at == SKIP @ledger_entries = ledger_entries unless ledger_entries == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#description ⇒ String
An optional description for internal use.
14 15 16 |
# File 'lib/modern_treasury/models/ledger_transaction_update_request.rb', line 14 def description @description end |
#effective_at ⇒ Date
The timestamp (ISO8601 format) at which the ledger transaction happened for reporting purposes.
28 29 30 |
# File 'lib/modern_treasury/models/ledger_transaction_update_request.rb', line 28 def effective_at @effective_at end |
#ledger_entries ⇒ Array[LedgerEntryCreateRequest]
An array of ledger entry objects.
32 33 34 |
# File 'lib/modern_treasury/models/ledger_transaction_update_request.rb', line 32 def ledger_entries @ledger_entries end |
#metadata ⇒ Hash[String, String]
Additional data represented as key-value pairs. Both the key and value must be strings.
23 24 25 |
# File 'lib/modern_treasury/models/ledger_transaction_update_request.rb', line 23 def @metadata end |
#status ⇒ Status11
To post a ledger transaction at creation, use ‘posted`.
18 19 20 |
# File 'lib/modern_treasury/models/ledger_transaction_update_request.rb', line 18 def status @status end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 108 109 110 111 |
# File 'lib/modern_treasury/models/ledger_transaction_update_request.rb', line 78 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 = hash.key?('effective_at') ? hash['effective_at'] : SKIP # Parameter is an array, so we need to iterate through it ledger_entries = nil unless hash['ledger_entries'].nil? ledger_entries = [] hash['ledger_entries'].each do |structure| ledger_entries << (LedgerEntryCreateRequest.from_hash(structure) if structure) end end ledger_entries = SKIP unless hash.key?('ledger_entries') # 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. LedgerTransactionUpdateRequest.new(description: description, status: status, metadata: , effective_at: effective_at, ledger_entries: ledger_entries, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
35 36 37 38 39 40 41 42 43 |
# File 'lib/modern_treasury/models/ledger_transaction_update_request.rb', line 35 def self.names @_hash = {} if @_hash.nil? @_hash['description'] = 'description' @_hash['status'] = 'status' @_hash['metadata'] = 'metadata' @_hash['effective_at'] = 'effective_at' @_hash['ledger_entries'] = 'ledger_entries' @_hash end |
.nullables ⇒ Object
An array for nullable fields
57 58 59 60 61 |
# File 'lib/modern_treasury/models/ledger_transaction_update_request.rb', line 57 def self.nullables %w[ description ] end |
.optionals ⇒ Object
An array for optional fields
46 47 48 49 50 51 52 53 54 |
# File 'lib/modern_treasury/models/ledger_transaction_update_request.rb', line 46 def self.optionals %w[ description status metadata effective_at ledger_entries ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
122 123 124 125 126 127 |
# File 'lib/modern_treasury/models/ledger_transaction_update_request.rb', line 122 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}, ledger_entries:"\ " #{@ledger_entries.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
114 115 116 117 118 119 |
# File 'lib/modern_treasury/models/ledger_transaction_update_request.rb', line 114 def to_s class_name = self.class.name.split('::').last "<#{class_name} description: #{@description}, status: #{@status}, metadata: #{@metadata},"\ " effective_at: #{@effective_at}, ledger_entries: #{@ledger_entries}, additional_properties:"\ " #{@additional_properties}>" end |