Class: ThePlaidApi::TransferBalance

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

Overview

Information about the balance held with Plaid.

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(available:, type:, current: SKIP, additional_properties: nil) ⇒ TransferBalance

Returns a new instance of TransferBalance.



49
50
51
52
53
54
55
56
57
# File 'lib/the_plaid_api/models/transfer_balance.rb', line 49

def initialize(available:, type:, current: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @available = available
  @current = current unless current == SKIP
  @type = type
  @additional_properties = additional_properties
end

Instance Attribute Details

#availableString

The amount of this balance available for use (decimal string with two digits of precision e.g. “10.00”).

Returns:

  • (String)


15
16
17
# File 'lib/the_plaid_api/models/transfer_balance.rb', line 15

def available
  @available
end

#currentString

The available balance, plus amount of pending funds that in processing (decimal string with two digits of precision e.g. “10.00”).

Returns:

  • (String)


20
21
22
# File 'lib/the_plaid_api/models/transfer_balance.rb', line 20

def current
  @current
end

#typeTransferBalanceType

The type of balance. ‘prefunded_rtp_credits` - Your prefunded RTP credit balance with Plaid `prefunded_ach_credits` - Your prefunded ACH credit balance with Plaid

Returns:



26
27
28
# File 'lib/the_plaid_api/models/transfer_balance.rb', line 26

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  available = hash.key?('available') ? hash['available'] : nil
  type = hash.key?('type') ? hash['type'] : nil
  current = hash.key?('current') ? hash['current'] : 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.
  TransferBalance.new(available: available,
                      type: type,
                      current: current,
                      additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



29
30
31
32
33
34
35
# File 'lib/the_plaid_api/models/transfer_balance.rb', line 29

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['available'] = 'available'
  @_hash['current'] = 'current'
  @_hash['type'] = 'type'
  @_hash
end

.nullablesObject

An array for nullable fields



45
46
47
# File 'lib/the_plaid_api/models/transfer_balance.rb', line 45

def self.nullables
  []
end

.optionalsObject

An array for optional fields



38
39
40
41
42
# File 'lib/the_plaid_api/models/transfer_balance.rb', line 38

def self.optionals
  %w[
    current
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



90
91
92
93
94
# File 'lib/the_plaid_api/models/transfer_balance.rb', line 90

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

#to_sObject

Provides a human-readable string representation of the object.



83
84
85
86
87
# File 'lib/the_plaid_api/models/transfer_balance.rb', line 83

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