Class: ThePlaidApi::ItemStatusInvestments

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

Overview

Information about the last successful and failed investments 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) ⇒ ItemStatusInvestments

Returns a new instance of ItemStatusInvestments.



52
53
54
55
56
57
58
59
60
# File 'lib/the_plaid_api/models/item_status_investments.rb', line 52

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 investments 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.

Returns:

  • (DateTime)


26
27
28
# File 'lib/the_plaid_api/models/item_status_investments.rb', line 26

def last_failed_update
  @last_failed_update
end

#last_successful_updateDateTime

[ISO 8601](wikipedia.org/wiki/ISO_8601) timestamp of the last successful investments 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.

Returns:

  • (DateTime)


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

def last_successful_update
  @last_successful_update
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/the_plaid_api/models/item_status_investments.rb', line 63

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.
  ItemStatusInvestments.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.



29
30
31
32
33
34
# File 'lib/the_plaid_api/models/item_status_investments.rb', line 29

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



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

def self.nullables
  %w[
    last_successful_update
    last_failed_update
  ]
end

.optionalsObject

An array for optional fields



37
38
39
40
41
42
# File 'lib/the_plaid_api/models/item_status_investments.rb', line 37

def self.optionals
  %w[
    last_successful_update
    last_failed_update
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



107
108
109
110
111
112
# File 'lib/the_plaid_api/models/item_status_investments.rb', line 107

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



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

def to_custom_last_failed_update
  DateTimeHelper.to_rfc3339(last_failed_update)
end

#to_custom_last_successful_updateObject



91
92
93
# File 'lib/the_plaid_api/models/item_status_investments.rb', line 91

def to_custom_last_successful_update
  DateTimeHelper.to_rfc3339(last_successful_update)
end

#to_sObject

Provides a human-readable string representation of the object.



100
101
102
103
104
# File 'lib/the_plaid_api/models/item_status_investments.rb', line 100

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