Class: UpBankingClient::CategoriesApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ CategoriesApi



19
20
21
# File 'lib/up_banking/api/categories_api.rb', line 19

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/up_banking/api/categories_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#categories_get(opts = {}) ⇒ ListCategoriesResponse

List categories Retrieve a list of all categories and their ancestry. The returned list is not paginated.

Options Hash (opts):

  • :filter_parent (String)

    The unique identifier of a parent category for which to return only its children. Providing an invalid category identifier results in a `404` response.



27
28
29
30
# File 'lib/up_banking/api/categories_api.rb', line 27

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

#categories_get_with_http_info(opts = {}) ⇒ Array<(ListCategoriesResponse, Integer, Hash)>

List categories Retrieve a list of all categories and their ancestry. The returned list is not paginated.

Options Hash (opts):

  • :filter_parent (String)

    The unique identifier of a parent category for which to return only its children. Providing an invalid category identifier results in a &#x60;404&#x60; response.



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

def categories_get_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CategoriesApi.categories_get ...'
  end
  # resource path
  local_var_path = '/categories'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'filter[parent]'] = opts[:'filter_parent'] if !opts[:'filter_parent'].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] || 'ListCategoriesResponse'

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

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

#categories_id_get(id, opts = {}) ⇒ GetCategoryResponse

Retrieve category Retrieve a specific category by providing its unique identifier.



87
88
89
90
# File 'lib/up_banking/api/categories_api.rb', line 87

def categories_id_get(id, opts = {})
  data, _status_code, _headers = categories_id_get_with_http_info(id, opts)
  data
end

#categories_id_get_with_http_info(id, opts = {}) ⇒ Array<(GetCategoryResponse, Integer, Hash)>

Retrieve category Retrieve a specific category by providing its unique identifier.



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/up_banking/api/categories_api.rb', line 97

def categories_id_get_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CategoriesApi.categories_id_get ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling CategoriesApi.categories_id_get"
  end
  # resource path
  local_var_path = '/categories/{id}'.sub('{' + 'id' + '}', CGI.escape(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] || 'GetCategoryResponse'

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

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

#transactions_transaction_id_relationships_category_patch(transaction_id, opts = {}) ⇒ nil

Categorize transaction Updates the category associated with a transaction. Only transactions for which isCategorizable is set to true support this operation. The id is taken from the list exposed on /categories and cannot be one of the top-level (parent) categories. To de-categorize a transaction, set the entire data key to null. An HTTP 204 is returned on success. The associated category, along with its request URL is also exposed via the category relationship on the transaction resource returned from ‘/transactions/id`.

Options Hash (opts):



151
152
153
154
# File 'lib/up_banking/api/categories_api.rb', line 151

def transactions_transaction_id_relationships_category_patch(transaction_id, opts = {})
  transactions_transaction_id_relationships_category_patch_with_http_info(transaction_id, opts)
  nil
end

#transactions_transaction_id_relationships_category_patch_with_http_info(transaction_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Categorize transaction Updates the category associated with a transaction. Only transactions for which &#x60;isCategorizable&#x60; is set to true support this operation. The &#x60;id&#x60; is taken from the list exposed on &#x60;/categories&#x60; and cannot be one of the top-level (parent) categories. To de-categorize a transaction, set the entire &#x60;data&#x60; key to &#x60;null&#x60;. An HTTP &#x60;204&#x60; is returned on success. The associated category, along with its request URL is also exposed via the &#x60;category&#x60; relationship on the transaction resource returned from &#x60;/transactions/id&#x60;.

Options Hash (opts):



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

def transactions_transaction_id_relationships_category_patch_with_http_info(transaction_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CategoriesApi.transactions_transaction_id_relationships_category_patch ...'
  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 CategoriesApi.transactions_transaction_id_relationships_category_patch"
  end
  # resource path
  local_var_path = '/transactions/{transactionId}/relationships/category'.sub('{' + 'transactionId' + '}', CGI.escape(transaction_id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # 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(opts[:'update_transaction_category_request'])

  # return_type
  return_type = opts[:debug_return_type]

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

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