Class: ModernTreasury::CounterpartyCollectAccountRequest

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

Overview

CounterpartyCollectAccountRequest 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(direction:, send_email: SKIP, fields: SKIP, custom_redirect: SKIP, additional_properties: nil) ⇒ CounterpartyCollectAccountRequest

Returns a new instance of CounterpartyCollectAccountRequest.



64
65
66
67
68
69
70
71
72
73
74
# File 'lib/modern_treasury/models/counterparty_collect_account_request.rb', line 64

def initialize(direction:, send_email: SKIP, fields: SKIP,
               custom_redirect: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @direction = direction
  @send_email = send_email unless send_email == SKIP
  @fields = fields unless fields == SKIP
  @custom_redirect = custom_redirect unless custom_redirect == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#custom_redirectString

The URL you want your customer to visit upon filling out the form. By default, they will be sent to a Modern Treasury landing page. This must be a valid HTTPS URL if set.

Returns:

  • (String)


38
39
40
# File 'lib/modern_treasury/models/counterparty_collect_account_request.rb', line 38

def custom_redirect
  @custom_redirect
end

#directionDirection

One of ‘credit` or `debit`. Use `credit` when you want to pay a counterparty. Use `debit` when you need to charge a counterparty. This field helps us send a more tailored email to your counterparties.“

Returns:



16
17
18
# File 'lib/modern_treasury/models/counterparty_collect_account_request.rb', line 16

def direction
  @direction
end

#fieldsArray[Field]

The list of fields you want on the form. This field is optional and if it is not set, will default to ["nameOnAccount", "accountType", "accountNumber", "routingNumber", "address"]. The full list of options is ["name", "nameOnAccount", "taxpayerIdentifier", "accountType", "accountNumber", "routingNumber", "address", "ibanNumber", "swiftCode"].

Returns:



32
33
34
# File 'lib/modern_treasury/models/counterparty_collect_account_request.rb', line 32

def fields
  @fields
end

#send_emailTrueClass | FalseClass

By default, Modern Treasury will send an email to your counterparty that includes a link to the form they must fill out. However, if you would like to send the counterparty the link, you can set this parameter to ‘false`. The JSON body will include the link to the secure Modern Treasury form.

Returns:

  • (TrueClass | FalseClass)


23
24
25
# File 'lib/modern_treasury/models/counterparty_collect_account_request.rb', line 23

def send_email
  @send_email
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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/modern_treasury/models/counterparty_collect_account_request.rb', line 77

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  direction = hash.key?('direction') ? hash['direction'] : nil
  send_email = hash.key?('send_email') ? hash['send_email'] : SKIP
  fields = hash.key?('fields') ? hash['fields'] : SKIP
  custom_redirect =
    hash.key?('custom_redirect') ? hash['custom_redirect'] : 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.
  CounterpartyCollectAccountRequest.new(direction: direction,
                                        send_email: send_email,
                                        fields: fields,
                                        custom_redirect: custom_redirect,
                                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



41
42
43
44
45
46
47
48
# File 'lib/modern_treasury/models/counterparty_collect_account_request.rb', line 41

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['direction'] = 'direction'
  @_hash['send_email'] = 'send_email'
  @_hash['fields'] = 'fields'
  @_hash['custom_redirect'] = 'custom_redirect'
  @_hash
end

.nullablesObject

An array for nullable fields



60
61
62
# File 'lib/modern_treasury/models/counterparty_collect_account_request.rb', line 60

def self.nullables
  []
end

.optionalsObject

An array for optional fields



51
52
53
54
55
56
57
# File 'lib/modern_treasury/models/counterparty_collect_account_request.rb', line 51

def self.optionals
  %w[
    send_email
    fields
    custom_redirect
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



110
111
112
113
114
115
# File 'lib/modern_treasury/models/counterparty_collect_account_request.rb', line 110

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

#to_sObject

Provides a human-readable string representation of the object.



103
104
105
106
107
# File 'lib/modern_treasury/models/counterparty_collect_account_request.rb', line 103

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