Class: Plaid::DistributionDetails

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/plaid/models/distribution_details.rb

Overview

An object representing information about a distribution from the paycheck (for example, the amount distributed to a specific checking account, or to a retirement plan).

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(account_number: SKIP, bank_account_type: SKIP, bank_name: SKIP, current_pay: SKIP, description: SKIP, additional_properties: nil) ⇒ DistributionDetails

Returns a new instance of DistributionDetails.



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

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

  @account_number =  unless  == SKIP
  @bank_account_type =  unless  == SKIP
  @bank_name = bank_name unless bank_name == SKIP
  @current_pay = current_pay unless current_pay == SKIP
  @description = description unless description == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_numberString

The account number of the account being deposited to.

Returns:

  • (String)


16
17
18
# File 'lib/plaid/models/distribution_details.rb', line 16

def 
  @account_number
end

#bank_account_typeString

The type of bank account (e.g. Checking or Savings)

Returns:

  • (String)


20
21
22
# File 'lib/plaid/models/distribution_details.rb', line 20

def 
  @bank_account_type
end

#bank_nameString

The name of the bank that the payment is being deposited to.

Returns:

  • (String)


24
25
26
# File 'lib/plaid/models/distribution_details.rb', line 24

def bank_name
  @bank_name
end

#current_payPay

An object representing a monetary amount.

Returns:



28
29
30
# File 'lib/plaid/models/distribution_details.rb', line 28

def current_pay
  @current_pay
end

#descriptionString

A description of the distribution type.

Returns:

  • (String)


32
33
34
# File 'lib/plaid/models/distribution_details.rb', line 32

def description
  @description
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/plaid/models/distribution_details.rb', line 81

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   =
    hash.key?('account_number') ? hash['account_number'] : SKIP
   =
    hash.key?('bank_account_type') ? hash['bank_account_type'] : SKIP
  bank_name = hash.key?('bank_name') ? hash['bank_name'] : SKIP
  current_pay = Pay.from_hash(hash['current_pay']) if hash['current_pay']
  description = hash.key?('description') ? hash['description'] : 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.
  DistributionDetails.new(account_number: ,
                          bank_account_type: ,
                          bank_name: bank_name,
                          current_pay: current_pay,
                          description: description,
                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



35
36
37
38
39
40
41
42
43
# File 'lib/plaid/models/distribution_details.rb', line 35

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_number'] = 'account_number'
  @_hash['bank_account_type'] = 'bank_account_type'
  @_hash['bank_name'] = 'bank_name'
  @_hash['current_pay'] = 'current_pay'
  @_hash['description'] = 'description'
  @_hash
end

.nullablesObject

An array for nullable fields



57
58
59
60
61
62
63
64
# File 'lib/plaid/models/distribution_details.rb', line 57

def self.nullables
  %w[
    account_number
    bank_account_type
    bank_name
    description
  ]
end

.optionalsObject

An array for optional fields



46
47
48
49
50
51
52
53
54
# File 'lib/plaid/models/distribution_details.rb', line 46

def self.optionals
  %w[
    account_number
    bank_account_type
    bank_name
    current_pay
    description
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



118
119
120
121
122
123
124
# File 'lib/plaid/models/distribution_details.rb', line 118

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

#to_sObject

Provides a human-readable string representation of the object.



110
111
112
113
114
115
# File 'lib/plaid/models/distribution_details.rb', line 110

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