Class: ModernTreasury::Balances1

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

Overview

Balances1 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(as_of_date: SKIP, effective_at: SKIP) ⇒ Balances1

Returns a new instance of Balances1.



42
43
44
45
# File 'lib/modern_treasury/models/balances1.rb', line 42

def initialize(as_of_date: SKIP, effective_at: SKIP)
  @as_of_date = as_of_date unless as_of_date == SKIP
  @effective_at = effective_at unless effective_at == SKIP
end

Instance Attribute Details

#as_of_dateDate

TODO: Write general description for this method

Returns:

  • (Date)


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

def as_of_date
  @as_of_date
end

#effective_atDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


19
20
21
# File 'lib/modern_treasury/models/balances1.rb', line 19

def effective_at
  @effective_at
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  as_of_date = hash.key?('as_of_date') ? hash['as_of_date'] : SKIP
  effective_at = if hash.key?('effective_at')
                   (DateTimeHelper.from_rfc3339(hash['effective_at']) if hash['effective_at'])
                 else
                   SKIP
                 end

  # Create object from extracted values.
  Balances1.new(as_of_date: as_of_date,
                effective_at: effective_at)
end

.namesObject

A mapping from model property names to API property names.



22
23
24
25
26
27
# File 'lib/modern_treasury/models/balances1.rb', line 22

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['as_of_date'] = 'as_of_date'
  @_hash['effective_at'] = 'effective_at'
  @_hash
end

.nullablesObject

An array for nullable fields



38
39
40
# File 'lib/modern_treasury/models/balances1.rb', line 38

def self.nullables
  []
end

.optionalsObject

An array for optional fields



30
31
32
33
34
35
# File 'lib/modern_treasury/models/balances1.rb', line 30

def self.optionals
  %w[
    as_of_date
    effective_at
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



75
76
77
78
79
# File 'lib/modern_treasury/models/balances1.rb', line 75

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} as_of_date: #{@as_of_date.inspect}, effective_at:"\
  " #{@effective_at.inspect}>"
end

#to_custom_effective_atObject



64
65
66
# File 'lib/modern_treasury/models/balances1.rb', line 64

def to_custom_effective_at
  DateTimeHelper.to_rfc3339(effective_at)
end

#to_sObject

Provides a human-readable string representation of the object.



69
70
71
72
# File 'lib/modern_treasury/models/balances1.rb', line 69

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} as_of_date: #{@as_of_date}, effective_at: #{@effective_at}>"
end