Class: ModernTreasury::LedgerEventHandlerCreateRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ModernTreasury::LedgerEventHandlerCreateRequest
- Defined in:
- lib/modern_treasury/models/ledger_event_handler_create_request.rb
Overview
LedgerEventHandlerCreateRequest Model.
Instance Attribute Summary collapse
-
#conditions ⇒ LedgerEventHandlerConditions
The id of the ledger that this account belongs to.
-
#description ⇒ String
An optional description.
-
#ledger_id ⇒ UUID | String
The id of the ledger that this account belongs to.
-
#ledger_transaction_template ⇒ LedgerEventHandlerLedgerTransactionTemplate
The id of the ledger that this account belongs to.
-
#metadata ⇒ Hash[String, String]
Additional data represented as key-value pairs.
-
#name ⇒ String
Name of the ledger event handler.
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(name:, ledger_transaction_template:, description: SKIP, ledger_id: SKIP, conditions: SKIP, metadata: SKIP, additional_properties: nil) ⇒ LedgerEventHandlerCreateRequest
constructor
A new instance of LedgerEventHandlerCreateRequest.
-
#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(name:, ledger_transaction_template:, description: SKIP, ledger_id: SKIP, conditions: SKIP, metadata: SKIP, additional_properties: nil) ⇒ LedgerEventHandlerCreateRequest
Returns a new instance of LedgerEventHandlerCreateRequest.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/modern_treasury/models/ledger_event_handler_create_request.rb', line 67 def initialize(name:, ledger_transaction_template:, description: SKIP, ledger_id: SKIP, conditions: SKIP, metadata: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @name = name @description = description unless description == SKIP @ledger_id = ledger_id unless ledger_id == SKIP @ledger_transaction_template = ledger_transaction_template @conditions = conditions unless conditions == SKIP @metadata = unless == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#conditions ⇒ LedgerEventHandlerConditions
The id of the ledger that this account belongs to.
30 31 32 |
# File 'lib/modern_treasury/models/ledger_event_handler_create_request.rb', line 30 def conditions @conditions end |
#description ⇒ String
An optional description.
18 19 20 |
# File 'lib/modern_treasury/models/ledger_event_handler_create_request.rb', line 18 def description @description end |
#ledger_id ⇒ UUID | String
The id of the ledger that this account belongs to.
22 23 24 |
# File 'lib/modern_treasury/models/ledger_event_handler_create_request.rb', line 22 def ledger_id @ledger_id end |
#ledger_transaction_template ⇒ LedgerEventHandlerLedgerTransactionTemplate
The id of the ledger that this account belongs to.
26 27 28 |
# File 'lib/modern_treasury/models/ledger_event_handler_create_request.rb', line 26 def ledger_transaction_template @ledger_transaction_template end |
#metadata ⇒ Hash[String, String]
Additional data represented as key-value pairs. Both the key and value must be strings.
35 36 37 |
# File 'lib/modern_treasury/models/ledger_event_handler_create_request.rb', line 35 def @metadata end |
#name ⇒ String
Name of the ledger event handler.
14 15 16 |
# File 'lib/modern_treasury/models/ledger_event_handler_create_request.rb', line 14 def name @name end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 112 |
# File 'lib/modern_treasury/models/ledger_event_handler_create_request.rb', line 83 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. name = hash.key?('name') ? hash['name'] : nil if hash['ledger_transaction_template'] ledger_transaction_template = LedgerEventHandlerLedgerTransactionTemplate.from_hash(hash['ledger_transaction_template']) end description = hash.key?('description') ? hash['description'] : SKIP ledger_id = hash.key?('ledger_id') ? hash['ledger_id'] : SKIP conditions = LedgerEventHandlerConditions.from_hash(hash['conditions']) if hash['conditions'] = 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. LedgerEventHandlerCreateRequest.new(name: name, ledger_transaction_template: ledger_transaction_template, description: description, ledger_id: ledger_id, conditions: conditions, metadata: , additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/modern_treasury/models/ledger_event_handler_create_request.rb', line 38 def self.names @_hash = {} if @_hash.nil? @_hash['name'] = 'name' @_hash['description'] = 'description' @_hash['ledger_id'] = 'ledger_id' @_hash['ledger_transaction_template'] = 'ledger_transaction_template' @_hash['conditions'] = 'conditions' @_hash['metadata'] = 'metadata' @_hash end |
.nullables ⇒ Object
An array for nullable fields
60 61 62 63 64 65 |
# File 'lib/modern_treasury/models/ledger_event_handler_create_request.rb', line 60 def self.nullables %w[ description metadata ] end |
.optionals ⇒ Object
An array for optional fields
50 51 52 53 54 55 56 57 |
# File 'lib/modern_treasury/models/ledger_event_handler_create_request.rb', line 50 def self.optionals %w[ description ledger_id conditions metadata ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
123 124 125 126 127 128 129 |
# File 'lib/modern_treasury/models/ledger_event_handler_create_request.rb', line 123 def inspect class_name = self.class.name.split('::').last "<#{class_name} name: #{@name.inspect}, description: #{@description.inspect}, ledger_id:"\ " #{@ledger_id.inspect}, ledger_transaction_template:"\ " #{@ledger_transaction_template.inspect}, conditions: #{@conditions.inspect}, metadata:"\ " #{@metadata.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
115 116 117 118 119 120 |
# File 'lib/modern_treasury/models/ledger_event_handler_create_request.rb', line 115 def to_s class_name = self.class.name.split('::').last "<#{class_name} name: #{@name}, description: #{@description}, ledger_id: #{@ledger_id},"\ " ledger_transaction_template: #{@ledger_transaction_template}, conditions: #{@conditions},"\ " metadata: #{@metadata}, additional_properties: #{@additional_properties}>" end |