Class: FdxV660Api::InterestRateEntity7

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/fdx_v660_api/models/interest_rate_entity7.rb

Overview

The periodic interest rate on the loan

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(rate: SKIP, rate_as_of: SKIP, compounding_period: SKIP, prior_rate: SKIP, type: SKIP, index: SKIP, additional_properties: nil) ⇒ InterestRateEntity7

Returns a new instance of InterestRateEntity7.



68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/fdx_v660_api/models/interest_rate_entity7.rb', line 68

def initialize(rate: SKIP, rate_as_of: SKIP, compounding_period: SKIP,
               prior_rate: SKIP, type: SKIP, index: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @rate = rate unless rate == SKIP
  @rate_as_of = rate_as_of unless rate_as_of == SKIP
  @compounding_period = compounding_period unless compounding_period == SKIP
  @prior_rate = prior_rate unless prior_rate == SKIP
  @type = type unless type == SKIP
  @index = index unless index == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#compounding_periodCompoundingPeriod3

One of DAILY, WEEKLY, BIWEEKLY, SEMIMONTHLY, MONTHLY, SEMIANNUALLY, ANNUALLY

Returns:



23
24
25
# File 'lib/fdx_v660_api/models/interest_rate_entity7.rb', line 23

def compounding_period
  @compounding_period
end

#indexString

If an INDEXED rate, the name of the index to which the rate is tied: EONIA, EURIBOR, EURREPO, FEFUND, LIBOR, PRIME, SOFR, SONIA, etc.

Returns:

  • (String)


37
38
39
# File 'lib/fdx_v660_api/models/interest_rate_entity7.rb', line 37

def index
  @index
end

#prior_rateFloat

Prior interest rate value, if any, before change on AsOf date

Returns:

  • (Float)


27
28
29
# File 'lib/fdx_v660_api/models/interest_rate_entity7.rb', line 27

def prior_rate
  @prior_rate
end

#rateFloat

Current interest rate value

Returns:

  • (Float)


14
15
16
# File 'lib/fdx_v660_api/models/interest_rate_entity7.rb', line 14

def rate
  @rate
end

#rate_as_ofDate

Date of change to the current interest rate value

Returns:

  • (Date)


18
19
20
# File 'lib/fdx_v660_api/models/interest_rate_entity7.rb', line 18

def rate_as_of
  @rate_as_of
end

#typeInterestRateType1

One of FIXED, INDEXED or VARIABLE

Returns:



31
32
33
# File 'lib/fdx_v660_api/models/interest_rate_entity7.rb', line 31

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
# File 'lib/fdx_v660_api/models/interest_rate_entity7.rb', line 84

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  rate = hash.key?('rate') ? hash['rate'] : SKIP
  rate_as_of = hash.key?('rateAsOf') ? hash['rateAsOf'] : SKIP
  compounding_period =
    hash.key?('compoundingPeriod') ? hash['compoundingPeriod'] : SKIP
  prior_rate = hash.key?('priorRate') ? hash['priorRate'] : SKIP
  type = hash.key?('type') ? hash['type'] : SKIP
  index = hash.key?('index') ? hash['index'] : 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.
  InterestRateEntity7.new(rate: rate,
                          rate_as_of: rate_as_of,
                          compounding_period: compounding_period,
                          prior_rate: prior_rate,
                          type: type,
                          index: index,
                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



40
41
42
43
44
45
46
47
48
49
# File 'lib/fdx_v660_api/models/interest_rate_entity7.rb', line 40

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['rate'] = 'rate'
  @_hash['rate_as_of'] = 'rateAsOf'
  @_hash['compounding_period'] = 'compoundingPeriod'
  @_hash['prior_rate'] = 'priorRate'
  @_hash['type'] = 'type'
  @_hash['index'] = 'index'
  @_hash
end

.nullablesObject

An array for nullable fields



64
65
66
# File 'lib/fdx_v660_api/models/interest_rate_entity7.rb', line 64

def self.nullables
  []
end

.optionalsObject

An array for optional fields



52
53
54
55
56
57
58
59
60
61
# File 'lib/fdx_v660_api/models/interest_rate_entity7.rb', line 52

def self.optionals
  %w[
    rate
    rate_as_of
    compounding_period
    prior_rate
    type
    index
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



115
116
117
118
119
120
121
# File 'lib/fdx_v660_api/models/interest_rate_entity7.rb', line 115

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



132
133
134
135
136
137
138
# File 'lib/fdx_v660_api/models/interest_rate_entity7.rb', line 132

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} rate: #{@rate.inspect}, rate_as_of: #{@rate_as_of.inspect},"\
  " compounding_period: #{@compounding_period.inspect}, prior_rate: #{@prior_rate.inspect},"\
  " type: #{@type.inspect}, index: #{@index.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



124
125
126
127
128
129
# File 'lib/fdx_v660_api/models/interest_rate_entity7.rb', line 124

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} rate: #{@rate}, rate_as_of: #{@rate_as_of}, compounding_period:"\
  " #{@compounding_period}, prior_rate: #{@prior_rate}, type: #{@type}, index: #{@index},"\
  " additional_properties: #{@additional_properties}>"
end