Class: ThePlaidApi::TransactionsRecurringUpdateResponse

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

Overview

TransactionsRecurringUpdateResponse defines the response schema for the ‘/transactions/recurring/streams/update` endpoint.

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(modified_streams:, removed_stream_ids: SKIP, additional_properties: nil) ⇒ TransactionsRecurringUpdateResponse

Returns a new instance of TransactionsRecurringUpdateResponse.



43
44
45
46
47
48
49
50
51
# File 'lib/the_plaid_api/models/transactions_recurring_update_response.rb', line 43

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

  @modified_streams = modified_streams
  @removed_stream_ids = removed_stream_ids unless removed_stream_ids == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#modified_streamsArray[TransactionStream]

Directly modified stream, along with other streams with transactions removed from them as a result of the operation (in no particular order).

Returns:



16
17
18
# File 'lib/the_plaid_api/models/transactions_recurring_update_response.rb', line 16

def modified_streams
  @modified_streams
end

#removed_stream_idsArray[String]

The ids of streams that are no longer qualified as recurring transaction streams (in no particular order).

Returns:

  • (Array[String])


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

def removed_stream_ids
  @removed_stream_ids
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/the_plaid_api/models/transactions_recurring_update_response.rb', line 54

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
  modified_streams = nil
  unless hash['modified_streams'].nil?
    modified_streams = []
    hash['modified_streams'].each do |structure|
      modified_streams << (TransactionStream.from_hash(structure) if structure)
    end
  end

  modified_streams = nil unless hash.key?('modified_streams')
  removed_stream_ids =
    hash.key?('removed_stream_ids') ? hash['removed_stream_ids'] : SKIP

  # 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.
  TransactionsRecurringUpdateResponse.new(modified_streams: modified_streams,
                                          removed_stream_ids: removed_stream_ids,
                                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



24
25
26
27
28
29
# File 'lib/the_plaid_api/models/transactions_recurring_update_response.rb', line 24

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

.nullablesObject

An array for nullable fields



39
40
41
# File 'lib/the_plaid_api/models/transactions_recurring_update_response.rb', line 39

def self.nullables
  []
end

.optionalsObject

An array for optional fields



32
33
34
35
36
# File 'lib/the_plaid_api/models/transactions_recurring_update_response.rb', line 32

def self.optionals
  %w[
    removed_stream_ids
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



92
93
94
95
96
# File 'lib/the_plaid_api/models/transactions_recurring_update_response.rb', line 92

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

#to_sObject

Provides a human-readable string representation of the object.



85
86
87
88
89
# File 'lib/the_plaid_api/models/transactions_recurring_update_response.rb', line 85

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