Class: Plaid::InvestmentsTransactionsGetResponse

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

Overview

InvestmentsTransactionsGetResponse defines the response schema for ‘/investments/transactions/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(item:, accounts:, securities:, investment_transactions:, total_investment_transactions:, request_id:, additional_properties: nil) ⇒ InvestmentsTransactionsGetResponse

Returns a new instance of InvestmentsTransactionsGetResponse.



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

def initialize(item:, accounts:, securities:, investment_transactions:,
               total_investment_transactions:, request_id:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @item = item
  @accounts = accounts
  @securities = securities
  @investment_transactions = investment_transactions
  @total_investment_transactions = total_investment_transactions
  @request_id = request_id
  @additional_properties = additional_properties
end

Instance Attribute Details

#accountsArray[Account]

The accounts for which transaction history is being fetched.

Returns:



19
20
21
# File 'lib/plaid/models/investments_transactions_get_response.rb', line 19

def accounts
  @accounts
end

#investment_transactionsArray[InvestmentTransaction]

The transactions being fetched

Returns:



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

def investment_transactions
  @investment_transactions
end

#itemItem

Metadata about the Item.

Returns:



15
16
17
# File 'lib/plaid/models/investments_transactions_get_response.rb', line 15

def item
  @item
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/plaid/models/investments_transactions_get_response.rb', line 41

def request_id
  @request_id
end

#securitiesArray[Security]

All securities for which there is a corresponding transaction being fetched.

Returns:



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

def securities
  @securities
end

#total_investment_transactionsInteger

The total number of transactions available within the date range specified. If ‘total_investment_transactions` is larger than the size of the `transactions` array, more transactions are available and can be fetched via manipulating the `offset` parameter.’

Returns:

  • (Integer)


35
36
37
# File 'lib/plaid/models/investments_transactions_get_response.rb', line 35

def total_investment_transactions
  @total_investment_transactions
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/plaid/models/investments_transactions_get_response.rb', line 82

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  item = Item.from_hash(hash['item']) if hash['item']
  # Parameter is an array, so we need to iterate through it
  accounts = nil
  unless hash['accounts'].nil?
    accounts = []
    hash['accounts'].each do |structure|
      accounts << (Account.from_hash(structure) if structure)
    end
  end

  accounts = nil unless hash.key?('accounts')
  # Parameter is an array, so we need to iterate through it
  securities = nil
  unless hash['securities'].nil?
    securities = []
    hash['securities'].each do |structure|
      securities << (Security.from_hash(structure) if structure)
    end
  end

  securities = nil unless hash.key?('securities')
  # Parameter is an array, so we need to iterate through it
  investment_transactions = nil
  unless hash['investment_transactions'].nil?
    investment_transactions = []
    hash['investment_transactions'].each do |structure|
      investment_transactions << (InvestmentTransaction.from_hash(structure) if structure)
    end
  end

  investment_transactions = nil unless hash.key?('investment_transactions')
  total_investment_transactions =
    hash.key?('total_investment_transactions') ? hash['total_investment_transactions'] : nil
  request_id = hash.key?('request_id') ? hash['request_id'] : nil

  # 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.
  InvestmentsTransactionsGetResponse.new(item: item,
                                         accounts: accounts,
                                         securities: securities,
                                         investment_transactions: investment_transactions,
                                         total_investment_transactions: total_investment_transactions,
                                         request_id: request_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
54
# File 'lib/plaid/models/investments_transactions_get_response.rb', line 44

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['item'] = 'item'
  @_hash['accounts'] = 'accounts'
  @_hash['securities'] = 'securities'
  @_hash['investment_transactions'] = 'investment_transactions'
  @_hash['total_investment_transactions'] =
    'total_investment_transactions'
  @_hash['request_id'] = 'request_id'
  @_hash
end

.nullablesObject

An array for nullable fields



62
63
64
# File 'lib/plaid/models/investments_transactions_get_response.rb', line 62

def self.nullables
  []
end

.optionalsObject

An array for optional fields



57
58
59
# File 'lib/plaid/models/investments_transactions_get_response.rb', line 57

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



148
149
150
151
152
153
154
# File 'lib/plaid/models/investments_transactions_get_response.rb', line 148

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} item: #{@item.inspect}, accounts: #{@accounts.inspect}, securities:"\
  " #{@securities.inspect}, investment_transactions: #{@investment_transactions.inspect},"\
  " total_investment_transactions: #{@total_investment_transactions.inspect}, request_id:"\
  " #{@request_id.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



139
140
141
142
143
144
145
# File 'lib/plaid/models/investments_transactions_get_response.rb', line 139

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} item: #{@item}, accounts: #{@accounts}, securities: #{@securities},"\
  " investment_transactions: #{@investment_transactions}, total_investment_transactions:"\
  " #{@total_investment_transactions}, request_id: #{@request_id}, additional_properties:"\
  " #{@additional_properties}>"
end