Class: FdxV660Api::TransferEntity

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

Overview

A single transfer of money. Refer to Transfers for a list of multiple transfers.

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(transfer_id: SKIP, from_account_id: SKIP, to_account_id: SKIP, amount: SKIP, memo: SKIP, payment_details: SKIP, due_date: SKIP, reference_id: SKIP, status: SKIP, transfer_time: SKIP, additional_properties: nil) ⇒ TransferEntity

Returns a new instance of TransferEntity.



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/fdx_v660_api/models/transfer_entity.rb', line 93

def initialize(transfer_id: SKIP, from_account_id: SKIP,
               to_account_id: SKIP, amount: SKIP, memo: SKIP,
               payment_details: SKIP, due_date: SKIP, reference_id: SKIP,
               status: SKIP, transfer_time: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @transfer_id = transfer_id unless transfer_id == SKIP
  @from_account_id =  unless  == SKIP
  @to_account_id =  unless  == SKIP
  @amount = amount unless amount == SKIP
  @memo = memo unless memo == SKIP
  @payment_details = payment_details unless payment_details == SKIP
  @due_date = due_date unless due_date == SKIP
  @reference_id = reference_id unless reference_id == SKIP
  @status = status unless status == SKIP
  @transfer_time = transfer_time unless transfer_time == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#amountFloat

Positive amount of money to be transferred

Returns:

  • (Float)


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

def amount
  @amount
end

#due_dateDate

Desired date when the funds should be credited in the destination account

Returns:

  • (Date)


42
43
44
# File 'lib/fdx_v660_api/models/transfer_entity.rb', line 42

def due_date
  @due_date
end

#from_account_idString

Long-term persistent identity of the source account

Returns:

  • (String)


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

def 
  @from_account_id
end

#memoString

User-entered reason for transfer

Returns:

  • (String)


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

def memo
  @memo
end

#payment_detailsPaymentDetailsEntity4

Payment details



38
39
40
# File 'lib/fdx_v660_api/models/transfer_entity.rb', line 38

def payment_details
  @payment_details
end

#reference_idString

Long-term persistent identifier for transfer attempt

Returns:

  • (String)


46
47
48
# File 'lib/fdx_v660_api/models/transfer_entity.rb', line 46

def reference_id
  @reference_id
end

#statusPaymentStatus1

CANCELLED, FAILED, NOFUNDS, PROCESSED, PROCESSING, SCHEDULED

Returns:



50
51
52
# File 'lib/fdx_v660_api/models/transfer_entity.rb', line 50

def status
  @status
end

#to_account_idString

Long-term persistent identity of the destination account

Returns:

  • (String)


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

def 
  @to_account_id
end

#transfer_idString

Client generated, long-term persistent identity of the transfer action. This ID should be maintained and returned by institution. Cannot be changed and should be omitted from an update request

Returns:

  • (String)


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

def transfer_id
  @transfer_id
end

#transfer_timeDateTime

Date of transfer attempt

Returns:

  • (DateTime)


54
55
56
# File 'lib/fdx_v660_api/models/transfer_entity.rb', line 54

def transfer_time
  @transfer_time
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/fdx_v660_api/models/transfer_entity.rb', line 115

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  transfer_id = hash.key?('transferId') ? hash['transferId'] : SKIP
   =
    hash.key?('fromAccountId') ? hash['fromAccountId'] : SKIP
   = hash.key?('toAccountId') ? hash['toAccountId'] : SKIP
  amount = hash.key?('amount') ? hash['amount'] : SKIP
  memo = hash.key?('memo') ? hash['memo'] : SKIP
  payment_details = PaymentDetailsEntity4.from_hash(hash['paymentDetails']) if
    hash['paymentDetails']
  due_date = hash.key?('dueDate') ? hash['dueDate'] : SKIP
  reference_id = hash.key?('referenceId') ? hash['referenceId'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  transfer_time = if hash.key?('transferTime')
                    (DateTimeHelper.from_rfc3339(hash['transferTime']) if hash['transferTime'])
                  else
                    SKIP
                  end

  # 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.
  TransferEntity.new(transfer_id: transfer_id,
                     from_account_id: ,
                     to_account_id: ,
                     amount: amount,
                     memo: memo,
                     payment_details: payment_details,
                     due_date: due_date,
                     reference_id: reference_id,
                     status: status,
                     transfer_time: transfer_time,
                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/fdx_v660_api/models/transfer_entity.rb', line 57

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['transfer_id'] = 'transferId'
  @_hash['from_account_id'] = 'fromAccountId'
  @_hash['to_account_id'] = 'toAccountId'
  @_hash['amount'] = 'amount'
  @_hash['memo'] = 'memo'
  @_hash['payment_details'] = 'paymentDetails'
  @_hash['due_date'] = 'dueDate'
  @_hash['reference_id'] = 'referenceId'
  @_hash['status'] = 'status'
  @_hash['transfer_time'] = 'transferTime'
  @_hash
end

.nullablesObject

An array for nullable fields



89
90
91
# File 'lib/fdx_v660_api/models/transfer_entity.rb', line 89

def self.nullables
  []
end

.optionalsObject

An array for optional fields



73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/fdx_v660_api/models/transfer_entity.rb', line 73

def self.optionals
  %w[
    transfer_id
    from_account_id
    to_account_id
    amount
    memo
    payment_details
    due_date
    reference_id
    status
    transfer_time
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



172
173
174
175
176
177
178
179
180
# File 'lib/fdx_v660_api/models/transfer_entity.rb', line 172

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} transfer_id: #{@transfer_id.inspect}, from_account_id:"\
  " #{@from_account_id.inspect}, to_account_id: #{@to_account_id.inspect}, amount:"\
  " #{@amount.inspect}, memo: #{@memo.inspect}, payment_details: #{@payment_details.inspect},"\
  " due_date: #{@due_date.inspect}, reference_id: #{@reference_id.inspect}, status:"\
  " #{@status.inspect}, transfer_time: #{@transfer_time.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_custom_transfer_timeObject



157
158
159
# File 'lib/fdx_v660_api/models/transfer_entity.rb', line 157

def to_custom_transfer_time
  DateTimeHelper.to_rfc3339(transfer_time)
end

#to_sObject

Provides a human-readable string representation of the object.



162
163
164
165
166
167
168
169
# File 'lib/fdx_v660_api/models/transfer_entity.rb', line 162

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} transfer_id: #{@transfer_id}, from_account_id: #{@from_account_id},"\
  " to_account_id: #{@to_account_id}, amount: #{@amount}, memo: #{@memo}, payment_details:"\
  " #{@payment_details}, due_date: #{@due_date}, reference_id: #{@reference_id}, status:"\
  " #{@status}, transfer_time: #{@transfer_time}, additional_properties:"\
  " #{@additional_properties}>"
end