Class: FdxV660Api::ScheduledPaymentEntity

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

Overview

A payment scheduled on the account

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(amount: SKIP, date: SKIP, type: SKIP, pay_to_principal: SKIP, additional_properties: nil) ⇒ ScheduledPaymentEntity

Returns a new instance of ScheduledPaymentEntity.



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

def initialize(amount: SKIP, date: SKIP, type: SKIP, pay_to_principal: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @amount = amount unless amount == SKIP
  @date = date unless date == SKIP
  @type = type unless type == SKIP
  @pay_to_principal = pay_to_principal unless pay_to_principal == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#amountFloat

Total payment due or next payment due. Monthly payment due for loans

Returns:

  • (Float)


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

def amount
  @amount
end

#dateDate

The date that the payment is due

Returns:

  • (Date)


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

def date
  @date
end

#pay_to_principalTrueClass | FalseClass

Whether payment is applied to principal or not

Returns:

  • (TrueClass | FalseClass)


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

def pay_to_principal
  @pay_to_principal
end

#typeScheduledPaymentType2

Type of payment (AUTOPAY, ONE_TIME, REPEATING)



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

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  amount = hash.key?('amount') ? hash['amount'] : SKIP
  date = hash.key?('date') ? hash['date'] : SKIP
  type = hash.key?('type') ? hash['type'] : SKIP
  pay_to_principal =
    hash.key?('payToPrincipal') ? hash['payToPrincipal'] : 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.
  ScheduledPaymentEntity.new(amount: amount,
                             date: date,
                             type: type,
                             pay_to_principal: pay_to_principal,
                             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



29
30
31
32
33
34
35
36
# File 'lib/fdx_v660_api/models/scheduled_payment_entity.rb', line 29

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['amount'] = 'amount'
  @_hash['date'] = 'date'
  @_hash['type'] = 'type'
  @_hash['pay_to_principal'] = 'payToPrincipal'
  @_hash
end

.nullablesObject

An array for nullable fields



49
50
51
# File 'lib/fdx_v660_api/models/scheduled_payment_entity.rb', line 49

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    amount
    date
    type
    pay_to_principal
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



93
94
95
96
97
98
99
# File 'lib/fdx_v660_api/models/scheduled_payment_entity.rb', line 93

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.



109
110
111
112
113
114
# File 'lib/fdx_v660_api/models/scheduled_payment_entity.rb', line 109

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} amount: #{@amount.inspect}, date: #{@date.inspect}, type: #{@type.inspect},"\
  " pay_to_principal: #{@pay_to_principal.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



102
103
104
105
106
# File 'lib/fdx_v660_api/models/scheduled_payment_entity.rb', line 102

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} amount: #{@amount}, date: #{@date}, type: #{@type}, pay_to_principal:"\
  " #{@pay_to_principal}, additional_properties: #{@additional_properties}>"
end