Class: ModernTreasury::LedgerAccountPayoutCreateRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/modern_treasury/models/ledger_account_payout_create_request.rb

Overview

LedgerAccountPayoutCreateRequest Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(payout_ledger_account_id:, funding_ledger_account_id:, description: SKIP, status: SKIP, effective_at_upper_bound: SKIP, metadata: SKIP, skip_payout_ledger_transaction: SKIP, additional_properties: nil) ⇒ LedgerAccountPayoutCreateRequest

Returns a new instance of LedgerAccountPayoutCreateRequest.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/modern_treasury/models/ledger_account_payout_create_request.rb', line 83

def initialize(payout_ledger_account_id:, funding_ledger_account_id:,
               description: SKIP, status: SKIP,
               effective_at_upper_bound: SKIP, metadata: SKIP,
               skip_payout_ledger_transaction: 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
  @payout_ledger_account_id = 
  @funding_ledger_account_id = 
  @effective_at_upper_bound = effective_at_upper_bound unless effective_at_upper_bound == SKIP
  @metadata =  unless  == SKIP
  unless skip_payout_ledger_transaction == SKIP
    @skip_payout_ledger_transaction =
      skip_payout_ledger_transaction
  end
  @additional_properties = additional_properties
end

Instance Attribute Details

#descriptionString

The description of the ledger account payout.

Returns:

  • (String)


15
16
17
# File 'lib/modern_treasury/models/ledger_account_payout_create_request.rb', line 15

def description
  @description
end

#effective_at_upper_boundDateTime

The exclusive upper bound of the effective_at timestamp of the ledger entries to be included in the ledger account payout. The default value is the created_at timestamp of the ledger account payout.

Returns:

  • (DateTime)


36
37
38
# File 'lib/modern_treasury/models/ledger_account_payout_create_request.rb', line 36

def effective_at_upper_bound
  @effective_at_upper_bound
end

#funding_ledger_account_idUUID | String

The id of the funding ledger account that sends to or receives funds from the payout ledger account.

Returns:

  • (UUID | String)


30
31
32
# File 'lib/modern_treasury/models/ledger_account_payout_create_request.rb', line 30

def 
  @funding_ledger_account_id
end

#metadataHash[String, String]

Additional data represented as key-value pairs. Both the key and value must be strings.

Returns:

  • (Hash[String, String])


41
42
43
# File 'lib/modern_treasury/models/ledger_account_payout_create_request.rb', line 41

def 
  @metadata
end

#payout_ledger_account_idUUID | String

The id of the payout ledger account whose ledger entries are queried against, and its balance is reduced as a result.

Returns:

  • (UUID | String)


25
26
27
# File 'lib/modern_treasury/models/ledger_account_payout_create_request.rb', line 25

def 
  @payout_ledger_account_id
end

#skip_payout_ledger_transactionTrueClass | FalseClass

It is set to ‘false` by default. It should be set to `true` when migrating existing payouts.

Returns:

  • (TrueClass | FalseClass)


46
47
48
# File 'lib/modern_treasury/models/ledger_account_payout_create_request.rb', line 46

def skip_payout_ledger_transaction
  @skip_payout_ledger_transaction
end

#statusStatus7

The status of the ledger account payout. It is set to ‘pending` by default. To post a ledger account payout at creation, use `posted`.

Returns:



20
21
22
# File 'lib/modern_treasury/models/ledger_account_payout_create_request.rb', line 20

def status
  @status
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
138
139
140
# File 'lib/modern_treasury/models/ledger_account_payout_create_request.rb', line 105

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   =
    hash.key?('payout_ledger_account_id') ? hash['payout_ledger_account_id'] : nil
   =
    hash.key?('funding_ledger_account_id') ? hash['funding_ledger_account_id'] : nil
  description = hash.key?('description') ? hash['description'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  effective_at_upper_bound = if hash.key?('effective_at_upper_bound')
                               (DateTimeHelper.from_rfc3339(hash['effective_at_upper_bound']) if hash['effective_at_upper_bound'])
                             else
                               SKIP
                             end
   = hash.key?('metadata') ? hash['metadata'] : SKIP
  skip_payout_ledger_transaction =
    hash.key?('skip_payout_ledger_transaction') ? hash['skip_payout_ledger_transaction'] : 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.
  LedgerAccountPayoutCreateRequest.new(payout_ledger_account_id: ,
                                       funding_ledger_account_id: ,
                                       description: description,
                                       status: status,
                                       effective_at_upper_bound: effective_at_upper_bound,
                                       metadata: ,
                                       skip_payout_ledger_transaction: skip_payout_ledger_transaction,
                                       additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/modern_treasury/models/ledger_account_payout_create_request.rb', line 49

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['description'] = 'description'
  @_hash['status'] = 'status'
  @_hash['payout_ledger_account_id'] = 'payout_ledger_account_id'
  @_hash['funding_ledger_account_id'] = 'funding_ledger_account_id'
  @_hash['effective_at_upper_bound'] = 'effective_at_upper_bound'
  @_hash['metadata'] = 'metadata'
  @_hash['skip_payout_ledger_transaction'] =
    'skip_payout_ledger_transaction'
  @_hash
end

.nullablesObject

An array for nullable fields



74
75
76
77
78
79
80
81
# File 'lib/modern_treasury/models/ledger_account_payout_create_request.rb', line 74

def self.nullables
  %w[
    description
    status
    effective_at_upper_bound
    skip_payout_ledger_transaction
  ]
end

.optionalsObject

An array for optional fields



63
64
65
66
67
68
69
70
71
# File 'lib/modern_treasury/models/ledger_account_payout_create_request.rb', line 63

def self.optionals
  %w[
    description
    status
    effective_at_upper_bound
    metadata
    skip_payout_ledger_transaction
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



157
158
159
160
161
162
163
164
165
# File 'lib/modern_treasury/models/ledger_account_payout_create_request.rb', line 157

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} description: #{@description.inspect}, status: #{@status.inspect},"\
  " payout_ledger_account_id: #{@payout_ledger_account_id.inspect}, funding_ledger_account_id:"\
  " #{@funding_ledger_account_id.inspect}, effective_at_upper_bound:"\
  " #{@effective_at_upper_bound.inspect}, metadata: #{@metadata.inspect},"\
  " skip_payout_ledger_transaction: #{@skip_payout_ledger_transaction.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_custom_effective_at_upper_boundObject



142
143
144
# File 'lib/modern_treasury/models/ledger_account_payout_create_request.rb', line 142

def to_custom_effective_at_upper_bound
  DateTimeHelper.to_rfc3339(effective_at_upper_bound)
end

#to_sObject

Provides a human-readable string representation of the object.



147
148
149
150
151
152
153
154
# File 'lib/modern_treasury/models/ledger_account_payout_create_request.rb', line 147

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} description: #{@description}, status: #{@status}, payout_ledger_account_id:"\
  " #{@payout_ledger_account_id}, funding_ledger_account_id: #{@funding_ledger_account_id},"\
  " effective_at_upper_bound: #{@effective_at_upper_bound}, metadata: #{@metadata},"\
  " skip_payout_ledger_transaction: #{@skip_payout_ledger_transaction}, additional_properties:"\
  " #{@additional_properties}>"
end