Class: ThePlaidApi::CreditBankStatementUploadItem

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

Overview

An object containing information about the bank statement upload 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:, bank_statements:, status:, updated_at:, additional_properties: nil) ⇒ CreditBankStatementUploadItem

Returns a new instance of CreditBankStatementUploadItem.



53
54
55
56
57
58
59
60
61
62
63
# File 'lib/the_plaid_api/models/credit_bank_statement_upload_item.rb', line 53

def initialize(item_id:, bank_statements:, status:, updated_at:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @item_id = item_id
  @bank_statements = bank_statements
  @status = status
  @updated_at = updated_at
  @additional_properties = additional_properties
end

Instance Attribute Details

#bank_statementsArray[CreditBankStatementUploadObject]

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



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

def bank_statements
  @bank_statements
end

#item_idString

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

Returns:

  • (String)


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

def item_id
  @item_id
end

#statusPayrollItemStatus

Details about the status of the payroll item.

Returns:



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

def status
  @status
end

#updated_atDateTime

Timestamp in [ISO 8601](wikipedia.org/wiki/ISO_8601) format (YYYY-MM-DDTHH:mm:ssZ) indicating the last time that the Item was updated.

Returns:

  • (DateTime)


28
29
30
# File 'lib/the_plaid_api/models/credit_bank_statement_upload_item.rb', line 28

def updated_at
  @updated_at
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



66
67
68
69
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
# File 'lib/the_plaid_api/models/credit_bank_statement_upload_item.rb', line 66

def self.from_hash(hash)
  return nil unless hash

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

  bank_statements = nil unless hash.key?('bank_statements')
  status = PayrollItemStatus.from_hash(hash['status']) if hash['status']
  updated_at = if hash.key?('updated_at')
                 (DateTimeHelper.from_rfc3339(hash['updated_at']) if hash['updated_at'])
               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.
  CreditBankStatementUploadItem.new(item_id: item_id,
                                    bank_statements: bank_statements,
                                    status: status,
                                    updated_at: updated_at,
                                    additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



31
32
33
34
35
36
37
38
# File 'lib/the_plaid_api/models/credit_bank_statement_upload_item.rb', line 31

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['item_id'] = 'item_id'
  @_hash['bank_statements'] = 'bank_statements'
  @_hash['status'] = 'status'
  @_hash['updated_at'] = 'updated_at'
  @_hash
end

.nullablesObject

An array for nullable fields



46
47
48
49
50
51
# File 'lib/the_plaid_api/models/credit_bank_statement_upload_item.rb', line 46

def self.nullables
  %w[
    status
    updated_at
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} item_id: #{@item_id.inspect}, bank_statements: #{@bank_statements.inspect},"\
  " status: #{@status.inspect}, updated_at: #{@updated_at.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_custom_updated_atObject



101
102
103
# File 'lib/the_plaid_api/models/credit_bank_statement_upload_item.rb', line 101

def to_custom_updated_at
  DateTimeHelper.to_rfc3339(updated_at)
end

#to_sObject

Provides a human-readable string representation of the object.



106
107
108
109
110
# File 'lib/the_plaid_api/models/credit_bank_statement_upload_item.rb', line 106

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} item_id: #{@item_id}, bank_statements: #{@bank_statements}, status:"\
  " #{@status}, updated_at: #{@updated_at}, additional_properties: #{@additional_properties}>"
end