Class: ModernTreasury::PaperItem

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

Overview

PaperItem 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(id:, object:, live_mode:, created_at:, updated_at:, transaction_line_item_id:, transaction_id:, status:, lockbox_number:, deposit_date:, amount:, currency:, account_number:, account_number_safe:, routing_number:, check_number:, remitter_name:, memo_field:) ⇒ PaperItem

Returns a new instance of PaperItem.



133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/modern_treasury/models/paper_item.rb', line 133

def initialize(id:, object:, live_mode:, created_at:, updated_at:,
               transaction_line_item_id:, transaction_id:, status:,
               lockbox_number:, deposit_date:, amount:, currency:,
               account_number:, account_number_safe:, routing_number:,
               check_number:, remitter_name:, memo_field:)
  @id = id
  @object = object
  @live_mode = live_mode
  @created_at = created_at
  @updated_at = updated_at
  @transaction_line_item_id = transaction_line_item_id
  @transaction_id = transaction_id
  @status = status
  @lockbox_number = lockbox_number
  @deposit_date = deposit_date
  @amount = amount
  @currency = currency
  @account_number = 
  @account_number_safe = 
  @routing_number = routing_number
  @check_number = check_number
  @remitter_name = remitter_name
  @memo_field = memo_field
end

Instance Attribute Details

#account_numberString

The account number on the paper item.

Returns:

  • (String)


68
69
70
# File 'lib/modern_treasury/models/paper_item.rb', line 68

def 
  @account_number
end

#account_number_safeString

The last 4 digits of the account_number.

Returns:

  • (String)


72
73
74
# File 'lib/modern_treasury/models/paper_item.rb', line 72

def 
  @account_number_safe
end

#amountInteger

The amount of the paper item.

Returns:

  • (Integer)


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

def amount
  @amount
end

#check_numberString

The check number on the paper item.

Returns:

  • (String)


80
81
82
# File 'lib/modern_treasury/models/paper_item.rb', line 80

def check_number
  @check_number
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/paper_item.rb', line 29

def created_at
  @created_at
end

#currencyCurrency

Three-letter ISO currency code.

Returns:



64
65
66
# File 'lib/modern_treasury/models/paper_item.rb', line 64

def currency
  @currency
end

#deposit_dateDate

The date the paper item was deposited into your organization’s bank account.

Returns:

  • (Date)


56
57
58
# File 'lib/modern_treasury/models/paper_item.rb', line 56

def deposit_date
  @deposit_date
end

#idUUID | String

TODO: Write general description for this method

Returns:

  • (UUID | String)


15
16
17
# File 'lib/modern_treasury/models/paper_item.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/paper_item.rb', line 24

def live_mode
  @live_mode
end

#lockbox_numberString

The identifier for the lockbox assigned by the bank.

Returns:

  • (String)


51
52
53
# File 'lib/modern_treasury/models/paper_item.rb', line 51

def lockbox_number
  @lockbox_number
end

#memo_fieldString

The memo field on the paper item.

Returns:

  • (String)


88
89
90
# File 'lib/modern_treasury/models/paper_item.rb', line 88

def memo_field
  @memo_field
end

#objectString

TODO: Write general description for this method

Returns:

  • (String)


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

def object
  @object
end

#remitter_nameString

The name of the remitter on the paper item.

Returns:

  • (String)


84
85
86
# File 'lib/modern_treasury/models/paper_item.rb', line 84

def remitter_name
  @remitter_name
end

#routing_numberString

The routing number on the paper item.

Returns:

  • (String)


76
77
78
# File 'lib/modern_treasury/models/paper_item.rb', line 76

def routing_number
  @routing_number
end

#statusStatus16

The current status of the paper item. One of ‘pending`, `completed`, or `returned`.

Returns:



47
48
49
# File 'lib/modern_treasury/models/paper_item.rb', line 47

def status
  @status
end

#transaction_idUUID | String

The ID of the reconciled Transaction or ‘null`.

Returns:

  • (UUID | String)


42
43
44
# File 'lib/modern_treasury/models/paper_item.rb', line 42

def transaction_id
  @transaction_id
end

#transaction_line_item_idUUID | String

The ID of the reconciled Transaction Line Item or ‘null`.

Returns:

  • (UUID | String)


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

def transaction_line_item_id
  @transaction_line_item_id
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/paper_item.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.



159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'lib/modern_treasury/models/paper_item.rb', line 159

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : nil
  object = hash.key?('object') ? hash['object'] : nil
  live_mode = hash.key?('live_mode') ? hash['live_mode'] : nil
  created_at = if hash.key?('created_at')
                 (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at'])
               end
  updated_at = if hash.key?('updated_at')
                 (DateTimeHelper.from_rfc3339(hash['updated_at']) if hash['updated_at'])
               end
  transaction_line_item_id =
    hash.key?('transaction_line_item_id') ? hash['transaction_line_item_id'] : nil
  transaction_id =
    hash.key?('transaction_id') ? hash['transaction_id'] : nil
  status = hash.key?('status') ? hash['status'] : nil
  lockbox_number =
    hash.key?('lockbox_number') ? hash['lockbox_number'] : nil
  deposit_date = hash.key?('deposit_date') ? hash['deposit_date'] : nil
  amount = hash.key?('amount') ? hash['amount'] : nil
  currency = hash.key?('currency') ? hash['currency'] : nil
   =
    hash.key?('account_number') ? hash['account_number'] : nil
   =
    hash.key?('account_number_safe') ? hash['account_number_safe'] : nil
  routing_number =
    hash.key?('routing_number') ? hash['routing_number'] : nil
  check_number = hash.key?('check_number') ? hash['check_number'] : nil
  remitter_name = hash.key?('remitter_name') ? hash['remitter_name'] : nil
  memo_field = hash.key?('memo_field') ? hash['memo_field'] : nil

  # Create object from extracted values.
  PaperItem.new(id: id,
                object: object,
                live_mode: live_mode,
                created_at: created_at,
                updated_at: updated_at,
                transaction_line_item_id: transaction_line_item_id,
                transaction_id: transaction_id,
                status: status,
                lockbox_number: lockbox_number,
                deposit_date: deposit_date,
                amount: amount,
                currency: currency,
                account_number: ,
                account_number_safe: ,
                routing_number: routing_number,
                check_number: check_number,
                remitter_name: remitter_name,
                memo_field: memo_field)
end

.namesObject

A mapping from model property names to API property names.



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/modern_treasury/models/paper_item.rb', line 91

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['transaction_line_item_id'] = 'transaction_line_item_id'
  @_hash['transaction_id'] = 'transaction_id'
  @_hash['status'] = 'status'
  @_hash['lockbox_number'] = 'lockbox_number'
  @_hash['deposit_date'] = 'deposit_date'
  @_hash['amount'] = 'amount'
  @_hash['currency'] = 'currency'
  @_hash['account_number'] = 'account_number'
  @_hash['account_number_safe'] = 'account_number_safe'
  @_hash['routing_number'] = 'routing_number'
  @_hash['check_number'] = 'check_number'
  @_hash['remitter_name'] = 'remitter_name'
  @_hash['memo_field'] = 'memo_field'
  @_hash
end

.nullablesObject

An array for nullable fields



120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/modern_treasury/models/paper_item.rb', line 120

def self.nullables
  %w[
    transaction_line_item_id
    transaction_id
    account_number
    account_number_safe
    routing_number
    check_number
    remitter_name
    memo_field
  ]
end

.optionalsObject

An array for optional fields



115
116
117
# File 'lib/modern_treasury/models/paper_item.rb', line 115

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/modern_treasury/models/paper_item.rb', line 234

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}, transaction_line_item_id: #{@transaction_line_item_id.inspect},"\
  " transaction_id: #{@transaction_id.inspect}, status: #{@status.inspect}, lockbox_number:"\
  " #{@lockbox_number.inspect}, deposit_date: #{@deposit_date.inspect}, amount:"\
  " #{@amount.inspect}, currency: #{@currency.inspect}, account_number:"\
  " #{@account_number.inspect}, account_number_safe: #{@account_number_safe.inspect},"\
  " routing_number: #{@routing_number.inspect}, check_number: #{@check_number.inspect},"\
  " remitter_name: #{@remitter_name.inspect}, memo_field: #{@memo_field.inspect}>"
end

#to_custom_created_atObject



213
214
215
# File 'lib/modern_treasury/models/paper_item.rb', line 213

def to_custom_created_at
  DateTimeHelper.to_rfc3339(created_at)
end

#to_custom_updated_atObject



217
218
219
# File 'lib/modern_treasury/models/paper_item.rb', line 217

def to_custom_updated_at
  DateTimeHelper.to_rfc3339(updated_at)
end

#to_sObject

Provides a human-readable string representation of the object.



222
223
224
225
226
227
228
229
230
231
# File 'lib/modern_treasury/models/paper_item.rb', line 222

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}, transaction_line_item_id:"\
  " #{@transaction_line_item_id}, transaction_id: #{@transaction_id}, status: #{@status},"\
  " lockbox_number: #{@lockbox_number}, deposit_date: #{@deposit_date}, amount: #{@amount},"\
  " currency: #{@currency}, account_number: #{@account_number}, account_number_safe:"\
  " #{@account_number_safe}, routing_number: #{@routing_number}, check_number:"\
  " #{@check_number}, remitter_name: #{@remitter_name}, memo_field: #{@memo_field}>"
end