Class: ThePlaidApi::TransactionsRecurringCreateResponse

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

Overview

TransactionsRecurringCreateResponse defines the response schema for the ‘/transactions/recurring/streams/create` 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(added_streams:, modified_streams: SKIP, removed_stream_ids: SKIP, additional_properties: nil) ⇒ TransactionsRecurringCreateResponse

Returns a new instance of TransactionsRecurringCreateResponse.



49
50
51
52
53
54
55
56
57
58
# File 'lib/the_plaid_api/models/transactions_recurring_create_response.rb', line 49

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

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

Instance Attribute Details

#added_streamsArray[TransactionStream]

Streams created as a result of the operation.

Returns:



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

def added_streams
  @added_streams
end

#modified_streamsArray[TransactionStream]

Other streams with transactions removed from them as a result of the operation (in no particular order).

Returns:



20
21
22
# File 'lib/the_plaid_api/models/transactions_recurring_create_response.rb', line 20

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])


25
26
27
# File 'lib/the_plaid_api/models/transactions_recurring_create_response.rb', line 25

def removed_stream_ids
  @removed_stream_ids
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



61
62
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
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/the_plaid_api/models/transactions_recurring_create_response.rb', line 61

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

  added_streams = nil unless hash.key?('added_streams')
  # 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 = SKIP 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.
  TransactionsRecurringCreateResponse.new(added_streams: added_streams,
                                          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.



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

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

.nullablesObject

An array for nullable fields



45
46
47
# File 'lib/the_plaid_api/models/transactions_recurring_create_response.rb', line 45

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    modified_streams
    removed_stream_ids
  ]
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/transactions_recurring_create_response.rb', line 111

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} added_streams: #{@added_streams.inspect}, 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.



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

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