Class: ThePlaidApi::PaymentInitiationPaymentListResponse

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

Overview

PaymentInitiationPaymentListResponse defines the response schema for ‘/payment_initiation/payment/list`

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(payments:, next_cursor:, request_id:, additional_properties: nil) ⇒ PaymentInitiationPaymentListResponse

Returns a new instance of PaymentInitiationPaymentListResponse.



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

def initialize(payments:, next_cursor:, request_id:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @payments = payments
  @next_cursor = next_cursor
  @request_id = request_id
  @additional_properties = additional_properties
end

Instance Attribute Details

#next_cursorDateTime

The value that, when used as the optional ‘cursor` parameter to `/payment_initiation/payment/list`, will return the next unreturned payment as its first payment.

Returns:

  • (DateTime)


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

def next_cursor
  @next_cursor
end

#paymentsArray[PaymentInitiationPayment]

An array of payments that have been created, associated with the given ‘client_id`.

Returns:



17
18
19
# File 'lib/the_plaid_api/models/payment_initiation_payment_list_response.rb', line 17

def payments
  @payments
end

#request_idString

A unique identifier for the request, which can be used for troubleshooting. This identifier, like all Plaid identifiers, is case sensitive.

Returns:

  • (String)


29
30
31
# File 'lib/the_plaid_api/models/payment_initiation_payment_list_response.rb', line 29

def request_id
  @request_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

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

  payments = nil unless hash.key?('payments')
  next_cursor = if hash.key?('next_cursor')
                  (DateTimeHelper.from_rfc3339(hash['next_cursor']) if hash['next_cursor'])
                end
  request_id = hash.key?('request_id') ? hash['request_id'] : nil

  # 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.
  PaymentInitiationPaymentListResponse.new(payments: payments,
                                           next_cursor: next_cursor,
                                           request_id: request_id,
                                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['payments'] = 'payments'
  @_hash['next_cursor'] = 'next_cursor'
  @_hash['request_id'] = 'request_id'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  %w[
    next_cursor
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



109
110
111
112
113
# File 'lib/the_plaid_api/models/payment_initiation_payment_list_response.rb', line 109

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

#to_custom_next_cursorObject



97
98
99
# File 'lib/the_plaid_api/models/payment_initiation_payment_list_response.rb', line 97

def to_custom_next_cursor
  DateTimeHelper.to_rfc3339(next_cursor)
end

#to_sObject

Provides a human-readable string representation of the object.



102
103
104
105
106
# File 'lib/the_plaid_api/models/payment_initiation_payment_list_response.rb', line 102

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