Class: YNAB::CategoriesApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ CategoriesApi

Returns a new instance of CategoriesApi.



15
16
17
# File 'lib/ynab/api/categories_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/categories_api.rb', line 13

def api_client
  @api_client
end

Instance Method Details

#create_category(plan_id, data, opts = {}) ⇒ SaveCategoryResponse

Create a category Creates a new category

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: api.ynab.com/#oauth-default-plan)

  • data (PostCategoryWrapper)

    The category to create.

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

    the optional parameters

Returns:



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

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

#create_category_group(plan_id, data, opts = {}) ⇒ SaveCategoryGroupResponse

Create a category group Creates a new category group

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: api.ynab.com/#oauth-default-plan)

  • data (PostCategoryGroupWrapper)

    The category group to create.

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

    the optional parameters

Returns:



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

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

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

Create a category group Creates a new category group

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: api.ynab.com/#oauth-default-plan)

  • data (PostCategoryGroupWrapper)

    The category group to create.

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

    the optional parameters

Returns:

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

    SaveCategoryGroupResponse 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
160
161
162
163
164
# File 'lib/ynab/api/categories_api.rb', line 109

def create_category_group_with_http_info(plan_id, data, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CategoriesApi.create_category_group ...'
  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 CategoriesApi.create_category_group"
  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.create_category_group"
  end
  # resource path
  local_var_path = '/plans/{plan_id}/category_groups'.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] || 'SaveCategoryGroupResponse'

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

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

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

Create a category Creates a new category

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: api.ynab.com/#oauth-default-plan)

  • data (PostCategoryWrapper)

    The category to create.

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

    the optional parameters

Returns:

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

    SaveCategoryResponse 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/categories_api.rb', line 35

def create_category_with_http_info(plan_id, data, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CategoriesApi.create_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 CategoriesApi.create_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.create_category"
  end
  # resource path
  local_var_path = '/plans/{plan_id}/categories'.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] || 'SaveCategoryResponse'

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

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

#get_categories(plan_id, opts = {}) ⇒ CategoriesResponse

Get all categories Returns all categories grouped by category group. Amounts (assigned, activity, available, etc.) are specific to the current plan month (UTC).

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: api.ynab.com/#oauth-default-plan).

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

    the optional parameters

Options Hash (opts):

  • :last_knowledge_of_server (Integer)

    The starting server knowledge. If provided, only entities that have changed since &#x60;last_knowledge_of_server&#x60; will be included.

Returns:



172
173
174
175
# File 'lib/ynab/api/categories_api.rb', line 172

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

#get_categories_with_http_info(plan_id, opts = {}) ⇒ Array<(CategoriesResponse, Integer, Hash)>

Get all categories Returns all categories grouped by category group. Amounts (assigned, activity, available, etc.) are specific to the current plan month (UTC).

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: api.ynab.com/#oauth-default-plan).

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

    the optional parameters

Options Hash (opts):

  • :last_knowledge_of_server (Integer)

    The starting server knowledge. If provided, only entities that have changed since &#x60;last_knowledge_of_server&#x60; will be included.

Returns:

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

    CategoriesResponse data, response status code and response headers



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
229
230
# File 'lib/ynab/api/categories_api.rb', line 183

def get_categories_with_http_info(plan_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CategoriesApi.get_categories ...'
  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 CategoriesApi.get_categories"
  end
  # resource path
  local_var_path = '/plans/{plan_id}/categories'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  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] || 'CategoriesResponse'

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

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

#get_category_by_id(plan_id, category_id, opts = {}) ⇒ CategoryResponse

Get a category Returns a single category. Amounts (assigned, activity, available, etc.) are specific to the current plan month (UTC).

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: api.ynab.com/#oauth-default-plan).

  • category_id (String)

    The id of the category

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

    the optional parameters

Returns:



238
239
240
241
# File 'lib/ynab/api/categories_api.rb', line 238

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

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

Get a category Returns a single category. Amounts (assigned, activity, available, etc.) are specific to the current plan month (UTC).

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: api.ynab.com/#oauth-default-plan).

  • category_id (String)

    The id of the category

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

    the optional parameters

Returns:

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

    CategoryResponse data, response status code and response headers



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

def get_category_by_id_with_http_info(plan_id, category_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CategoriesApi.get_category_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 CategoriesApi.get_category_by_id"
  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.get_category_by_id"
  end
  # resource path
  local_var_path = '/plans/{plan_id}/categories/{category_id}'.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] || {}

  # 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] || 'CategoryResponse'

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

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

#get_month_category_by_id(plan_id, month, category_id, opts = {}) ⇒ CategoryResponse

Get a category for a specific plan month Returns a single category for a specific plan month. Amounts (assigned, activity, available, etc.) are specific to the current plan month (UTC).

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: api.ynab.com/#oauth-default-plan).

  • month (Date)

    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))

  • category_id (String)

    The id of the category

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

    the optional parameters

Returns:



308
309
310
311
# File 'lib/ynab/api/categories_api.rb', line 308

def get_month_category_by_id(plan_id, month, category_id, opts = {})
  data, _status_code, _headers = get_month_category_by_id_with_http_info(plan_id, month, category_id, opts)
  data
end

#get_month_category_by_id_with_http_info(plan_id, month, category_id, opts = {}) ⇒ Array<(CategoryResponse, Integer, Hash)>

Get a category for a specific plan month Returns a single category for a specific plan month. Amounts (assigned, activity, available, etc.) are specific to the current plan month (UTC).

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: api.ynab.com/#oauth-default-plan).

  • month (Date)

    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))

  • category_id (String)

    The id of the category

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

    the optional parameters

Returns:

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

    CategoryResponse data, response status code and response headers



320
321
322
323
324
325
326
327
328
329
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
# File 'lib/ynab/api/categories_api.rb', line 320

def get_month_category_by_id_with_http_info(plan_id, month, category_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CategoriesApi.get_month_category_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 CategoriesApi.get_month_category_by_id"
  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.get_month_category_by_id"
  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.get_month_category_by_id"
  end
  # resource path
  local_var_path = '/plans/{plan_id}/months/{month}/categories/{category_id}'.sub('{' + 'plan_id' + '}', CGI.escape(plan_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'])

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

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

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

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

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

#update_category(plan_id, category_id, data, opts = {}) ⇒ SaveCategoryResponse

Update a category Update a category

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: api.ynab.com/#oauth-default-plan).

  • category_id (String)

    The id of the category

  • data (PatchCategoryWrapper)

    The category to update

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

    the optional parameters

Returns:



383
384
385
386
# File 'lib/ynab/api/categories_api.rb', line 383

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

#update_category_group(plan_id, category_group_id, data, opts = {}) ⇒ SaveCategoryGroupResponse

Update a category group Update a category group

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: api.ynab.com/#oauth-default-plan).

  • category_group_id (String)

    The id of the category group

  • data (PatchCategoryGroupWrapper)

    The category group to update

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

    the optional parameters

Returns:



463
464
465
466
# File 'lib/ynab/api/categories_api.rb', line 463

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

#update_category_group_with_http_info(plan_id, category_group_id, data, opts = {}) ⇒ Array<(SaveCategoryGroupResponse, Integer, Hash)>

Update a category group Update a category group

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: api.ynab.com/#oauth-default-plan).

  • category_group_id (String)

    The id of the category group

  • data (PatchCategoryGroupWrapper)

    The category group to update

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

    the optional parameters

Returns:

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

    SaveCategoryGroupResponse data, response status code and response headers



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
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
# File 'lib/ynab/api/categories_api.rb', line 475

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

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

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

#update_category_with_http_info(plan_id, category_id, data, opts = {}) ⇒ Array<(SaveCategoryResponse, Integer, Hash)>

Update a category Update a category

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: api.ynab.com/#oauth-default-plan).

  • category_id (String)

    The id of the category

  • data (PatchCategoryWrapper)

    The category to update

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

    the optional parameters

Returns:

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

    SaveCategoryResponse data, response status code and response headers



395
396
397
398
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
451
452
453
454
# File 'lib/ynab/api/categories_api.rb', line 395

def update_category_with_http_info(plan_id, category_id, data, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CategoriesApi.update_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 CategoriesApi.update_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_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_category"
  end
  # resource path
  local_var_path = '/plans/{plan_id}/categories/{category_id}'.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] || {}

  # 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_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_category\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_month_category(plan_id, month, category_id, data, opts = {}) ⇒ SaveCategoryResponse

Update a category for a specific month Update a category for a specific month. Only ‘budgeted` (assigned) amount can be updated.

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: api.ynab.com/#oauth-default-plan).

  • month (Date)

    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))

  • category_id (String)

    The id of the category

  • data (PatchMonthCategoryWrapper)

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

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

    the optional parameters

Returns:



544
545
546
547
# File 'lib/ynab/api/categories_api.rb', line 544

def update_month_category(plan_id, month, category_id, data, opts = {})
  data, _status_code, _headers = update_month_category_with_http_info(plan_id, month, category_id, data, opts)
  data
end

#update_month_category_with_http_info(plan_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; (assigned) amount can be updated.

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: api.ynab.com/#oauth-default-plan).

  • month (Date)

    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))

  • category_id (String)

    The id of the category

  • data (PatchMonthCategoryWrapper)

    The category to update. Only &#x60;budgeted&#x60; (assigned) 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



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

def update_month_category_with_http_info(plan_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 'plan_id' is set
  if @api_client.config.client_side_validation && plan_id.nil?
    fail ArgumentError, "Missing the required parameter 'plan_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 = '/plans/{plan_id}/months/{month}/categories/{category_id}'.sub('{' + 'plan_id' + '}', CGI.escape(plan_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