Class: Checkbook::Approval

Inherits:
Object
  • Object
show all
Defined in:
lib/checkbook/api/approval.rb,
lib/checkbook/models/approval.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Approval

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



133
134
135
# File 'lib/checkbook/models/approval.rb', line 133

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#amountObject

Payment amount



19
20
21
# File 'lib/checkbook/models/approval.rb', line 19

def amount
  @amount
end

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/checkbook/api/approval.rb', line 17

def api_client
  @api_client
end

#commentObject

Payment comment



22
23
24
# File 'lib/checkbook/models/approval.rb', line 22

def comment
  @comment
end

#dateObject

Payment creation timestamp



25
26
27
# File 'lib/checkbook/models/approval.rb', line 25

def date
  @date
end

#descriptionObject

Payment description/memo



28
29
30
# File 'lib/checkbook/models/approval.rb', line 28

def description
  @description
end

#directionObject

Payment direction



31
32
33
# File 'lib/checkbook/models/approval.rb', line 31

def direction
  @direction
end

#idObject

Unique identifier for payment



34
35
36
# File 'lib/checkbook/models/approval.rb', line 34

def id
  @id
end

#image_uriObject

URI where image of the payment can be accessed



37
38
39
# File 'lib/checkbook/models/approval.rb', line 37

def image_uri
  @image_uri
end

#nameObject

Name of third party who received the payment



40
41
42
# File 'lib/checkbook/models/approval.rb', line 40

def name
  @name
end

#numberObject

Returns the value of attribute number.



42
43
44
# File 'lib/checkbook/models/approval.rb', line 42

def number
  @number
end

#recipientObject

Returns the value of attribute recipient.



44
45
46
# File 'lib/checkbook/models/approval.rb', line 44

def recipient
  @recipient
end

#senderObject

Email/id or physical address of the check sender



47
48
49
# File 'lib/checkbook/models/approval.rb', line 47

def sender
  @sender
end

#statusObject

Current status of the entry



50
51
52
# File 'lib/checkbook/models/approval.rb', line 50

def status
  @status
end

Class Method Details

._deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
# File 'lib/checkbook/models/approval.rb', line 358

def self._deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = ::Checkbook.const_get(type)
    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



93
94
95
# File 'lib/checkbook/models/approval.rb', line 93

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



98
99
100
# File 'lib/checkbook/models/approval.rb', line 98

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/checkbook/models/approval.rb', line 75

def self.attribute_map
  {
    :'amount' => :'amount',
    :'comment' => :'comment',
    :'date' => :'date',
    :'description' => :'description',
    :'direction' => :'direction',
    :'id' => :'id',
    :'image_uri' => :'image_uri',
    :'name' => :'name',
    :'number' => :'number',
    :'recipient' => :'recipient',
    :'sender' => :'sender',
    :'status' => :'status'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
# File 'lib/checkbook/models/approval.rb', line 334

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



121
122
123
124
125
126
127
128
129
# File 'lib/checkbook/models/approval.rb', line 121

def self.openapi_nullable
  Set.new([
    :'comment',
    :'description',
    :'image_uri',
    :'name',
    :'sender',
  ])
end

.openapi_typesObject

Attribute type mapping.



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/checkbook/models/approval.rb', line 103

def self.openapi_types
  {
    :'amount' => :'Float',
    :'comment' => :'String',
    :'date' => :'String',
    :'description' => :'String',
    :'direction' => :'String',
    :'id' => :'String',
    :'image_uri' => :'String',
    :'name' => :'String',
    :'number' => :'ApprovalNumber',
    :'recipient' => :'ApprovalRecipient',
    :'sender' => :'String',
    :'status' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
# File 'lib/checkbook/models/approval.rb', line 302

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      amount == o.amount &&
      comment == o.comment &&
      date == o.date &&
      description == o.description &&
      direction == o.direction &&
      id == o.id &&
      image_uri == o.image_uri &&
      name == o.name &&
      number == o.number &&
      recipient == o.recipient &&
      sender == o.sender &&
      status == o.status
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



429
430
431
432
433
434
435
436
437
438
439
440
441
# File 'lib/checkbook/models/approval.rb', line 429

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#delete_approval_check(approval_id, opts = {}) ⇒ nil

Remove payment approval Cancel the specified check approval

Parameters:

  • approval_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


27
28
29
30
# File 'lib/checkbook/api/approval.rb', line 27

def delete_approval_check(approval_id, opts = {})
  delete_approval_check_with_http_info(approval_id, opts)
  nil
end

#delete_approval_check_with_http_info(approval_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Remove payment approval Cancel the specified check approval

Parameters:

  • approval_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/checkbook/api/approval.rb', line 37

def delete_approval_check_with_http_info(approval_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: Approval.delete_approval_check ...'
  end
  # verify the required parameter 'approval_id' is set
  if @api_client.config.client_side_validation && approval_id.nil?
    fail ArgumentError, "Missing the required parameter 'approval_id' when calling Approval.delete_approval_check"
  end
  # resource path
  local_var_path = '/v3/approval/{approval_id}'.sub('{' + 'approval_id' + '}', CGI.escape(approval_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"Approval.delete_approval_check",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: Approval#delete_approval_check\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


321
322
323
# File 'lib/checkbook/models/approval.rb', line 321

def eql?(o)
  self == o
end

#get_approval_attachment(approval_id, opts = {}) ⇒ File

Get attachment for payment approval Get the attachment for a payment approval

Parameters:

  • approval_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (File)


90
91
92
93
# File 'lib/checkbook/api/approval.rb', line 90

def get_approval_attachment(approval_id, opts = {})
  data, _status_code, _headers = get_approval_attachment_with_http_info(approval_id, opts)
  data
end

#get_approval_attachment_with_http_info(approval_id, opts = {}) ⇒ Array<(File, Integer, Hash)>

Get attachment for payment approval Get the attachment for a payment approval

Parameters:

  • approval_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(File, Integer, Hash)>)

    File data, response status code and response headers



100
101
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
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/checkbook/api/approval.rb', line 100

def get_approval_attachment_with_http_info(approval_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: Approval.get_approval_attachment ...'
  end
  # verify the required parameter 'approval_id' is set
  if @api_client.config.client_side_validation && approval_id.nil?
    fail ArgumentError, "Missing the required parameter 'approval_id' when calling Approval.get_approval_attachment"
  end
  # resource path
  local_var_path = '/v3/approval/{approval_id}/attachment'.sub('{' + 'approval_id' + '}', CGI.escape(approval_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/pdf', 'application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'File'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"Approval.get_approval_attachment",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: Approval#get_approval_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_approval_check(approval_id, opts = {}) ⇒ GetApprovalResponse

Get payment approval Get the specified payment approval

Parameters:

  • approval_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



153
154
155
156
# File 'lib/checkbook/api/approval.rb', line 153

def get_approval_check(approval_id, opts = {})
  data, _status_code, _headers = get_approval_check_with_http_info(approval_id, opts)
  data
end

#get_approval_check_with_http_info(approval_id, opts = {}) ⇒ Array<(GetApprovalResponse, Integer, Hash)>

Get payment approval Get the specified payment approval

Parameters:

  • approval_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(GetApprovalResponse, Integer, Hash)>)

    GetApprovalResponse data, response status code and response headers



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
# File 'lib/checkbook/api/approval.rb', line 163

def get_approval_check_with_http_info(approval_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: Approval.get_approval_check ...'
  end
  # verify the required parameter 'approval_id' is set
  if @api_client.config.client_side_validation && approval_id.nil?
    fail ArgumentError, "Missing the required parameter 'approval_id' when calling Approval.get_approval_check"
  end
  # resource path
  local_var_path = '/v3/approval/{approval_id}'.sub('{' + 'approval_id' + '}', CGI.escape(approval_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetApprovalResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"Approval.get_approval_check",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: Approval#get_approval_check\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_approval_checks(opts = {}) ⇒ GetApprovalsResponse

Get approval payments Return approvals

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :direction (String)

    Direction

  • :end_date (Date)

    End date

  • :page (Integer)

    Page number (default to 1)

  • :per_page (Integer)

    Items per page (default to 50)

  • :q (String)

    Query

  • :sort (String)

    Sort

  • :start_date (Date)

    Start date

  • :status (String)

    Status

Returns:



223
224
225
226
# File 'lib/checkbook/api/approval.rb', line 223

def get_approval_checks(opts = {})
  data, _status_code, _headers = get_approval_checks_with_http_info(opts)
  data
end

#get_approval_checks_with_http_info(opts = {}) ⇒ Array<(GetApprovalsResponse, Integer, Hash)>

Get approval payments Return approvals

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :direction (String)

    Direction

  • :end_date (Date)

    End date

  • :page (Integer)

    Page number (default to 1)

  • :per_page (Integer)

    Items per page (default to 50)

  • :q (String)

    Query

  • :sort (String)

    Sort

  • :start_date (Date)

    Start date

  • :status (String)

    Status

Returns:

  • (Array<(GetApprovalsResponse, Integer, Hash)>)

    GetApprovalsResponse data, response status code and response headers



240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
# File 'lib/checkbook/api/approval.rb', line 240

def get_approval_checks_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: Approval.get_approval_checks ...'
  end
  allowable_values = ["INCOMING", "OUTGOING"]
  if @api_client.config.client_side_validation && opts[:'direction'] && !allowable_values.include?(opts[:'direction'])
    fail ArgumentError, "invalid value for \"direction\", must be one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page"]" when calling Approval.get_approval_checks, must be greater than or equal to 1.'
  end

  allowable_values = [10, 25, 50, 100, 250]
  if @api_client.config.client_side_validation && opts[:'per_page'] && !allowable_values.include?(opts[:'per_page'])
    fail ArgumentError, "invalid value for \"per_page\", must be one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'q'].nil? && opts[:'q'].to_s.length > 180
    fail ArgumentError, 'invalid value for "opts[:"q"]" when calling Approval.get_approval_checks, the character length must be smaller than or equal to 180.'
  end

  allowable_values = ["+NUMBER", "-NUMBER", "+TYPE", "-TYPE", "+AMOUNT", "-AMOUNT", "+STATUS", "-STATUS", "+DATE", "-DATE", "+UPDATE", "-UPDATE", "+DESCRIPTION", "-DESCRIPTION"]
  if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
    fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
  end
  allowable_values = ["PAID", "IN_PROCESS", "UNPAID", "VOID", "EXPIRED", "PRINTED", "MAILED", "FAILED", "REFUNDED"]
  if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
    fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v3/approval'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'direction'] = opts[:'direction'] if !opts[:'direction'].nil?
  query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
  query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetApprovalsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"Approval.get_approval_checks",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: Approval#get_approval_checks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



327
328
329
# File 'lib/checkbook/models/approval.rb', line 327

def hash
  [amount, comment, date, description, direction, id, image_uri, name, number, recipient, sender, status].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# File 'lib/checkbook/models/approval.rb', line 208

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @amount.nil?
    invalid_properties.push('invalid value for "amount", amount cannot be nil.')
  end

  if @date.nil?
    invalid_properties.push('invalid value for "date", date cannot be nil.')
  end

  if @direction.nil?
    invalid_properties.push('invalid value for "direction", direction cannot be nil.')
  end

  if @id.nil?
    invalid_properties.push('invalid value for "id", id cannot be nil.')
  end

  if @status.nil?
    invalid_properties.push('invalid value for "status", status cannot be nil.')
  end

  invalid_properties
end

#post_approval_digital(create_digital_check_request, opts = {}) ⇒ GetApprovalResponse

Create approval digital payment Create a new approval digital payment

Parameters:

Returns:



321
322
323
324
# File 'lib/checkbook/api/approval.rb', line 321

def post_approval_digital(create_digital_check_request, opts = {})
  data, _status_code, _headers = post_approval_digital_with_http_info(create_digital_check_request, opts)
  data
end

#post_approval_digital_with_http_info(create_digital_check_request, opts = {}) ⇒ Array<(GetApprovalResponse, Integer, Hash)>

Create approval digital payment Create a new approval digital payment

Parameters:

Returns:

  • (Array<(GetApprovalResponse, Integer, Hash)>)

    GetApprovalResponse data, response status code and response headers



331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
# File 'lib/checkbook/api/approval.rb', line 331

def post_approval_digital_with_http_info(create_digital_check_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: Approval.post_approval_digital ...'
  end
  # verify the required parameter 'create_digital_check_request' is set
  if @api_client.config.client_side_validation && create_digital_check_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_digital_check_request' when calling Approval.post_approval_digital"
  end
  # resource path
  local_var_path = '/v3/approval/digital'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_digital_check_request)

  # return_type
  return_type = opts[:debug_return_type] || 'GetApprovalResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"Approval.post_approval_digital",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: Approval#post_approval_digital\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#post_approval_multi(create_multi_check_request, opts = {}) ⇒ GetApprovalResponse

Create multi-party payment approval Create a new multi-party payment approval

Parameters:

Returns:



389
390
391
392
# File 'lib/checkbook/api/approval.rb', line 389

def post_approval_multi(create_multi_check_request, opts = {})
  data, _status_code, _headers = post_approval_multi_with_http_info(create_multi_check_request, opts)
  data
end

#post_approval_multi_with_http_info(create_multi_check_request, opts = {}) ⇒ Array<(GetApprovalResponse, Integer, Hash)>

Create multi-party payment approval Create a new multi-party payment approval

Parameters:

Returns:

  • (Array<(GetApprovalResponse, Integer, Hash)>)

    GetApprovalResponse data, response status code and response headers



399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
# File 'lib/checkbook/api/approval.rb', line 399

def post_approval_multi_with_http_info(create_multi_check_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: Approval.post_approval_multi ...'
  end
  # verify the required parameter 'create_multi_check_request' is set
  if @api_client.config.client_side_validation && create_multi_check_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_multi_check_request' when calling Approval.post_approval_multi"
  end
  # resource path
  local_var_path = '/v3/approval/multi'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_multi_check_request)

  # return_type
  return_type = opts[:debug_return_type] || 'GetApprovalResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"Approval.post_approval_multi",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: Approval#post_approval_multi\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#post_approval_physical(create_physical_check_request, opts = {}) ⇒ GetApprovalResponse

Create physical check approval Create a new physical check approval

Parameters:

Returns:



457
458
459
460
# File 'lib/checkbook/api/approval.rb', line 457

def post_approval_physical(create_physical_check_request, opts = {})
  data, _status_code, _headers = post_approval_physical_with_http_info(create_physical_check_request, opts)
  data
end

#post_approval_physical_with_http_info(create_physical_check_request, opts = {}) ⇒ Array<(GetApprovalResponse, Integer, Hash)>

Create physical check approval Create a new physical check approval

Parameters:

Returns:

  • (Array<(GetApprovalResponse, Integer, Hash)>)

    GetApprovalResponse data, response status code and response headers



467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
# File 'lib/checkbook/api/approval.rb', line 467

def post_approval_physical_with_http_info(create_physical_check_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: Approval.post_approval_physical ...'
  end
  # verify the required parameter 'create_physical_check_request' is set
  if @api_client.config.client_side_validation && create_physical_check_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_physical_check_request' when calling Approval.post_approval_physical"
  end
  # resource path
  local_var_path = '/v3/approval/physical'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_physical_check_request)

  # return_type
  return_type = opts[:debug_return_type] || 'GetApprovalResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"Approval.post_approval_physical",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: Approval#post_approval_physical\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#post_approval_release(release_check_request, opts = {}) ⇒ GetCheckResponse

Approve payment Create a live payment from an approval

Parameters:

  • release_check_request (ReleaseCheckRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



525
526
527
528
# File 'lib/checkbook/api/approval.rb', line 525

def post_approval_release(release_check_request, opts = {})
  data, _status_code, _headers = post_approval_release_with_http_info(release_check_request, opts)
  data
end

#post_approval_release_with_http_info(release_check_request, opts = {}) ⇒ Array<(GetCheckResponse, Integer, Hash)>

Approve payment Create a live payment from an approval

Parameters:

  • release_check_request (ReleaseCheckRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(GetCheckResponse, Integer, Hash)>)

    GetCheckResponse data, response status code and response headers



535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
# File 'lib/checkbook/api/approval.rb', line 535

def post_approval_release_with_http_info(release_check_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: Approval.post_approval_release ...'
  end
  # verify the required parameter 'release_check_request' is set
  if @api_client.config.client_side_validation && release_check_request.nil?
    fail ArgumentError, "Missing the required parameter 'release_check_request' when calling Approval.post_approval_release"
  end
  # resource path
  local_var_path = '/v3/approval/release'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(release_check_request)

  # return_type
  return_type = opts[:debug_return_type] || 'GetCheckResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"Approval.post_approval_release",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: Approval#post_approval_release\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#put_approval_check(approval_id, update_approval_request, opts = {}) ⇒ nil

Update payment approval Update the specified payment approval

Parameters:

  • approval_id (String)
  • update_approval_request (UpdateApprovalRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


594
595
596
597
# File 'lib/checkbook/api/approval.rb', line 594

def put_approval_check(approval_id, update_approval_request, opts = {})
  put_approval_check_with_http_info(approval_id, update_approval_request, opts)
  nil
end

#put_approval_check_with_http_info(approval_id, update_approval_request, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Update payment approval Update the specified payment approval

Parameters:

  • approval_id (String)
  • update_approval_request (UpdateApprovalRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
# File 'lib/checkbook/api/approval.rb', line 605

def put_approval_check_with_http_info(approval_id, update_approval_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: Approval.put_approval_check ...'
  end
  # verify the required parameter 'approval_id' is set
  if @api_client.config.client_side_validation && approval_id.nil?
    fail ArgumentError, "Missing the required parameter 'approval_id' when calling Approval.put_approval_check"
  end
  # verify the required parameter 'update_approval_request' is set
  if @api_client.config.client_side_validation && update_approval_request.nil?
    fail ArgumentError, "Missing the required parameter 'update_approval_request' when calling Approval.put_approval_check"
  end
  # resource path
  local_var_path = '/v3/approval/{approval_id}'.sub('{' + 'approval_id' + '}', CGI.escape(approval_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(update_approval_request)

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"Approval.put_approval_check",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: Approval#put_approval_check\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



405
406
407
# File 'lib/checkbook/models/approval.rb', line 405

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



411
412
413
414
415
416
417
418
419
420
421
422
423
# File 'lib/checkbook/models/approval.rb', line 411

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



399
400
401
# File 'lib/checkbook/models/approval.rb', line 399

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/checkbook/models/approval.rb', line 236

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @amount.nil?
  return false if @date.nil?
  return false if @direction.nil?
  direction_validator = EnumAttributeValidator.new('String', ["INCOMING", "OUTGOING"])
  return false unless direction_validator.valid?(@direction)
  return false if @id.nil?
  return false if @status.nil?
  status_validator = EnumAttributeValidator.new('String', ["UNPAID", "APPROVED", "VOID"])
  return false unless status_validator.valid?(@status)
  true
end