Class: ModernTreasury::LedgerAccountCategoryCreateRequest

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

Overview

LedgerAccountCategoryCreateRequest 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(name = nil, currency = nil, ledger_id = nil, normal_balance = nil, description = SKIP, metadata = SKIP, currency_exponent = SKIP) ⇒ LedgerAccountCategoryCreateRequest

Returns a new instance of LedgerAccountCategoryCreateRequest.



71
72
73
74
75
76
77
78
79
80
81
# File 'lib/modern_treasury/models/ledger_account_category_create_request.rb', line 71

def initialize(name = nil, currency = nil, ledger_id = nil,
               normal_balance = nil, description = SKIP,  = SKIP,
               currency_exponent = SKIP)
  @name = name
  @description = description unless description == SKIP
  @metadata =  unless  == SKIP
  @currency = currency
  @currency_exponent = currency_exponent unless currency_exponent == SKIP
  @ledger_id = ledger_id
  @normal_balance = normal_balance
end

Instance Attribute Details

#currencyString

The currency of the ledger account category.

Returns:

  • (String)


27
28
29
# File 'lib/modern_treasury/models/ledger_account_category_create_request.rb', line 27

def currency
  @currency
end

#currency_exponentInteger

The currency exponent of the ledger account category.

Returns:

  • (Integer)


31
32
33
# File 'lib/modern_treasury/models/ledger_account_category_create_request.rb', line 31

def currency_exponent
  @currency_exponent
end

#descriptionString

The description of the ledger account category.

Returns:

  • (String)


18
19
20
# File 'lib/modern_treasury/models/ledger_account_category_create_request.rb', line 18

def description
  @description
end

#ledger_idUUID | String

The id of the ledger that this account category belongs to.

Returns:

  • (UUID | String)


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

def ledger_id
  @ledger_id
end

#metadataHash[String, String]

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

Returns:

  • (Hash[String, String])


23
24
25
# File 'lib/modern_treasury/models/ledger_account_category_create_request.rb', line 23

def 
  @metadata
end

#nameString

The name of the ledger account category.

Returns:

  • (String)


14
15
16
# File 'lib/modern_treasury/models/ledger_account_category_create_request.rb', line 14

def name
  @name
end

#normal_balanceNormalBalance2Enum

The normal balance of the ledger account category.

Returns:



39
40
41
# File 'lib/modern_treasury/models/ledger_account_category_create_request.rb', line 39

def normal_balance
  @normal_balance
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  name = hash.key?('name') ? hash['name'] : nil
  currency = hash.key?('currency') ? hash['currency'] : nil
  ledger_id = hash.key?('ledger_id') ? hash['ledger_id'] : nil
  normal_balance =
    hash.key?('normal_balance') ? hash['normal_balance'] : nil
  description = hash.key?('description') ? hash['description'] : SKIP
   = hash.key?('metadata') ? hash['metadata'] : SKIP
  currency_exponent =
    hash.key?('currency_exponent') ? hash['currency_exponent'] : SKIP

  # Create object from extracted values.
  LedgerAccountCategoryCreateRequest.new(name,
                                         currency,
                                         ledger_id,
                                         normal_balance,
                                         description,
                                         ,
                                         currency_exponent)
end

.namesObject

A mapping from model property names to API property names.



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/modern_treasury/models/ledger_account_category_create_request.rb', line 42

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['name'] = 'name'
  @_hash['description'] = 'description'
  @_hash['metadata'] = 'metadata'
  @_hash['currency'] = 'currency'
  @_hash['currency_exponent'] = 'currency_exponent'
  @_hash['ledger_id'] = 'ledger_id'
  @_hash['normal_balance'] = 'normal_balance'
  @_hash
end

.nullablesObject

An array for nullable fields



64
65
66
67
68
69
# File 'lib/modern_treasury/models/ledger_account_category_create_request.rb', line 64

def self.nullables
  %w[
    description
    currency_exponent
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    description
    metadata
    currency_exponent
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} name: #{@name.inspect}, description: #{@description.inspect}, metadata:"\
  " #{@metadata.inspect}, currency: #{@currency.inspect}, currency_exponent:"\
  " #{@currency_exponent.inspect}, ledger_id: #{@ledger_id.inspect}, normal_balance:"\
  " #{@normal_balance.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



109
110
111
112
113
114
# File 'lib/modern_treasury/models/ledger_account_category_create_request.rb', line 109

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} name: #{@name}, description: #{@description}, metadata: #{@metadata},"\
  " currency: #{@currency}, currency_exponent: #{@currency_exponent}, ledger_id:"\
  " #{@ledger_id}, normal_balance: #{@normal_balance}>"
end