Class: ThePlaidApi::ItemStatusTransactions

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

Overview

Information about the last successful and failed transactions update for the 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(last_successful_update: SKIP, last_failed_update: SKIP, additional_properties: nil) ⇒ ItemStatusTransactions

Returns a new instance of ItemStatusTransactions.



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

def initialize(last_successful_update: SKIP, last_failed_update: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @last_successful_update = last_successful_update unless last_successful_update == SKIP
  @last_failed_update = last_failed_update unless last_failed_update == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#last_failed_updateDateTime

[ISO 8601](wikipedia.org/wiki/ISO_8601) timestamp of the last failed transactions update for the Item. The status will update each time Plaid fails an attempt to connect with the institution, regardless of whether any new data is available in the update. This field does not reflect transactions updates performed by non-Transactions products (e.g. Signal).

Returns:

  • (DateTime)


30
31
32
# File 'lib/the_plaid_api/models/item_status_transactions.rb', line 30

def last_failed_update
  @last_failed_update
end

#last_successful_updateDateTime

[ISO 8601](wikipedia.org/wiki/ISO_8601) timestamp of the last successful transactions update for the Item. The status will update each time Plaid successfully connects with the institution, regardless of whether any new data is available in the update. This field does not reflect transactions updates performed by non-Transactions products (e.g. Signal).

Returns:

  • (DateTime)


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

def last_successful_update
  @last_successful_update
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  last_successful_update = if hash.key?('last_successful_update')
                             (DateTimeHelper.from_rfc3339(hash['last_successful_update']) if hash['last_successful_update'])
                           else
                             SKIP
                           end
  last_failed_update = if hash.key?('last_failed_update')
                         (DateTimeHelper.from_rfc3339(hash['last_failed_update']) if hash['last_failed_update'])
                       else
                         SKIP
                       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.
  ItemStatusTransactions.new(last_successful_update: last_successful_update,
                             last_failed_update: last_failed_update,
                             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['last_successful_update'] = 'last_successful_update'
  @_hash['last_failed_update'] = 'last_failed_update'
  @_hash
end

.nullablesObject

An array for nullable fields



49
50
51
52
53
54
# File 'lib/the_plaid_api/models/item_status_transactions.rb', line 49

def self.nullables
  %w[
    last_successful_update
    last_failed_update
  ]
end

.optionalsObject

An array for optional fields



41
42
43
44
45
46
# File 'lib/the_plaid_api/models/item_status_transactions.rb', line 41

def self.optionals
  %w[
    last_successful_update
    last_failed_update
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

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

#to_custom_last_failed_updateObject



99
100
101
# File 'lib/the_plaid_api/models/item_status_transactions.rb', line 99

def to_custom_last_failed_update
  DateTimeHelper.to_rfc3339(last_failed_update)
end

#to_custom_last_successful_updateObject



95
96
97
# File 'lib/the_plaid_api/models/item_status_transactions.rb', line 95

def to_custom_last_successful_update
  DateTimeHelper.to_rfc3339(last_successful_update)
end

#to_sObject

Provides a human-readable string representation of the object.



104
105
106
107
108
# File 'lib/the_plaid_api/models/item_status_transactions.rb', line 104

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