Class: ModernTreasury::AccountCollectionFlow

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/modern_treasury/models/account_collection_flow.rb

Overview

AccountCollectionFlow Model.

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(counterparty_id = nil, payment_types = nil, id = SKIP, object = SKIP, live_mode = SKIP, created_at = SKIP, updated_at = SKIP, client_token = SKIP, status = SKIP, external_account_id = SKIP) ⇒ AccountCollectionFlow

Returns a new instance of AccountCollectionFlow.



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/modern_treasury/models/account_collection_flow.rb', line 96

def initialize(counterparty_id = nil, payment_types = nil, id = SKIP,
               object = SKIP, live_mode = SKIP, created_at = SKIP,
               updated_at = SKIP, client_token = SKIP, status = SKIP,
                = SKIP)
  @id = id unless id == SKIP
  @object = object unless object == SKIP
  @live_mode = live_mode unless live_mode == SKIP
  @created_at = created_at unless created_at == SKIP
  @updated_at = updated_at unless updated_at == SKIP
  @client_token = client_token unless client_token == SKIP
  @status = status unless status == SKIP
  @counterparty_id = counterparty_id
  @external_account_id =  unless  == SKIP
  @payment_types = payment_types
end

Instance Attribute Details

#client_tokenString

The client token of the account collection flow. This token can be used to embed account collection in your client-side application.

Returns:

  • (String)


39
40
41
# File 'lib/modern_treasury/models/account_collection_flow.rb', line 39

def client_token
  @client_token
end

#counterparty_idUUID | String

The ID of a counterparty. An external account created with this flow will be associated with this counterparty.

Returns:

  • (UUID | String)


49
50
51
# File 'lib/modern_treasury/models/account_collection_flow.rb', line 49

def counterparty_id
  @counterparty_id
end

#created_atDateTime

This field will be true if this object exists in the live environment or false if it exists in the test environment.

Returns:

  • (DateTime)


29
30
31
# File 'lib/modern_treasury/models/account_collection_flow.rb', line 29

def created_at
  @created_at
end

#external_account_idUUID | String

If present, the ID of the external account created using this flow.

Returns:

  • (UUID | String)


53
54
55
# File 'lib/modern_treasury/models/account_collection_flow.rb', line 53

def 
  @external_account_id
end

#idUUID | String

TODO: Write general description for this method

Returns:

  • (UUID | String)


15
16
17
# File 'lib/modern_treasury/models/account_collection_flow.rb', line 15

def id
  @id
end

#live_modeTrueClass | FalseClass

This field will be true if this object exists in the live environment or false if it exists in the test environment.

Returns:

  • (TrueClass | FalseClass)


24
25
26
# File 'lib/modern_treasury/models/account_collection_flow.rb', line 24

def live_mode
  @live_mode
end

#objectString

TODO: Write general description for this method

Returns:

  • (String)


19
20
21
# File 'lib/modern_treasury/models/account_collection_flow.rb', line 19

def object
  @object
end

#payment_typesArray[PaymentTypeEnum]

If present, the ID of the external account created using this flow.

Returns:



57
58
59
# File 'lib/modern_treasury/models/account_collection_flow.rb', line 57

def payment_types
  @payment_types
end

#statusStatusEnum

The current status of the account collection flow. One of ‘pending`, `completed`, `expired`, or `cancelled`.

Returns:



44
45
46
# File 'lib/modern_treasury/models/account_collection_flow.rb', line 44

def status
  @status
end

#updated_atDateTime

This field will be true if this object exists in the live environment or false if it exists in the test environment.

Returns:

  • (DateTime)


34
35
36
# File 'lib/modern_treasury/models/account_collection_flow.rb', line 34

def updated_at
  @updated_at
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/modern_treasury/models/account_collection_flow.rb', line 113

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  counterparty_id =
    hash.key?('counterparty_id') ? hash['counterparty_id'] : nil
  payment_types = hash.key?('payment_types') ? hash['payment_types'] : nil
  id = hash.key?('id') ? hash['id'] : SKIP
  object = hash.key?('object') ? hash['object'] : SKIP
  live_mode = hash.key?('live_mode') ? hash['live_mode'] : SKIP
  created_at = if hash.key?('created_at')
                 (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at'])
               else
                 SKIP
               end
  updated_at = if hash.key?('updated_at')
                 (DateTimeHelper.from_rfc3339(hash['updated_at']) if hash['updated_at'])
               else
                 SKIP
               end
  client_token = hash.key?('client_token') ? hash['client_token'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
   =
    hash.key?('external_account_id') ? hash['external_account_id'] : SKIP

  # Create object from extracted values.
  AccountCollectionFlow.new(counterparty_id,
                            payment_types,
                            id,
                            object,
                            live_mode,
                            created_at,
                            updated_at,
                            client_token,
                            status,
                            )
end

.namesObject

A mapping from model property names to API property names.



60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/modern_treasury/models/account_collection_flow.rb', line 60

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['object'] = 'object'
  @_hash['live_mode'] = 'live_mode'
  @_hash['created_at'] = 'created_at'
  @_hash['updated_at'] = 'updated_at'
  @_hash['client_token'] = 'client_token'
  @_hash['status'] = 'status'
  @_hash['counterparty_id'] = 'counterparty_id'
  @_hash['external_account_id'] = 'external_account_id'
  @_hash['payment_types'] = 'payment_types'
  @_hash
end

.nullablesObject

An array for nullable fields



90
91
92
93
94
# File 'lib/modern_treasury/models/account_collection_flow.rb', line 90

def self.nullables
  %w[
    external_account_id
  ]
end

.optionalsObject

An array for optional fields



76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/modern_treasury/models/account_collection_flow.rb', line 76

def self.optionals
  %w[
    id
    object
    live_mode
    created_at
    updated_at
    client_token
    status
    external_account_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



169
170
171
172
173
174
175
176
# File 'lib/modern_treasury/models/account_collection_flow.rb', line 169

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id.inspect}, object: #{@object.inspect}, live_mode:"\
  " #{@live_mode.inspect}, created_at: #{@created_at.inspect}, updated_at:"\
  " #{@updated_at.inspect}, client_token: #{@client_token.inspect}, status:"\
  " #{@status.inspect}, counterparty_id: #{@counterparty_id.inspect}, external_account_id:"\
  " #{@external_account_id.inspect}, payment_types: #{@payment_types.inspect}>"
end

#to_custom_created_atObject



151
152
153
# File 'lib/modern_treasury/models/account_collection_flow.rb', line 151

def to_custom_created_at
  DateTimeHelper.to_rfc3339(created_at)
end

#to_custom_updated_atObject



155
156
157
# File 'lib/modern_treasury/models/account_collection_flow.rb', line 155

def to_custom_updated_at
  DateTimeHelper.to_rfc3339(updated_at)
end

#to_sObject

Provides a human-readable string representation of the object.



160
161
162
163
164
165
166
# File 'lib/modern_treasury/models/account_collection_flow.rb', line 160

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id}, object: #{@object}, live_mode: #{@live_mode}, created_at:"\
  " #{@created_at}, updated_at: #{@updated_at}, client_token: #{@client_token}, status:"\
  " #{@status}, counterparty_id: #{@counterparty_id}, external_account_id:"\
  " #{@external_account_id}, payment_types: #{@payment_types}>"
end