Class: ThePlaidApi::CraEmploymentRefreshReportItem

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

Overview

A representation of an Item within an Employment Refresh Report.

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(accounts:, institution_name:, institution_id:, item_id:, last_update_time:, additional_properties: nil) ⇒ CraEmploymentRefreshReportItem

Returns a new instance of CraEmploymentRefreshReportItem.



56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/the_plaid_api/models/cra_employment_refresh_report_item.rb', line 56

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

  @accounts = accounts
  @institution_name = institution_name
  @institution_id = institution_id
  @item_id = item_id
  @last_update_time = last_update_time
  @additional_properties = additional_properties
end

Instance Attribute Details

#accountsArray[CraEmploymentRefreshReportAccount]

Data about each of the accounts open on the Item.



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

def accounts
  @accounts
end

#institution_idString

The id of the financial institution associated with the Item.

Returns:

  • (String)


23
24
25
# File 'lib/the_plaid_api/models/cra_employment_refresh_report_item.rb', line 23

def institution_id
  @institution_id
end

#institution_nameString

The full financial institution name associated with the Item.

Returns:

  • (String)


19
20
21
# File 'lib/the_plaid_api/models/cra_employment_refresh_report_item.rb', line 19

def institution_name
  @institution_name
end

#item_idString

The ‘item_id` of the Item associated with this webhook, warning, or error

Returns:

  • (String)


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

def item_id
  @item_id
end

#last_update_timeDateTime

The date and time when this Item’s data was last retrieved from the financial institution, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format.

Returns:

  • (DateTime)


33
34
35
# File 'lib/the_plaid_api/models/cra_employment_refresh_report_item.rb', line 33

def last_update_time
  @last_update_time
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



70
71
72
73
74
75
76
77
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
# File 'lib/the_plaid_api/models/cra_employment_refresh_report_item.rb', line 70

def self.from_hash(hash)
  return nil unless hash

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

  accounts = nil unless hash.key?('accounts')
  institution_name =
    hash.key?('institution_name') ? hash['institution_name'] : nil
  institution_id =
    hash.key?('institution_id') ? hash['institution_id'] : nil
  item_id = hash.key?('item_id') ? hash['item_id'] : nil
  last_update_time = if hash.key?('last_update_time')
                       (DateTimeHelper.from_rfc3339(hash['last_update_time']) if hash['last_update_time'])
                     end

  # 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.
  CraEmploymentRefreshReportItem.new(accounts: accounts,
                                     institution_name: institution_name,
                                     institution_id: institution_id,
                                     item_id: item_id,
                                     last_update_time: last_update_time,
                                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



36
37
38
39
40
41
42
43
44
# File 'lib/the_plaid_api/models/cra_employment_refresh_report_item.rb', line 36

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['accounts'] = 'accounts'
  @_hash['institution_name'] = 'institution_name'
  @_hash['institution_id'] = 'institution_id'
  @_hash['item_id'] = 'item_id'
  @_hash['last_update_time'] = 'last_update_time'
  @_hash
end

.nullablesObject

An array for nullable fields



52
53
54
# File 'lib/the_plaid_api/models/cra_employment_refresh_report_item.rb', line 52

def self.nullables
  []
end

.optionalsObject

An array for optional fields



47
48
49
# File 'lib/the_plaid_api/models/cra_employment_refresh_report_item.rb', line 47

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



122
123
124
125
126
127
128
# File 'lib/the_plaid_api/models/cra_employment_refresh_report_item.rb', line 122

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

#to_custom_last_update_timeObject



109
110
111
# File 'lib/the_plaid_api/models/cra_employment_refresh_report_item.rb', line 109

def to_custom_last_update_time
  DateTimeHelper.to_rfc3339(last_update_time)
end

#to_sObject

Provides a human-readable string representation of the object.



114
115
116
117
118
119
# File 'lib/the_plaid_api/models/cra_employment_refresh_report_item.rb', line 114

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