Class: ThePlaidApi::WalletGetResponse

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

Overview

WalletGetResponse defines the response schema for ‘/wallet/get`

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(wallet_id:, balance:, numbers:, status:, request_id:, recipient_id: SKIP, additional_properties: nil) ⇒ WalletGetResponse

Returns a new instance of WalletGetResponse.



67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/the_plaid_api/models/wallet_get_response.rb', line 67

def initialize(wallet_id:, balance:, numbers:, status:, request_id:,
               recipient_id: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @wallet_id = wallet_id
  @balance = balance
  @numbers = numbers
  @recipient_id = recipient_id unless recipient_id == SKIP
  @status = status
  @request_id = request_id
  @additional_properties = additional_properties
end

Instance Attribute Details

#balanceWalletBalance

An object representing the e-wallet balance

Returns:



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

def balance
  @balance
end

#numbersWalletNumbers

An object representing the e-wallet account numbers

Returns:



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

def numbers
  @numbers
end

#recipient_idString

The ID of the recipient that corresponds to the e-wallet account numbers

Returns:

  • (String)


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

def recipient_id
  @recipient_id
end

#request_idString

A unique identifier for the request, which can be used for troubleshooting. This identifier, like all Plaid identifiers, is case sensitive.

Returns:

  • (String)


41
42
43
# File 'lib/the_plaid_api/models/wallet_get_response.rb', line 41

def request_id
  @request_id
end

#statusWalletStatus

The status of the wallet. ‘UNKNOWN`: The wallet status is unknown. `ACTIVE`: The wallet is active and ready to send money to and receive money from. `CLOSED`: The wallet is closed. Any transactions made to or from this wallet will error.

Returns:



35
36
37
# File 'lib/the_plaid_api/models/wallet_get_response.rb', line 35

def status
  @status
end

#wallet_idString

A unique ID identifying the e-wallet

Returns:

  • (String)


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

def wallet_id
  @wallet_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
108
# File 'lib/the_plaid_api/models/wallet_get_response.rb', line 82

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  wallet_id = hash.key?('wallet_id') ? hash['wallet_id'] : nil
  balance = WalletBalance.from_hash(hash['balance']) if hash['balance']
  numbers = WalletNumbers.from_hash(hash['numbers']) if hash['numbers']
  status = hash.key?('status') ? hash['status'] : nil
  request_id = hash.key?('request_id') ? hash['request_id'] : nil
  recipient_id = hash.key?('recipient_id') ? hash['recipient_id'] : 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.
  WalletGetResponse.new(wallet_id: wallet_id,
                        balance: balance,
                        numbers: numbers,
                        status: status,
                        request_id: request_id,
                        recipient_id: recipient_id,
                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['wallet_id'] = 'wallet_id'
  @_hash['balance'] = 'balance'
  @_hash['numbers'] = 'numbers'
  @_hash['recipient_id'] = 'recipient_id'
  @_hash['status'] = 'status'
  @_hash['request_id'] = 'request_id'
  @_hash
end

.nullablesObject

An array for nullable fields



63
64
65
# File 'lib/the_plaid_api/models/wallet_get_response.rb', line 63

def self.nullables
  []
end

.optionalsObject

An array for optional fields



56
57
58
59
60
# File 'lib/the_plaid_api/models/wallet_get_response.rb', line 56

def self.optionals
  %w[
    recipient_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} wallet_id: #{@wallet_id.inspect}, balance: #{@balance.inspect}, numbers:"\
  " #{@numbers.inspect}, recipient_id: #{@recipient_id.inspect}, status: #{@status.inspect},"\
  " request_id: #{@request_id.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



111
112
113
114
115
116
# File 'lib/the_plaid_api/models/wallet_get_response.rb', line 111

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} wallet_id: #{@wallet_id}, balance: #{@balance}, numbers: #{@numbers},"\
  " recipient_id: #{@recipient_id}, status: #{@status}, request_id: #{@request_id},"\
  " additional_properties: #{@additional_properties}>"
end