Class: FdxV660Api::TransferForCreateEntity1

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

Overview

Data of the transfer request

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, additional_properties: nil) ⇒ TransferForCreateEntity1

Returns a new instance of TransferForCreateEntity1.



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

def initialize(transfer_id: SKIP, from_account_id: SKIP,
               to_account_id: SKIP, amount: SKIP, memo: SKIP,
               payment_details: SKIP, due_date: 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
  @additional_properties = additional_properties
end

Instance Attribute Details

#amountFloat

Positive amount of money to be transferred

Returns:

  • (Float)


28
29
30
# File 'lib/fdx_v660_api/models/transfer_for_create_entity1.rb', line 28

def amount
  @amount
end

#due_dateDate

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

Returns:

  • (Date)


40
41
42
# File 'lib/fdx_v660_api/models/transfer_for_create_entity1.rb', line 40

def due_date
  @due_date
end

#from_account_idString

Long-term persistent identity of the source account

Returns:

  • (String)


20
21
22
# File 'lib/fdx_v660_api/models/transfer_for_create_entity1.rb', line 20

def 
  @from_account_id
end

#memoString

User-entered reason for transfer

Returns:

  • (String)


32
33
34
# File 'lib/fdx_v660_api/models/transfer_for_create_entity1.rb', line 32

def memo
  @memo
end

#payment_detailsPaymentDetailsEntity4

Payment details



36
37
38
# File 'lib/fdx_v660_api/models/transfer_for_create_entity1.rb', line 36

def payment_details
  @payment_details
end

#to_account_idString

Long-term persistent identity of the destination account

Returns:

  • (String)


24
25
26
# File 'lib/fdx_v660_api/models/transfer_for_create_entity1.rb', line 24

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)


16
17
18
# File 'lib/fdx_v660_api/models/transfer_for_create_entity1.rb', line 16

def transfer_id
  @transfer_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/fdx_v660_api/models/transfer_for_create_entity1.rb', line 91

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

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

.namesObject

A mapping from model property names to API property names.



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/fdx_v660_api/models/transfer_for_create_entity1.rb', line 43

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
end

.nullablesObject

An array for nullable fields



69
70
71
# File 'lib/fdx_v660_api/models/transfer_for_create_entity1.rb', line 69

def self.nullables
  []
end

.optionalsObject

An array for optional fields



56
57
58
59
60
61
62
63
64
65
66
# File 'lib/fdx_v660_api/models/transfer_for_create_entity1.rb', line 56

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

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}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



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

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}, additional_properties:"\
  " #{@additional_properties}>"
end