Class: ThePlaidApi::DistributionBreakdown

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/the_plaid_api/models/distribution_breakdown.rb

Overview

Information about the accounts that the payment was distributed to.

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_name: SKIP, bank_name: SKIP, current_amount: SKIP, currency: SKIP, mask: SKIP, type: SKIP, additional_properties: nil) ⇒ DistributionBreakdown

Returns a new instance of DistributionBreakdown.



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

def initialize(account_name: SKIP, bank_name: SKIP, current_amount: SKIP,
               currency: SKIP, mask: SKIP, type: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @account_name =  unless  == SKIP
  @bank_name = bank_name unless bank_name == SKIP
  @current_amount = current_amount unless current_amount == SKIP
  @currency = currency unless currency == SKIP
  @mask = mask unless mask == SKIP
  @type = type unless type == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_nameString

Name of the account for the given distribution.

Returns:

  • (String)


14
15
16
# File 'lib/the_plaid_api/models/distribution_breakdown.rb', line 14

def 
  @account_name
end

#bank_nameString

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

Returns:

  • (String)


18
19
20
# File 'lib/the_plaid_api/models/distribution_breakdown.rb', line 18

def bank_name
  @bank_name
end

#currencyString

The ISO-4217 currency code of the net pay. Always ‘null` if `unofficial_currency_code` is non-null.

Returns:

  • (String)


27
28
29
# File 'lib/the_plaid_api/models/distribution_breakdown.rb', line 27

def currency
  @currency
end

#current_amountFloat

The amount distributed to this account.

Returns:

  • (Float)


22
23
24
# File 'lib/the_plaid_api/models/distribution_breakdown.rb', line 22

def current_amount
  @current_amount
end

#maskString

The last 2-4 alphanumeric characters of an account’s official account number.

Returns:

  • (String)


32
33
34
# File 'lib/the_plaid_api/models/distribution_breakdown.rb', line 32

def mask
  @mask
end

#typeString

Type of the account that the paystub was sent to (e.g. ‘checking’).

Returns:

  • (String)


36
37
38
# File 'lib/the_plaid_api/models/distribution_breakdown.rb', line 36

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



90
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
# File 'lib/the_plaid_api/models/distribution_breakdown.rb', line 90

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('account_name') ? hash['account_name'] : SKIP
  bank_name = hash.key?('bank_name') ? hash['bank_name'] : SKIP
  current_amount =
    hash.key?('current_amount') ? hash['current_amount'] : SKIP
  currency = hash.key?('currency') ? hash['currency'] : SKIP
  mask = hash.key?('mask') ? hash['mask'] : SKIP
  type = hash.key?('type') ? hash['type'] : 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.
  DistributionBreakdown.new(account_name: ,
                            bank_name: bank_name,
                            current_amount: current_amount,
                            currency: currency,
                            mask: mask,
                            type: type,
                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



39
40
41
42
43
44
45
46
47
48
# File 'lib/the_plaid_api/models/distribution_breakdown.rb', line 39

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_name'] = 'account_name'
  @_hash['bank_name'] = 'bank_name'
  @_hash['current_amount'] = 'current_amount'
  @_hash['currency'] = 'currency'
  @_hash['mask'] = 'mask'
  @_hash['type'] = 'type'
  @_hash
end

.nullablesObject

An array for nullable fields



63
64
65
66
67
68
69
70
71
72
# File 'lib/the_plaid_api/models/distribution_breakdown.rb', line 63

def self.nullables
  %w[
    account_name
    bank_name
    current_amount
    currency
    mask
    type
  ]
end

.optionalsObject

An array for optional fields



51
52
53
54
55
56
57
58
59
60
# File 'lib/the_plaid_api/models/distribution_breakdown.rb', line 51

def self.optionals
  %w[
    account_name
    bank_name
    current_amount
    currency
    mask
    type
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



128
129
130
131
132
133
134
# File 'lib/the_plaid_api/models/distribution_breakdown.rb', line 128

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} account_name: #{@account_name.inspect}, bank_name: #{@bank_name.inspect},"\
  " current_amount: #{@current_amount.inspect}, currency: #{@currency.inspect}, mask:"\
  " #{@mask.inspect}, type: #{@type.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



120
121
122
123
124
125
# File 'lib/the_plaid_api/models/distribution_breakdown.rb', line 120

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} account_name: #{@account_name}, bank_name: #{@bank_name}, current_amount:"\
  " #{@current_amount}, currency: #{@currency}, mask: #{@mask}, type: #{@type},"\
  " additional_properties: #{@additional_properties}>"
end