Class: YNAB::TransactionsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/ynab/api/transactions_api.rb

Direct Known Subclasses

Overrides::TransactionsApi

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ TransactionsApi

Returns a new instance of TransactionsApi.



15
16
17
# File 'lib/ynab/api/transactions_api.rb', line 15

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



13
14
15
# File 'lib/ynab/api/transactions_api.rb', line 13

def api_client
  @api_client
end

Instance Method Details

#create_transaction(plan_id, data, opts = {}) ⇒ SaveTransactionsResponse

Create a single transaction or multiple transactions Creates a single transaction or multiple transactions. If you provide a body containing a transaction object, a single transaction will be created and if you provide a body containing a transactions array, multiple transactions will be created. Scheduled transactions (transactions with a future date) cannot be created on this endpoint.

Parameters:

  • plan_id (String)

    The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan).

  • data (PostTransactionsWrapper)

    The transaction or transactions to create. To create a single transaction you can specify a value for the `transaction` object and to create multiple transactions you can specify an array of `transactions`. It is expected that you will only provide a value for one of these objects.

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

    the optional parameters

Returns:



24
25
26
27
# File 'lib/ynab/api/transactions_api.rb', line 24

def create_transaction(plan_id, data, opts = {})
  data, _status_code, _headers = create_transaction_with_http_info(plan_id, data, opts)
  data
end

#create_transaction_with_http_info(plan_id, data, opts = {}) ⇒ Array<(SaveTransactionsResponse, Integer, Hash)>

Create a single transaction or multiple transactions Creates a single transaction or multiple transactions. If you provide a body containing a `transaction` object, a single transaction will be created and if you provide a body containing a `transactions` array, multiple transactions will be created. Scheduled transactions (transactions with a future date) cannot be created on this endpoint.

Parameters:

  • plan_id (String)

    The id of the plan. &quot;last-used&quot; can be used to specify the last used plan and &quot;default&quot; can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan).

  • data (PostTransactionsWrapper)

    The transaction or transactions to create. To create a single transaction you can specify a value for the `transaction` object and to create multiple transactions you can specify an array of `transactions`. It is expected that you will only provide a value for one of these objects.

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

    the optional parameters

Returns:

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

    SaveTransactionsResponse data, response status code and response headers



35
36
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
84
85
86
87
88
89
90
# File 'lib/ynab/api/transactions_api.rb', line 35

def create_transaction_with_http_info(plan_id, data, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TransactionsApi.create_transaction ...'
  end
  # verify the required parameter 'plan_id' is set
  if @api_client.config.client_side_validation && plan_id.nil?
    fail ArgumentError, "Missing the required parameter 'plan_id' when calling TransactionsApi.create_transaction"
  end
  # verify the required parameter 'data' is set
  if @api_client.config.client_side_validation && data.nil?
    fail ArgumentError, "Missing the required parameter 'data' when calling TransactionsApi.create_transaction"
  end
  # resource path
  local_var_path = '/plans/{plan_id}/transactions'.sub('{' + 'plan_id' + '}', CGI.escape(plan_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'])
  # 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(data)

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

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

  new_options = opts.merge(
    :operation => :"TransactionsApi.create_transaction",
    :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: TransactionsApi#create_transaction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_transaction(plan_id, transaction_id, opts = {}) ⇒ TransactionResponse

Delete a transaction Deletes a transaction

Parameters:

  • plan_id (String)

    The id of the plan. &quot;last-used&quot; can be used to specify the last used plan and &quot;default&quot; can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan).

  • transaction_id (String)

    The id of the transaction

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

    the optional parameters

Returns:



98
99
100
101
# File 'lib/ynab/api/transactions_api.rb', line 98

def delete_transaction(plan_id, transaction_id, opts = {})
  data, _status_code, _headers = delete_transaction_with_http_info(plan_id, transaction_id, opts)
  data
end

#delete_transaction_with_http_info(plan_id, transaction_id, opts = {}) ⇒ Array<(TransactionResponse, Integer, Hash)>

Delete a transaction Deletes a transaction

Parameters:

  • plan_id (String)

    The id of the plan. &quot;last-used&quot; can be used to specify the last used plan and &quot;default&quot; can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan).

  • transaction_id (String)

    The id of the transaction

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

    the optional parameters

Returns:

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

    TransactionResponse data, response status code and response headers



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
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/ynab/api/transactions_api.rb', line 109

def delete_transaction_with_http_info(plan_id, transaction_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TransactionsApi.delete_transaction ...'
  end
  # verify the required parameter 'plan_id' is set
  if @api_client.config.client_side_validation && plan_id.nil?
    fail ArgumentError, "Missing the required parameter 'plan_id' when calling TransactionsApi.delete_transaction"
  end
  # verify the required parameter 'transaction_id' is set
  if @api_client.config.client_side_validation && transaction_id.nil?
    fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TransactionsApi.delete_transaction"
  end
  # resource path
  local_var_path = '/plans/{plan_id}/transactions/{transaction_id}'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)).sub('{' + 'transaction_id' + '}', CGI.escape(transaction_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'])

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

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

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

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

  new_options = opts.merge(
    :operation => :"TransactionsApi.delete_transaction",
    :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: TransactionsApi#delete_transaction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_transaction_by_id(plan_id, transaction_id, opts = {}) ⇒ TransactionResponse

Get a transaction Returns a single transaction

Parameters:

  • plan_id (String)

    The id of the plan. &quot;last-used&quot; can be used to specify the last used plan and &quot;default&quot; can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan).

  • transaction_id (String)

    The id of the transaction

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

    the optional parameters

Returns:



167
168
169
170
# File 'lib/ynab/api/transactions_api.rb', line 167

def get_transaction_by_id(plan_id, transaction_id, opts = {})
  data, _status_code, _headers = get_transaction_by_id_with_http_info(plan_id, transaction_id, opts)
  data
end

#get_transaction_by_id_with_http_info(plan_id, transaction_id, opts = {}) ⇒ Array<(TransactionResponse, Integer, Hash)>

Get a transaction Returns a single transaction

Parameters:

  • plan_id (String)

    The id of the plan. &quot;last-used&quot; can be used to specify the last used plan and &quot;default&quot; can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan).

  • transaction_id (String)

    The id of the transaction

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

    the optional parameters

Returns:

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

    TransactionResponse data, response status code and response headers



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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'lib/ynab/api/transactions_api.rb', line 178

def get_transaction_by_id_with_http_info(plan_id, transaction_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TransactionsApi.get_transaction_by_id ...'
  end
  # verify the required parameter 'plan_id' is set
  if @api_client.config.client_side_validation && plan_id.nil?
    fail ArgumentError, "Missing the required parameter 'plan_id' when calling TransactionsApi.get_transaction_by_id"
  end
  # verify the required parameter 'transaction_id' is set
  if @api_client.config.client_side_validation && transaction_id.nil?
    fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TransactionsApi.get_transaction_by_id"
  end
  # resource path
  local_var_path = '/plans/{plan_id}/transactions/{transaction_id}'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)).sub('{' + 'transaction_id' + '}', CGI.escape(transaction_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'])

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

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

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

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

  new_options = opts.merge(
    :operation => :"TransactionsApi.get_transaction_by_id",
    :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: TransactionsApi#get_transaction_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_transactions(plan_id, opts = {}) ⇒ TransactionsResponse

Get transactions Returns plan transactions, excluding any pending transactions

Parameters:

  • plan_id (String)

    The id of the plan. &quot;last-used&quot; can be used to specify the last used plan and &quot;default&quot; can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan).

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

    the optional parameters

Options Hash (opts):

  • :since_date (Date)

    If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30). Defaults to one year ago when not specified.

  • :until_date (Date)

    If specified, only transactions on or before this date will be included. The date should be ISO formatted (e.g. 2016-12-30).

  • :type (String)

    If specified, only transactions of the specified type will be included. &quot;uncategorized&quot; and &quot;unapproved&quot; are currently supported.

  • :last_knowledge_of_server (Integer)

    The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included.

Returns:



239
240
241
242
# File 'lib/ynab/api/transactions_api.rb', line 239

def get_transactions(plan_id, opts = {})
  data, _status_code, _headers = get_transactions_with_http_info(plan_id, opts)
  data
end

#get_transactions_by_account(plan_id, account_id, opts = {}) ⇒ TransactionsResponse

Get account transactions Returns all transactions for a specified account, excluding any pending transactions

Parameters:

  • plan_id (String)

    The id of the plan. &quot;last-used&quot; can be used to specify the last used plan and &quot;default&quot; can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan).

  • account_id (String)

    The id of the account

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

    the optional parameters

Options Hash (opts):

  • :since_date (Date)

    If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30). Defaults to one year ago when not specified.

  • :until_date (Date)

    If specified, only transactions on or before this date will be included. The date should be ISO formatted (e.g. 2016-12-30).

  • :type (String)

    If specified, only transactions of the specified type will be included. &quot;uncategorized&quot; and &quot;unapproved&quot; are currently supported.

  • :last_knowledge_of_server (Integer)

    The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included.

Returns:



315
316
317
318
# File 'lib/ynab/api/transactions_api.rb', line 315

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

#get_transactions_by_account_with_http_info(plan_id, account_id, opts = {}) ⇒ Array<(TransactionsResponse, Integer, Hash)>

Get account transactions Returns all transactions for a specified account, excluding any pending transactions

Parameters:

  • plan_id (String)

    The id of the plan. &quot;last-used&quot; can be used to specify the last used plan and &quot;default&quot; can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan).

  • account_id (String)

    The id of the account

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

    the optional parameters

Options Hash (opts):

  • :since_date (Date)

    If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30). Defaults to one year ago when not specified.

  • :until_date (Date)

    If specified, only transactions on or before this date will be included. The date should be ISO formatted (e.g. 2016-12-30).

  • :type (String)

    If specified, only transactions of the specified type will be included. &quot;uncategorized&quot; and &quot;unapproved&quot; are currently supported.

  • :last_knowledge_of_server (Integer)

    The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included.

Returns:

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

    TransactionsResponse data, response status code and response headers



330
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
383
384
# File 'lib/ynab/api/transactions_api.rb', line 330

def (plan_id, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TransactionsApi.get_transactions_by_account ...'
  end
  # verify the required parameter 'plan_id' is set
  if @api_client.config.client_side_validation && plan_id.nil?
    fail ArgumentError, "Missing the required parameter 'plan_id' when calling TransactionsApi.get_transactions_by_account"
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling TransactionsApi.get_transactions_by_account"
  end
  # resource path
  local_var_path = '/plans/{plan_id}/accounts/{account_id}/transactions'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)).sub('{' + 'account_id' + '}', CGI.escape(.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'since_date'] = opts[:'since_date'] if !opts[:'since_date'].nil?
  query_params[:'until_date'] = opts[:'until_date'] if !opts[:'until_date'].nil?
  query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?
  query_params[:'last_knowledge_of_server'] = opts[:'last_knowledge_of_server'] if !opts[:'last_knowledge_of_server'].nil?

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

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

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

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

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

  new_options = opts.merge(
    :operation => :"TransactionsApi.get_transactions_by_account",
    :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: TransactionsApi#get_transactions_by_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_transactions_by_category(plan_id, category_id, opts = {}) ⇒ HybridTransactionsResponse

Get category transactions Returns all transactions for a specified category, excluding any pending transactions

Parameters:

  • plan_id (String)

    The id of the plan. &quot;last-used&quot; can be used to specify the last used plan and &quot;default&quot; can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan).

  • category_id (String)

    The id of the category

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

    the optional parameters

Options Hash (opts):

  • :since_date (Date)

    If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30). Defaults to one year ago when not specified.

  • :until_date (Date)

    If specified, only transactions on or before this date will be included. The date should be ISO formatted (e.g. 2016-12-30).

  • :type (String)

    If specified, only transactions of the specified type will be included. &quot;uncategorized&quot; and &quot;unapproved&quot; are currently supported.

  • :last_knowledge_of_server (Integer)

    The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included.

Returns:



396
397
398
399
# File 'lib/ynab/api/transactions_api.rb', line 396

def get_transactions_by_category(plan_id, category_id, opts = {})
  data, _status_code, _headers = get_transactions_by_category_with_http_info(plan_id, category_id, opts)
  data
end

#get_transactions_by_category_with_http_info(plan_id, category_id, opts = {}) ⇒ Array<(HybridTransactionsResponse, Integer, Hash)>

Get category transactions Returns all transactions for a specified category, excluding any pending transactions

Parameters:

  • plan_id (String)

    The id of the plan. &quot;last-used&quot; can be used to specify the last used plan and &quot;default&quot; can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan).

  • category_id (String)

    The id of the category

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

    the optional parameters

Options Hash (opts):

  • :since_date (Date)

    If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30). Defaults to one year ago when not specified.

  • :until_date (Date)

    If specified, only transactions on or before this date will be included. The date should be ISO formatted (e.g. 2016-12-30).

  • :type (String)

    If specified, only transactions of the specified type will be included. &quot;uncategorized&quot; and &quot;unapproved&quot; are currently supported.

  • :last_knowledge_of_server (Integer)

    The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included.

Returns:

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

    HybridTransactionsResponse data, response status code and response headers



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
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
# File 'lib/ynab/api/transactions_api.rb', line 411

def get_transactions_by_category_with_http_info(plan_id, category_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TransactionsApi.get_transactions_by_category ...'
  end
  # verify the required parameter 'plan_id' is set
  if @api_client.config.client_side_validation && plan_id.nil?
    fail ArgumentError, "Missing the required parameter 'plan_id' when calling TransactionsApi.get_transactions_by_category"
  end
  # verify the required parameter 'category_id' is set
  if @api_client.config.client_side_validation && category_id.nil?
    fail ArgumentError, "Missing the required parameter 'category_id' when calling TransactionsApi.get_transactions_by_category"
  end
  # resource path
  local_var_path = '/plans/{plan_id}/categories/{category_id}/transactions'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)).sub('{' + 'category_id' + '}', CGI.escape(category_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'since_date'] = opts[:'since_date'] if !opts[:'since_date'].nil?
  query_params[:'until_date'] = opts[:'until_date'] if !opts[:'until_date'].nil?
  query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?
  query_params[:'last_knowledge_of_server'] = opts[:'last_knowledge_of_server'] if !opts[:'last_knowledge_of_server'].nil?

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

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

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

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

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

  new_options = opts.merge(
    :operation => :"TransactionsApi.get_transactions_by_category",
    :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: TransactionsApi#get_transactions_by_category\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_transactions_by_month(plan_id, month, opts = {}) ⇒ TransactionsResponse

Get plan month transactions Returns all transactions for a specified month, excluding any pending transactions

Parameters:

  • plan_id (String)

    The id of the plan. &quot;last-used&quot; can be used to specify the last used plan and &quot;default&quot; can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan).

  • month (String)

    The plan month in ISO format (e.g. 2016-12-01) (&quot;current&quot; can also be used to specify the current calendar month (UTC))

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

    the optional parameters

Options Hash (opts):

  • :since_date (Date)

    If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30).

  • :until_date (Date)

    If specified, only transactions on or before this date will be included. The date should be ISO formatted (e.g. 2016-12-30).

  • :type (String)

    If specified, only transactions of the specified type will be included. &quot;uncategorized&quot; and &quot;unapproved&quot; are currently supported.

  • :last_knowledge_of_server (Integer)

    The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included.

Returns:



477
478
479
480
# File 'lib/ynab/api/transactions_api.rb', line 477

def get_transactions_by_month(plan_id, month, opts = {})
  data, _status_code, _headers = get_transactions_by_month_with_http_info(plan_id, month, opts)
  data
end

#get_transactions_by_month_with_http_info(plan_id, month, opts = {}) ⇒ Array<(TransactionsResponse, Integer, Hash)>

Get plan month transactions Returns all transactions for a specified month, excluding any pending transactions

Parameters:

  • plan_id (String)

    The id of the plan. &quot;last-used&quot; can be used to specify the last used plan and &quot;default&quot; can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan).

  • month (String)

    The plan month in ISO format (e.g. 2016-12-01) (&quot;current&quot; can also be used to specify the current calendar month (UTC))

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

    the optional parameters

Options Hash (opts):

  • :since_date (Date)

    If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30).

  • :until_date (Date)

    If specified, only transactions on or before this date will be included. The date should be ISO formatted (e.g. 2016-12-30).

  • :type (String)

    If specified, only transactions of the specified type will be included. &quot;uncategorized&quot; and &quot;unapproved&quot; are currently supported.

  • :last_knowledge_of_server (Integer)

    The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included.

Returns:

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

    TransactionsResponse data, response status code and response headers



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
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
# File 'lib/ynab/api/transactions_api.rb', line 492

def get_transactions_by_month_with_http_info(plan_id, month, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TransactionsApi.get_transactions_by_month ...'
  end
  # verify the required parameter 'plan_id' is set
  if @api_client.config.client_side_validation && plan_id.nil?
    fail ArgumentError, "Missing the required parameter 'plan_id' when calling TransactionsApi.get_transactions_by_month"
  end
  # verify the required parameter 'month' is set
  if @api_client.config.client_side_validation && month.nil?
    fail ArgumentError, "Missing the required parameter 'month' when calling TransactionsApi.get_transactions_by_month"
  end
  # resource path
  local_var_path = '/plans/{plan_id}/months/{month}/transactions'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)).sub('{' + 'month' + '}', CGI.escape(month.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'since_date'] = opts[:'since_date'] if !opts[:'since_date'].nil?
  query_params[:'until_date'] = opts[:'until_date'] if !opts[:'until_date'].nil?
  query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?
  query_params[:'last_knowledge_of_server'] = opts[:'last_knowledge_of_server'] if !opts[:'last_knowledge_of_server'].nil?

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

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

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

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

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

  new_options = opts.merge(
    :operation => :"TransactionsApi.get_transactions_by_month",
    :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: TransactionsApi#get_transactions_by_month\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_transactions_by_payee(plan_id, payee_id, opts = {}) ⇒ HybridTransactionsResponse

Get payee transactions Returns all transactions for a specified payee, excluding any pending transactions

Parameters:

  • plan_id (String)

    The id of the plan. &quot;last-used&quot; can be used to specify the last used plan and &quot;default&quot; can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan).

  • payee_id (String)

    The id of the payee

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

    the optional parameters

Options Hash (opts):

  • :since_date (Date)

    If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30). Defaults to one year ago when not specified.

  • :until_date (Date)

    If specified, only transactions on or before this date will be included. The date should be ISO formatted (e.g. 2016-12-30).

  • :type (String)

    If specified, only transactions of the specified type will be included. &quot;uncategorized&quot; and &quot;unapproved&quot; are currently supported.

  • :last_knowledge_of_server (Integer)

    The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included.

Returns:



558
559
560
561
# File 'lib/ynab/api/transactions_api.rb', line 558

def get_transactions_by_payee(plan_id, payee_id, opts = {})
  data, _status_code, _headers = get_transactions_by_payee_with_http_info(plan_id, payee_id, opts)
  data
end

#get_transactions_by_payee_with_http_info(plan_id, payee_id, opts = {}) ⇒ Array<(HybridTransactionsResponse, Integer, Hash)>

Get payee transactions Returns all transactions for a specified payee, excluding any pending transactions

Parameters:

  • plan_id (String)

    The id of the plan. &quot;last-used&quot; can be used to specify the last used plan and &quot;default&quot; can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan).

  • payee_id (String)

    The id of the payee

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

    the optional parameters

Options Hash (opts):

  • :since_date (Date)

    If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30). Defaults to one year ago when not specified.

  • :until_date (Date)

    If specified, only transactions on or before this date will be included. The date should be ISO formatted (e.g. 2016-12-30).

  • :type (String)

    If specified, only transactions of the specified type will be included. &quot;uncategorized&quot; and &quot;unapproved&quot; are currently supported.

  • :last_knowledge_of_server (Integer)

    The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included.

Returns:

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

    HybridTransactionsResponse data, response status code and response headers



573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
# File 'lib/ynab/api/transactions_api.rb', line 573

def get_transactions_by_payee_with_http_info(plan_id, payee_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TransactionsApi.get_transactions_by_payee ...'
  end
  # verify the required parameter 'plan_id' is set
  if @api_client.config.client_side_validation && plan_id.nil?
    fail ArgumentError, "Missing the required parameter 'plan_id' when calling TransactionsApi.get_transactions_by_payee"
  end
  # verify the required parameter 'payee_id' is set
  if @api_client.config.client_side_validation && payee_id.nil?
    fail ArgumentError, "Missing the required parameter 'payee_id' when calling TransactionsApi.get_transactions_by_payee"
  end
  # resource path
  local_var_path = '/plans/{plan_id}/payees/{payee_id}/transactions'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)).sub('{' + 'payee_id' + '}', CGI.escape(payee_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'since_date'] = opts[:'since_date'] if !opts[:'since_date'].nil?
  query_params[:'until_date'] = opts[:'until_date'] if !opts[:'until_date'].nil?
  query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?
  query_params[:'last_knowledge_of_server'] = opts[:'last_knowledge_of_server'] if !opts[:'last_knowledge_of_server'].nil?

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

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

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

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

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

  new_options = opts.merge(
    :operation => :"TransactionsApi.get_transactions_by_payee",
    :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: TransactionsApi#get_transactions_by_payee\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_transactions_with_http_info(plan_id, opts = {}) ⇒ Array<(TransactionsResponse, Integer, Hash)>

Get transactions Returns plan transactions, excluding any pending transactions

Parameters:

  • plan_id (String)

    The id of the plan. &quot;last-used&quot; can be used to specify the last used plan and &quot;default&quot; can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan).

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

    the optional parameters

Options Hash (opts):

  • :since_date (Date)

    If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30). Defaults to one year ago when not specified.

  • :until_date (Date)

    If specified, only transactions on or before this date will be included. The date should be ISO formatted (e.g. 2016-12-30).

  • :type (String)

    If specified, only transactions of the specified type will be included. &quot;uncategorized&quot; and &quot;unapproved&quot; are currently supported.

  • :last_knowledge_of_server (Integer)

    The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included.

Returns:

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

    TransactionsResponse data, response status code and response headers



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
# File 'lib/ynab/api/transactions_api.rb', line 253

def get_transactions_with_http_info(plan_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TransactionsApi.get_transactions ...'
  end
  # verify the required parameter 'plan_id' is set
  if @api_client.config.client_side_validation && plan_id.nil?
    fail ArgumentError, "Missing the required parameter 'plan_id' when calling TransactionsApi.get_transactions"
  end
  # resource path
  local_var_path = '/plans/{plan_id}/transactions'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'since_date'] = opts[:'since_date'] if !opts[:'since_date'].nil?
  query_params[:'until_date'] = opts[:'until_date'] if !opts[:'until_date'].nil?
  query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?
  query_params[:'last_knowledge_of_server'] = opts[:'last_knowledge_of_server'] if !opts[:'last_knowledge_of_server'].nil?

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

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

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

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

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

  new_options = opts.merge(
    :operation => :"TransactionsApi.get_transactions",
    :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: TransactionsApi#get_transactions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#import_transactions(plan_id, opts = {}) ⇒ TransactionsImportResponse

Import transactions Imports available transactions on all linked accounts for the given plan. Linked accounts allow transactions to be imported directly from a specified financial institution and this endpoint initiates that import. Sending a request to this endpoint is the equivalent of clicking "Import" on each account in the web application or tapping the "New Transactions" banner in the mobile applications. The response for this endpoint contains the transaction ids that have been imported.

Parameters:

  • plan_id (String)

    The id of the plan. &quot;last-used&quot; can be used to specify the last used plan and &quot;default&quot; can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan).

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

    the optional parameters

Returns:



634
635
636
637
# File 'lib/ynab/api/transactions_api.rb', line 634

def import_transactions(plan_id, opts = {})
  data, _status_code, _headers = import_transactions_with_http_info(plan_id, opts)
  data
end

#import_transactions_with_http_info(plan_id, opts = {}) ⇒ Array<(TransactionsImportResponse, Integer, Hash)>

Import transactions Imports available transactions on all linked accounts for the given plan. Linked accounts allow transactions to be imported directly from a specified financial institution and this endpoint initiates that import. Sending a request to this endpoint is the equivalent of clicking &quot;Import&quot; on each account in the web application or tapping the &quot;New Transactions&quot; banner in the mobile applications. The response for this endpoint contains the transaction ids that have been imported.

Parameters:

  • plan_id (String)

    The id of the plan. &quot;last-used&quot; can be used to specify the last used plan and &quot;default&quot; can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan).

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

    the optional parameters

Returns:

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

    TransactionsImportResponse data, response status code and response headers



644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
# File 'lib/ynab/api/transactions_api.rb', line 644

def import_transactions_with_http_info(plan_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TransactionsApi.import_transactions ...'
  end
  # verify the required parameter 'plan_id' is set
  if @api_client.config.client_side_validation && plan_id.nil?
    fail ArgumentError, "Missing the required parameter 'plan_id' when calling TransactionsApi.import_transactions"
  end
  # resource path
  local_var_path = '/plans/{plan_id}/transactions/import'.sub('{' + 'plan_id' + '}', CGI.escape(plan_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'])

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

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

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

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

  new_options = opts.merge(
    :operation => :"TransactionsApi.import_transactions",
    :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: TransactionsApi#import_transactions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_transaction(plan_id, transaction_id, data, opts = {}) ⇒ TransactionResponse

Update a transaction Updates a single transaction

Parameters:

  • plan_id (String)

    The id of the plan. &quot;last-used&quot; can be used to specify the last used plan and &quot;default&quot; can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan).

  • transaction_id (String)

    The id of the transaction

  • data (PutTransactionWrapper)

    The transaction to update

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

    the optional parameters

Returns:



699
700
701
702
# File 'lib/ynab/api/transactions_api.rb', line 699

def update_transaction(plan_id, transaction_id, data, opts = {})
  data, _status_code, _headers = update_transaction_with_http_info(plan_id, transaction_id, data, opts)
  data
end

#update_transaction_with_http_info(plan_id, transaction_id, data, opts = {}) ⇒ Array<(TransactionResponse, Integer, Hash)>

Update a transaction Updates a single transaction

Parameters:

  • plan_id (String)

    The id of the plan. &quot;last-used&quot; can be used to specify the last used plan and &quot;default&quot; can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan).

  • transaction_id (String)

    The id of the transaction

  • data (PutTransactionWrapper)

    The transaction to update

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

    the optional parameters

Returns:

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

    TransactionResponse data, response status code and response headers



711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
# File 'lib/ynab/api/transactions_api.rb', line 711

def update_transaction_with_http_info(plan_id, transaction_id, data, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TransactionsApi.update_transaction ...'
  end
  # verify the required parameter 'plan_id' is set
  if @api_client.config.client_side_validation && plan_id.nil?
    fail ArgumentError, "Missing the required parameter 'plan_id' when calling TransactionsApi.update_transaction"
  end
  # verify the required parameter 'transaction_id' is set
  if @api_client.config.client_side_validation && transaction_id.nil?
    fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TransactionsApi.update_transaction"
  end
  # verify the required parameter 'data' is set
  if @api_client.config.client_side_validation && data.nil?
    fail ArgumentError, "Missing the required parameter 'data' when calling TransactionsApi.update_transaction"
  end
  # resource path
  local_var_path = '/plans/{plan_id}/transactions/{transaction_id}'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)).sub('{' + 'transaction_id' + '}', CGI.escape(transaction_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'])
  # 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(data)

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

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

  new_options = opts.merge(
    :operation => :"TransactionsApi.update_transaction",
    :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: TransactionsApi#update_transaction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_transactions(plan_id, data, opts = {}) ⇒ SaveTransactionsResponse

Update multiple transactions Updates multiple transactions, by id or import_id.

Parameters:

  • plan_id (String)

    The id of the plan. &quot;last-used&quot; can be used to specify the last used plan and &quot;default&quot; can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan).

  • data (PatchTransactionsWrapper)

    The transactions to update. Each transaction must have either an `id` or `import_id` specified. If `id` is specified as null an `import_id` value can be provided which will allow transaction(s) to be updated by its `import_id`. If an `id` is specified, it will always be used for lookup. You should not specify both `id` and `import_id`. Updating an `import_id` on an existing transaction is not allowed; if an `import_id` is specified, it will only be used to lookup the transaction.

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

    the optional parameters

Returns:



778
779
780
781
# File 'lib/ynab/api/transactions_api.rb', line 778

def update_transactions(plan_id, data, opts = {})
  data, _status_code, _headers = update_transactions_with_http_info(plan_id, data, opts)
  data
end

#update_transactions_with_http_info(plan_id, data, opts = {}) ⇒ Array<(SaveTransactionsResponse, Integer, Hash)>

Update multiple transactions Updates multiple transactions, by `id` or `import_id`.

Parameters:

  • plan_id (String)

    The id of the plan. &quot;last-used&quot; can be used to specify the last used plan and &quot;default&quot; can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan).

  • data (PatchTransactionsWrapper)

    The transactions to update. Each transaction must have either an `id` or `import_id` specified. If `id` is specified as null an `import_id` value can be provided which will allow transaction(s) to be updated by its `import_id`. If an `id` is specified, it will always be used for lookup. You should not specify both `id` and `import_id`. Updating an `import_id` on an existing transaction is not allowed; if an `import_id` is specified, it will only be used to lookup the transaction.

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

    the optional parameters

Returns:

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

    SaveTransactionsResponse data, response status code and response headers



789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
# File 'lib/ynab/api/transactions_api.rb', line 789

def update_transactions_with_http_info(plan_id, data, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TransactionsApi.update_transactions ...'
  end
  # verify the required parameter 'plan_id' is set
  if @api_client.config.client_side_validation && plan_id.nil?
    fail ArgumentError, "Missing the required parameter 'plan_id' when calling TransactionsApi.update_transactions"
  end
  # verify the required parameter 'data' is set
  if @api_client.config.client_side_validation && data.nil?
    fail ArgumentError, "Missing the required parameter 'data' when calling TransactionsApi.update_transactions"
  end
  # resource path
  local_var_path = '/plans/{plan_id}/transactions'.sub('{' + 'plan_id' + '}', CGI.escape(plan_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'])
  # 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(data)

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

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

  new_options = opts.merge(
    :operation => :"TransactionsApi.update_transactions",
    :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(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TransactionsApi#update_transactions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end