Class: ModernTreasury::LedgerAccountStatementCreateRequest

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

Overview

LedgerAccountStatementCreateRequest 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(ledger_account_id:, effective_at_lower_bound:, effective_at_upper_bound:, description: SKIP, metadata: SKIP, additional_properties: nil) ⇒ LedgerAccountStatementCreateRequest

Returns a new instance of LedgerAccountStatementCreateRequest.



63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/modern_treasury/models/ledger_account_statement_create_request.rb', line 63

def initialize(ledger_account_id:, effective_at_lower_bound:,
               effective_at_upper_bound:, description: SKIP, metadata: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @description = description unless description == SKIP
  @ledger_account_id = 
  @effective_at_lower_bound = effective_at_lower_bound
  @effective_at_upper_bound = effective_at_upper_bound
  @metadata =  unless  == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#descriptionString

The description of the ledger account statement.

Returns:

  • (String)


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

def description
  @description
end

#effective_at_lower_boundDateTime

The inclusive lower bound of the effective_at timestamp of the ledger entries to be included in the ledger account statement.

Returns:

  • (DateTime)


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

def effective_at_lower_bound
  @effective_at_lower_bound
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 statement.

Returns:

  • (DateTime)


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

def effective_at_upper_bound
  @effective_at_upper_bound
end

#ledger_account_idUUID | String

The id of the ledger account whose ledger entries are queried against, and its balances are computed as a result.

Returns:

  • (UUID | String)


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

def 
  @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])


35
36
37
# File 'lib/modern_treasury/models/ledger_account_statement_create_request.rb', line 35

def 
  @metadata
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
# File 'lib/modern_treasury/models/ledger_account_statement_create_request.rb', line 78

def self.from_hash(hash)
  return nil unless hash

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

.namesObject

A mapping from model property names to API property names.



38
39
40
41
42
43
44
45
46
# File 'lib/modern_treasury/models/ledger_account_statement_create_request.rb', line 38

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['description'] = 'description'
  @_hash['ledger_account_id'] = 'ledger_account_id'
  @_hash['effective_at_lower_bound'] = 'effective_at_lower_bound'
  @_hash['effective_at_upper_bound'] = 'effective_at_upper_bound'
  @_hash['metadata'] = 'metadata'
  @_hash
end

.nullablesObject

An array for nullable fields



57
58
59
60
61
# File 'lib/modern_treasury/models/ledger_account_statement_create_request.rb', line 57

def self.nullables
  %w[
    description
  ]
end

.optionalsObject

An array for optional fields



49
50
51
52
53
54
# File 'lib/modern_treasury/models/ledger_account_statement_create_request.rb', line 49

def self.optionals
  %w[
    description
    metadata
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



127
128
129
130
131
132
133
134
# File 'lib/modern_treasury/models/ledger_account_statement_create_request.rb', line 127

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

#to_custom_effective_at_lower_boundObject



109
110
111
# File 'lib/modern_treasury/models/ledger_account_statement_create_request.rb', line 109

def to_custom_effective_at_lower_bound
  DateTimeHelper.to_rfc3339(effective_at_lower_bound)
end

#to_custom_effective_at_upper_boundObject



113
114
115
# File 'lib/modern_treasury/models/ledger_account_statement_create_request.rb', line 113

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.



118
119
120
121
122
123
124
# File 'lib/modern_treasury/models/ledger_account_statement_create_request.rb', line 118

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