Class: FdxV660Api::PensionSourceEntity

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

Overview

The source of pension funds

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(display_name: SKIP, amount: SKIP, payment_option: SKIP, as_of_date: SKIP, frequency: SKIP, start_date: SKIP, additional_properties: nil) ⇒ PensionSourceEntity

Returns a new instance of PensionSourceEntity.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/fdx_v660_api/models/pension_source_entity.rb', line 65

def initialize(display_name: SKIP, amount: SKIP, payment_option: SKIP,
               as_of_date: SKIP, frequency: SKIP, start_date: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @display_name = display_name unless display_name == SKIP
  @amount = amount unless amount == SKIP
  @payment_option = payment_option unless payment_option == SKIP
  @as_of_date = as_of_date unless as_of_date == SKIP
  @frequency = frequency unless frequency == SKIP
  @start_date = start_date unless start_date == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#amountFloat

Benefit Amount

Returns:

  • (Float)


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

def amount
  @amount
end

#as_of_dateDate

Date benefit was calculated

Returns:

  • (Date)


26
27
28
# File 'lib/fdx_v660_api/models/pension_source_entity.rb', line 26

def as_of_date
  @as_of_date
end

#display_nameString

Name of the source

Returns:

  • (String)


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

def display_name
  @display_name
end

#frequencyEventFrequency1

Defines how often the pension payment repeats

Returns:



30
31
32
# File 'lib/fdx_v660_api/models/pension_source_entity.rb', line 30

def frequency
  @frequency
end

#payment_optionString

Form of payment

Returns:

  • (String)


22
23
24
# File 'lib/fdx_v660_api/models/pension_source_entity.rb', line 22

def payment_option
  @payment_option
end

#start_dateDate

Assumed retirement date. As of date amount is payable

Returns:

  • (Date)


34
35
36
# File 'lib/fdx_v660_api/models/pension_source_entity.rb', line 34

def start_date
  @start_date
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/fdx_v660_api/models/pension_source_entity.rb', line 81

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  display_name = hash.key?('displayName') ? hash['displayName'] : SKIP
  amount = hash.key?('amount') ? hash['amount'] : SKIP
  payment_option = hash.key?('paymentOption') ? hash['paymentOption'] : SKIP
  as_of_date = hash.key?('asOfDate') ? hash['asOfDate'] : SKIP
  frequency = hash.key?('frequency') ? hash['frequency'] : SKIP
  start_date = hash.key?('startDate') ? hash['startDate'] : 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.
  PensionSourceEntity.new(display_name: display_name,
                          amount: amount,
                          payment_option: payment_option,
                          as_of_date: as_of_date,
                          frequency: frequency,
                          start_date: start_date,
                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



37
38
39
40
41
42
43
44
45
46
# File 'lib/fdx_v660_api/models/pension_source_entity.rb', line 37

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['display_name'] = 'displayName'
  @_hash['amount'] = 'amount'
  @_hash['payment_option'] = 'paymentOption'
  @_hash['as_of_date'] = 'asOfDate'
  @_hash['frequency'] = 'frequency'
  @_hash['start_date'] = 'startDate'
  @_hash
end

.nullablesObject

An array for nullable fields



61
62
63
# File 'lib/fdx_v660_api/models/pension_source_entity.rb', line 61

def self.nullables
  []
end

.optionalsObject

An array for optional fields



49
50
51
52
53
54
55
56
57
58
# File 'lib/fdx_v660_api/models/pension_source_entity.rb', line 49

def self.optionals
  %w[
    display_name
    amount
    payment_option
    as_of_date
    frequency
    start_date
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



111
112
113
114
115
116
117
# File 'lib/fdx_v660_api/models/pension_source_entity.rb', line 111

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.



128
129
130
131
132
133
134
# File 'lib/fdx_v660_api/models/pension_source_entity.rb', line 128

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} display_name: #{@display_name.inspect}, amount: #{@amount.inspect},"\
  " payment_option: #{@payment_option.inspect}, as_of_date: #{@as_of_date.inspect}, frequency:"\
  " #{@frequency.inspect}, start_date: #{@start_date.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



120
121
122
123
124
125
# File 'lib/fdx_v660_api/models/pension_source_entity.rb', line 120

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} display_name: #{@display_name}, amount: #{@amount}, payment_option:"\
  " #{@payment_option}, as_of_date: #{@as_of_date}, frequency: #{@frequency}, start_date:"\
  " #{@start_date}, additional_properties: #{@additional_properties}>"
end