Class: FdxV660Api::DirectDeposit

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

Overview

If payment by DIRECT_DEPOSIT, the details of the target 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(routing_transit_number: SKIP, account_number: SKIP, account_type: SKIP, additional_properties: nil) ⇒ DirectDeposit

Returns a new instance of DirectDeposit.



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

def initialize(routing_transit_number: SKIP, account_number: SKIP,
               account_type: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @routing_transit_number = routing_transit_number unless routing_transit_number == SKIP
  @account_number =  unless  == SKIP
  @account_type =  unless  == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_numberString

Account number last four for the deposit, i.e. masked xxxxx-x0000

Returns:

  • (String)


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

def 
  @account_number
end

#account_typeAccountType4

Type of bank account into which deposit was made, typically CHECKING or SAVINGS. Canadian accounts will also use CHECKING for chequing account types to ensure interoperability

Returns:



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

def 
  @account_type
end

#routing_transit_numberString

The deposit bank's routing transit number

Returns:

  • (String)


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

def routing_transit_number
  @routing_transit_number
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/fdx_v660_api/models/direct_deposit.rb', line 61

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  routing_transit_number =
    hash.key?('routingTransitNumber') ? hash['routingTransitNumber'] : SKIP
   = hash.key?('accountNumber') ? hash['accountNumber'] : SKIP
   = hash.key?('accountType') ? hash['accountType'] : 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.
  DirectDeposit.new(routing_transit_number: routing_transit_number,
                    account_number: ,
                    account_type: ,
                    additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



27
28
29
30
31
32
33
# File 'lib/fdx_v660_api/models/direct_deposit.rb', line 27

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['routing_transit_number'] = 'routingTransitNumber'
  @_hash['account_number'] = 'accountNumber'
  @_hash['account_type'] = 'accountType'
  @_hash
end

.nullablesObject

An array for nullable fields



45
46
47
# File 'lib/fdx_v660_api/models/direct_deposit.rb', line 45

def self.nullables
  []
end

.optionalsObject

An array for optional fields



36
37
38
39
40
41
42
# File 'lib/fdx_v660_api/models/direct_deposit.rb', line 36

def self.optionals
  %w[
    routing_transit_number
    account_number
    account_type
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} routing_transit_number: #{@routing_transit_number.inspect}, account_number:"\
  " #{@account_number.inspect}, account_type: #{@account_type.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



85
86
87
88
89
90
# File 'lib/fdx_v660_api/models/direct_deposit.rb', line 85

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} routing_transit_number: #{@routing_transit_number}, account_number:"\
  " #{@account_number}, account_type: #{@account_type}, additional_properties:"\
  " #{@additional_properties}>"
end