Class: ModernTreasury::Balances2

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

Overview

Balances2 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) ⇒ Balances2

Returns a new instance of Balances2.



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

def initialize(as_of_date: SKIP, effective_at: SKIP,
               effective_at_lower_bound: SKIP,
               effective_at_upper_bound: 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
end

Instance Attribute Details

#as_of_dateDate

TODO: Write general description for this method

Returns:

  • (Date)


15
16
17
# File 'lib/modern_treasury/models/balances2.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/balances2.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/balances2.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/balances2.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.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/modern_treasury/models/balances2.rb', line 64

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

  # Create object from extracted values.
  Balances2.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)
end

.namesObject

A mapping from model property names to API property names.



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

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
end

.nullablesObject

An array for nullable fields



50
51
52
# File 'lib/modern_treasury/models/balances2.rb', line 50

def self.nullables
  []
end

.optionalsObject

An array for optional fields



40
41
42
43
44
45
46
47
# File 'lib/modern_treasury/models/balances2.rb', line 40

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



113
114
115
116
117
118
# File 'lib/modern_treasury/models/balances2.rb', line 113

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}>"
end

#to_custom_effective_atObject



92
93
94
# File 'lib/modern_treasury/models/balances2.rb', line 92

def to_custom_effective_at
  DateTimeHelper.to_rfc3339(effective_at)
end

#to_custom_effective_at_lower_boundObject



96
97
98
# File 'lib/modern_treasury/models/balances2.rb', line 96

def to_custom_effective_at_lower_bound
  DateTimeHelper.to_rfc3339(effective_at_lower_bound)
end

#to_custom_effective_at_upper_boundObject



100
101
102
# File 'lib/modern_treasury/models/balances2.rb', line 100

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.



105
106
107
108
109
110
# File 'lib/modern_treasury/models/balances2.rb', line 105

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}>"
end