Class: ThePlaidApi::CreditBankEmploymentItem

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

Overview

The details and metadata for an end user’s Item.

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_id:, last_updated_time:, institution_id:, institution_name:, bank_employments:, bank_employment_accounts:, additional_properties: nil) ⇒ CreditBankEmploymentItem

Returns a new instance of CreditBankEmploymentItem.



62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/the_plaid_api/models/credit_bank_employment_item.rb', line 62

def initialize(item_id:, last_updated_time:, institution_id:,
               institution_name:, bank_employments:,
               bank_employment_accounts:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @item_id = item_id
  @last_updated_time = last_updated_time
  @institution_id = institution_id
  @institution_name = institution_name
  @bank_employments = bank_employments
  @bank_employment_accounts = bank_employment_accounts
  @additional_properties = additional_properties
end

Instance Attribute Details

#bank_employment_accountsArray[CreditBankIncomeAccount]

The Item’s accounts that have Bank Employment data.

Returns:



38
39
40
# File 'lib/the_plaid_api/models/credit_bank_employment_item.rb', line 38

def bank_employment_accounts
  @bank_employment_accounts
end

#bank_employmentsArray[CreditBankEmployment]

The bank employment information for this Item. Each entry in the array is a different employer found.

Returns:



34
35
36
# File 'lib/the_plaid_api/models/credit_bank_employment_item.rb', line 34

def bank_employments
  @bank_employments
end

#institution_idString

The unique identifier of the institution associated with the Item.

Returns:

  • (String)


25
26
27
# File 'lib/the_plaid_api/models/credit_bank_employment_item.rb', line 25

def institution_id
  @institution_id
end

#institution_nameString

The name of the institution associated with the Item.

Returns:

  • (String)


29
30
31
# File 'lib/the_plaid_api/models/credit_bank_employment_item.rb', line 29

def institution_name
  @institution_name
end

#item_idString

The unique identifier for the Item.

Returns:

  • (String)


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

def item_id
  @item_id
end

#last_updated_timeDateTime

The time when this Item’s data was last retrieved from the financial institution, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format (e.g. “2018-04-12T03:32:11Z”).

Returns:

  • (DateTime)


21
22
23
# File 'lib/the_plaid_api/models/credit_bank_employment_item.rb', line 21

def last_updated_time
  @last_updated_time
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



78
79
80
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/the_plaid_api/models/credit_bank_employment_item.rb', line 78

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  item_id = hash.key?('item_id') ? hash['item_id'] : nil
  last_updated_time = if hash.key?('last_updated_time')
                        (DateTimeHelper.from_rfc3339(hash['last_updated_time']) if hash['last_updated_time'])
                      end
  institution_id =
    hash.key?('institution_id') ? hash['institution_id'] : nil
  institution_name =
    hash.key?('institution_name') ? hash['institution_name'] : nil
  # Parameter is an array, so we need to iterate through it
  bank_employments = nil
  unless hash['bank_employments'].nil?
    bank_employments = []
    hash['bank_employments'].each do |structure|
      bank_employments << (CreditBankEmployment.from_hash(structure) if structure)
    end
  end

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

  bank_employment_accounts = nil unless hash.key?('bank_employment_accounts')

  # 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.
  CreditBankEmploymentItem.new(item_id: item_id,
                               last_updated_time: last_updated_time,
                               institution_id: institution_id,
                               institution_name: institution_name,
                               bank_employments: bank_employments,
                               bank_employment_accounts: bank_employment_accounts,
                               additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



41
42
43
44
45
46
47
48
49
50
# File 'lib/the_plaid_api/models/credit_bank_employment_item.rb', line 41

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['item_id'] = 'item_id'
  @_hash['last_updated_time'] = 'last_updated_time'
  @_hash['institution_id'] = 'institution_id'
  @_hash['institution_name'] = 'institution_name'
  @_hash['bank_employments'] = 'bank_employments'
  @_hash['bank_employment_accounts'] = 'bank_employment_accounts'
  @_hash
end

.nullablesObject

An array for nullable fields



58
59
60
# File 'lib/the_plaid_api/models/credit_bank_employment_item.rb', line 58

def self.nullables
  []
end

.optionalsObject

An array for optional fields



53
54
55
# File 'lib/the_plaid_api/models/credit_bank_employment_item.rb', line 53

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



142
143
144
145
146
147
148
149
# File 'lib/the_plaid_api/models/credit_bank_employment_item.rb', line 142

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} item_id: #{@item_id.inspect}, last_updated_time:"\
  " #{@last_updated_time.inspect}, institution_id: #{@institution_id.inspect},"\
  " institution_name: #{@institution_name.inspect}, bank_employments:"\
  " #{@bank_employments.inspect}, bank_employment_accounts:"\
  " #{@bank_employment_accounts.inspect}, additional_properties: #{@additional_properties}>"
end

#to_custom_last_updated_timeObject



128
129
130
# File 'lib/the_plaid_api/models/credit_bank_employment_item.rb', line 128

def to_custom_last_updated_time
  DateTimeHelper.to_rfc3339(last_updated_time)
end

#to_sObject

Provides a human-readable string representation of the object.



133
134
135
136
137
138
139
# File 'lib/the_plaid_api/models/credit_bank_employment_item.rb', line 133

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} item_id: #{@item_id}, last_updated_time: #{@last_updated_time},"\
  " institution_id: #{@institution_id}, institution_name: #{@institution_name},"\
  " bank_employments: #{@bank_employments}, bank_employment_accounts:"\
  " #{@bank_employment_accounts}, additional_properties: #{@additional_properties}>"
end