Class: ModernTreasury::Balances3

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

Overview

Balances3 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, effective_at_lower_bound: SKIP, effective_at_upper_bound: SKIP, as_of_lock_version: SKIP) ⇒ Balances3

Returns a new instance of Balances3.



60
61
62
63
64
65
66
67
68
# File 'lib/modern_treasury/models/balances3.rb', line 60

def initialize(as_of_date: SKIP, effective_at: SKIP,
               effective_at_lower_bound: SKIP,
               effective_at_upper_bound: SKIP, as_of_lock_version: SKIP)
  @as_of_date = as_of_date unless as_of_date == SKIP
  @effective_at = effective_at unless effective_at == SKIP
  @effective_at_lower_bound = effective_at_lower_bound unless effective_at_lower_bound == SKIP
  @effective_at_upper_bound = effective_at_upper_bound unless effective_at_upper_bound == SKIP
  @as_of_lock_version = as_of_lock_version unless as_of_lock_version == 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/balances3.rb', line 15

def as_of_date
  @as_of_date
end

#as_of_lock_versionInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def as_of_lock_version
  @as_of_lock_version
end

#effective_atDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


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

def effective_at
  @effective_at
end

#effective_at_lower_boundDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


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

def effective_at_lower_bound
  @effective_at_lower_bound
end

#effective_at_upper_boundDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


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

def effective_at_upper_bound
  @effective_at_upper_bound
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/modern_treasury/models/balances3.rb', line 71

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
  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'])
                             else
                               SKIP
                             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'])
                             else
                               SKIP
                             end
  as_of_lock_version =
    hash.key?('as_of_lock_version') ? hash['as_of_lock_version'] : SKIP

  # Create object from extracted values.
  Balances3.new(as_of_date: as_of_date,
                effective_at: effective_at,
                effective_at_lower_bound: effective_at_lower_bound,
                effective_at_upper_bound: effective_at_upper_bound,
                as_of_lock_version: as_of_lock_version)
end

.namesObject

A mapping from model property names to API property names.



34
35
36
37
38
39
40
41
42
# File 'lib/modern_treasury/models/balances3.rb', line 34

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

.nullablesObject

An array for nullable fields



56
57
58
# File 'lib/modern_treasury/models/balances3.rb', line 56

def self.nullables
  []
end

.optionalsObject

An array for optional fields



45
46
47
48
49
50
51
52
53
# File 'lib/modern_treasury/models/balances3.rb', line 45

def self.optionals
  %w[
    as_of_date
    effective_at
    effective_at_lower_bound
    effective_at_upper_bound
    as_of_lock_version
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



123
124
125
126
127
128
# File 'lib/modern_treasury/models/balances3.rb', line 123

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

#to_custom_effective_atObject



102
103
104
# File 'lib/modern_treasury/models/balances3.rb', line 102

def to_custom_effective_at
  DateTimeHelper.to_rfc3339(effective_at)
end

#to_custom_effective_at_lower_boundObject



106
107
108
# File 'lib/modern_treasury/models/balances3.rb', line 106

def to_custom_effective_at_lower_bound
  DateTimeHelper.to_rfc3339(effective_at_lower_bound)
end

#to_custom_effective_at_upper_boundObject



110
111
112
# File 'lib/modern_treasury/models/balances3.rb', line 110

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.



115
116
117
118
119
120
# File 'lib/modern_treasury/models/balances3.rb', line 115

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