Class: ModernTreasury::LedgerEventHandlerConditions
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ModernTreasury::LedgerEventHandlerConditions
- Defined in:
- lib/modern_treasury/models/ledger_event_handler_conditions.rb
Overview
LedgerEventHandlerConditions Model.
Instance Attribute Summary collapse
-
#field ⇒ String
The field you’re fetching from the ‘ledgerable_event`.
-
#operator ⇒ String
What the operator between the ‘field` and `value` is.
-
#value ⇒ String
What raw string you are comparing the ‘field` against.
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(field:, operator:, value:) ⇒ LedgerEventHandlerConditions
constructor
A new instance of LedgerEventHandlerConditions.
-
#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(field:, operator:, value:) ⇒ LedgerEventHandlerConditions
Returns a new instance of LedgerEventHandlerConditions.
44 45 46 47 48 |
# File 'lib/modern_treasury/models/ledger_event_handler_conditions.rb', line 44 def initialize(field:, operator:, value:) @field = field @operator = operator @value = value end |
Instance Attribute Details
#field ⇒ String
The field you’re fetching from the ‘ledgerable_event`.
14 15 16 |
# File 'lib/modern_treasury/models/ledger_event_handler_conditions.rb', line 14 def field @field end |
#operator ⇒ String
What the operator between the ‘field` and `value` is. Currently only supports `equals`.
19 20 21 |
# File 'lib/modern_treasury/models/ledger_event_handler_conditions.rb', line 19 def operator @operator end |
#value ⇒ String
What raw string you are comparing the ‘field` against.
23 24 25 |
# File 'lib/modern_treasury/models/ledger_event_handler_conditions.rb', line 23 def value @value end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/modern_treasury/models/ledger_event_handler_conditions.rb', line 51 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. field = hash.key?('field') ? hash['field'] : nil operator = hash.key?('operator') ? hash['operator'] : nil value = hash.key?('value') ? hash['value'] : nil # Create object from extracted values. LedgerEventHandlerConditions.new(field: field, operator: operator, value: value) end |
.names ⇒ Object
A mapping from model property names to API property names.
26 27 28 29 30 31 32 |
# File 'lib/modern_treasury/models/ledger_event_handler_conditions.rb', line 26 def self.names @_hash = {} if @_hash.nil? @_hash['field'] = 'field' @_hash['operator'] = 'operator' @_hash['value'] = 'value' @_hash end |
.nullables ⇒ Object
An array for nullable fields
40 41 42 |
# File 'lib/modern_treasury/models/ledger_event_handler_conditions.rb', line 40 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
35 36 37 |
# File 'lib/modern_treasury/models/ledger_event_handler_conditions.rb', line 35 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
72 73 74 75 76 |
# File 'lib/modern_treasury/models/ledger_event_handler_conditions.rb', line 72 def inspect class_name = self.class.name.split('::').last "<#{class_name} field: #{@field.inspect}, operator: #{@operator.inspect}, value:"\ " #{@value.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
66 67 68 69 |
# File 'lib/modern_treasury/models/ledger_event_handler_conditions.rb', line 66 def to_s class_name = self.class.name.split('::').last "<#{class_name} field: #{@field}, operator: #{@operator}, value: #{@value}>" end |