Method: YNAB::CategoriesApi#update_month_category_with_http_info

Defined in:
lib/ynab/api/categories_api.rb

#update_month_category_with_http_info(budget_id, month, category_id, data, opts = {}) ⇒ Array<(SaveCategoryResponse, Integer, Hash)>

Update a category for a specific month Update a category for a specific month. Only &#x60;budgeted&#x60; amount can be updated.

Parameters:

  • budget_id (String)

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

  • month (Date)

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

  • category_id (String)

    The id of the category

  • data (PatchMonthCategoryWrapper)

    The category to update. Only &#x60;budgeted&#x60; amount can be updated and any other fields specified will be ignored.

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

    the optional parameters

Returns:

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

    SaveCategoryResponse 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
385
386
387
388
389
390
391
392
393
# File 'lib/ynab/api/categories_api.rb', line 330

def update_month_category_with_http_info(budget_id, month, category_id, data, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CategoriesApi.update_month_category ...'
  end
  # verify the required parameter 'budget_id' is set
  if @api_client.config.client_side_validation && budget_id.nil?
    fail ArgumentError, "Missing the required parameter 'budget_id' when calling CategoriesApi.update_month_category"
  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 CategoriesApi.update_month_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 CategoriesApi.update_month_category"
  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 CategoriesApi.update_month_category"
  end
  # resource path
  local_var_path = '/budgets/{budget_id}/months/{month}/categories/{category_id}'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)).sub('{' + 'month' + '}', CGI.escape(month.to_s)).sub('{' + 'category_id' + '}', CGI.escape(category_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] || 'SaveCategoryResponse'

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

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