Class: ModernTreasury::IncomingPaymentDetailCreateRequest

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

Overview

IncomingPaymentDetailCreateRequest 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(type: SKIP, direction: SKIP, amount: SKIP, currency: SKIP, internal_account_id: SKIP, virtual_account_id: SKIP, as_of_date: SKIP, description: SKIP, additional_properties: nil) ⇒ IncomingPaymentDetailCreateRequest

Returns a new instance of IncomingPaymentDetailCreateRequest.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/modern_treasury/models/incoming_payment_detail_create_request.rb', line 83

def initialize(type: SKIP, direction: SKIP, amount: SKIP, currency: SKIP,
               internal_account_id: SKIP, virtual_account_id: SKIP,
               as_of_date: SKIP, description: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @type = type unless type == SKIP
  @direction = direction unless direction == SKIP
  @amount = amount unless amount == SKIP
  @currency = currency unless currency == SKIP
  @internal_account_id =  unless  == SKIP
  @virtual_account_id =  unless  == SKIP
  @as_of_date = as_of_date unless as_of_date == SKIP
  @description = description unless description == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#amountInteger

Value in specified currency’s smallest unit. e.g. $10 would be represented as 1000.

Returns:

  • (Integer)


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

def amount
  @amount
end

#as_of_dateDate

Defaults to today.

Returns:

  • (Date)


40
41
42
# File 'lib/modern_treasury/models/incoming_payment_detail_create_request.rb', line 40

def as_of_date
  @as_of_date
end

#currencyCurrency

Three-letter ISO currency code.

Returns:



27
28
29
# File 'lib/modern_treasury/models/incoming_payment_detail_create_request.rb', line 27

def currency
  @currency
end

#descriptionString

Defaults to a random description.

Returns:

  • (String)


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

def description
  @description
end

#directionDirection14

One of ‘credit`, `debit`.

Returns:



18
19
20
# File 'lib/modern_treasury/models/incoming_payment_detail_create_request.rb', line 18

def direction
  @direction
end

#internal_account_idUUID | String

The ID of one of your internal accounts.

Returns:

  • (UUID | String)


31
32
33
# File 'lib/modern_treasury/models/incoming_payment_detail_create_request.rb', line 31

def 
  @internal_account_id
end

#typeType10

One of ‘ach`, `wire`, `check`.

Returns:



14
15
16
# File 'lib/modern_treasury/models/incoming_payment_detail_create_request.rb', line 14

def type
  @type
end

#virtual_account_idUUID | String

An optional parameter to associate the incoming payment detail to a virtual account.

Returns:

  • (UUID | String)


36
37
38
# File 'lib/modern_treasury/models/incoming_payment_detail_create_request.rb', line 36

def 
  @virtual_account_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/modern_treasury/models/incoming_payment_detail_create_request.rb', line 102

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  type = hash.key?('type') ? hash['type'] : SKIP
  direction = hash.key?('direction') ? hash['direction'] : SKIP
  amount = hash.key?('amount') ? hash['amount'] : SKIP
  currency = hash.key?('currency') ? hash['currency'] : SKIP
   =
    hash.key?('internal_account_id') ? hash['internal_account_id'] : SKIP
   =
    hash.key?('virtual_account_id') ? hash['virtual_account_id'] : SKIP
  as_of_date = hash.key?('as_of_date') ? hash['as_of_date'] : SKIP
  description = hash.key?('description') ? hash['description'] : 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.
  IncomingPaymentDetailCreateRequest.new(type: type,
                                         direction: direction,
                                         amount: amount,
                                         currency: currency,
                                         internal_account_id: ,
                                         virtual_account_id: ,
                                         as_of_date: as_of_date,
                                         description: description,
                                         additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/modern_treasury/models/incoming_payment_detail_create_request.rb', line 47

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['type'] = 'type'
  @_hash['direction'] = 'direction'
  @_hash['amount'] = 'amount'
  @_hash['currency'] = 'currency'
  @_hash['internal_account_id'] = 'internal_account_id'
  @_hash['virtual_account_id'] = 'virtual_account_id'
  @_hash['as_of_date'] = 'as_of_date'
  @_hash['description'] = 'description'
  @_hash
end

.nullablesObject

An array for nullable fields



75
76
77
78
79
80
81
# File 'lib/modern_treasury/models/incoming_payment_detail_create_request.rb', line 75

def self.nullables
  %w[
    virtual_account_id
    as_of_date
    description
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    type
    direction
    amount
    currency
    internal_account_id
    virtual_account_id
    as_of_date
    description
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



146
147
148
149
150
151
152
153
# File 'lib/modern_treasury/models/incoming_payment_detail_create_request.rb', line 146

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} type: #{@type.inspect}, direction: #{@direction.inspect}, amount:"\
  " #{@amount.inspect}, currency: #{@currency.inspect}, internal_account_id:"\
  " #{@internal_account_id.inspect}, virtual_account_id: #{@virtual_account_id.inspect},"\
  " as_of_date: #{@as_of_date.inspect}, description: #{@description.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



137
138
139
140
141
142
143
# File 'lib/modern_treasury/models/incoming_payment_detail_create_request.rb', line 137

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} type: #{@type}, direction: #{@direction}, amount: #{@amount}, currency:"\
  " #{@currency}, internal_account_id: #{@internal_account_id}, virtual_account_id:"\
  " #{@virtual_account_id}, as_of_date: #{@as_of_date}, description: #{@description},"\
  " additional_properties: #{@additional_properties}>"
end