Class: ModernTreasury::LedgerAccountCategoryController
- Inherits:
-
BaseController
- Object
- BaseController
- ModernTreasury::LedgerAccountCategoryController
- Defined in:
- lib/modern_treasury/controllers/ledger_account_category_controller.rb
Overview
LedgerAccountCategoryController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#add_ledger_account_category_to_ledger_account_category(id, sub_category_id) ⇒ ApiResponse
Add a ledger account category to a ledger account category.
-
#add_ledger_account_to_ledger_account_category(id, ledger_account_id) ⇒ ApiResponse
Add a ledger account to a ledger account category.
-
#create_ledger_account_category(idempotency_key: nil, body: nil) ⇒ ApiResponse
Create a ledger account category.
-
#delete_ledger_account_category(id) ⇒ ApiResponse
Delete a ledger account category.
-
#delete_ledger_account_category_from_ledger_account_category(id, sub_category_id) ⇒ ApiResponse
Delete a ledger account category from a ledger account category.
-
#get_ledger_account_category(id, balances: nil) ⇒ ApiResponse
Get the details on a single ledger account category.
-
#list_ledger_account_categories(after_cursor: nil, per_page: nil, metadata: nil, name: nil, ledger_id: nil, parent_ledger_account_category_id: nil, ledger_account_id: nil, balances: nil) ⇒ ApiResponse
Get a list of ledger account categories.
-
#remove_ledger_account_from_ledger_account_category(id, ledger_account_id) ⇒ ApiResponse
Remove a ledger account from a ledger account category.
-
#update_ledger_account_category(id, body: nil) ⇒ ApiResponse
Update the details of a ledger account category.
Methods inherited from BaseController
#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters
Constructor Details
This class inherits a constructor from ModernTreasury::BaseController
Instance Method Details
#add_ledger_account_category_to_ledger_account_category(id, sub_category_id) ⇒ ApiResponse
Add a ledger account category to a ledger account category.
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 |
# File 'lib/modern_treasury/controllers/ledger_account_category_controller.rb', line 252 def add_ledger_account_category_to_ledger_account_category(id, sub_category_id) @api_call .request(new_request_builder(HttpMethodEnum::PUT, '/api/ledger_account_categories/{id}/ledger_account_categories/{sub_category_id}', Server::DEFAULT) .template_param(new_parameter(id, key: 'id') .is_required(true) .should_encode(true)) .template_param(new_parameter(sub_category_id, key: 'sub_category_id') .is_required(true) .should_encode(true)) .auth(Single.new('basic_auth'))) .response(new_response_handler .is_response_void(true) .is_api_response(true) .local_error('403', 'forbidden', ErrorMessageException) .local_error('404', 'not found', ErrorMessageException) .local_error('422', 'unsuccessful', ErrorMessageException)) .execute end |
#add_ledger_account_to_ledger_account_category(id, ledger_account_id) ⇒ ApiResponse
Add a ledger account to a ledger account category.
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 |
# File 'lib/modern_treasury/controllers/ledger_account_category_controller.rb', line 188 def add_ledger_account_to_ledger_account_category(id, ledger_account_id) @api_call .request(new_request_builder(HttpMethodEnum::PUT, '/api/ledger_account_categories/{id}/ledger_accounts/{ledger_account_id}', Server::DEFAULT) .template_param(new_parameter(id, key: 'id') .is_required(true) .should_encode(true)) .template_param(new_parameter(ledger_account_id, key: 'ledger_account_id') .is_required(true) .should_encode(true)) .auth(Single.new('basic_auth'))) .response(new_response_handler .is_response_void(true) .is_api_response(true) .local_error('403', 'forbidden', ErrorMessageException) .local_error('404', 'not found', ErrorMessageException) .local_error('422', 'unsuccessful', ErrorMessageException)) .execute end |
#create_ledger_account_category(idempotency_key: nil, body: nil) ⇒ ApiResponse
Create a ledger account category. something unique, preferably something like an UUID. type description here
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/modern_treasury/controllers/ledger_account_category_controller.rb', line 66 def create_ledger_account_category(idempotency_key: nil, body: nil) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/api/ledger_account_categories', Server::DEFAULT) .header_param(new_parameter('application/json', key: 'Content-Type')) .header_param(new_parameter(idempotency_key, key: 'Idempotency-Key')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('basic_auth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(LedgerAccountCategory.method(:from_hash)) .is_api_response(true) .local_error('403', 'forbidden', ErrorMessageException) .local_error('422', 'unsuccessful', ErrorMessageException)) .execute end |
#delete_ledger_account_category(id) ⇒ ApiResponse
Delete a ledger account category.
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/modern_treasury/controllers/ledger_account_category_controller.rb', line 161 def delete_ledger_account_category(id) @api_call .request(new_request_builder(HttpMethodEnum::DELETE, '/api/ledger_account_categories/{id}', Server::DEFAULT) .template_param(new_parameter(id, key: 'id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('basic_auth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(LedgerAccountCategory.method(:from_hash)) .is_api_response(true) .local_error('403', 'forbidden', ErrorMessageException) .local_error('404', 'not found', ErrorMessageException)) .execute end |
#delete_ledger_account_category_from_ledger_account_category(id, sub_category_id) ⇒ ApiResponse
Delete a ledger account category from a ledger account category.
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
# File 'lib/modern_treasury/controllers/ledger_account_category_controller.rb', line 284 def delete_ledger_account_category_from_ledger_account_category(id, sub_category_id) @api_call .request(new_request_builder(HttpMethodEnum::DELETE, '/api/ledger_account_categories/{id}/ledger_account_categories/{sub_category_id}', Server::DEFAULT) .template_param(new_parameter(id, key: 'id') .is_required(true) .should_encode(true)) .template_param(new_parameter(sub_category_id, key: 'sub_category_id') .is_required(true) .should_encode(true)) .auth(Single.new('basic_auth'))) .response(new_response_handler .is_response_void(true) .is_api_response(true) .local_error('403', 'forbidden', ErrorMessageException) .local_error('404', 'not found', ErrorMessageException) .local_error('422', 'unsuccessful', ErrorMessageException)) .execute end |
#get_ledger_account_category(id, balances: nil) ⇒ ApiResponse
Get the details on a single ledger account category. the balances as of a particular time (ISO8601), the encoded query string would be ‘balances%5Beffective_at%5D=2000-12-31T12:00:00Z`. The balances as of a time are inclusive of entries with that exact time.
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/modern_treasury/controllers/ledger_account_category_controller.rb', line 98 def get_ledger_account_category(id, balances: nil) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/api/ledger_account_categories/{id}', Server::DEFAULT) .template_param(new_parameter(id, key: 'id') .is_required(true) .should_encode(true)) .query_param(new_parameter(balances, key: 'balances')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('basic_auth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(LedgerAccountCategory.method(:from_hash)) .is_api_response(true) .local_error('404', 'not found', ErrorMessageException) .local_error('422', 'unsuccessful', ErrorMessageException)) .execute end |
#list_ledger_account_categories(after_cursor: nil, per_page: nil, metadata: nil, name: nil, ledger_id: nil, parent_ledger_account_category_id: nil, ledger_account_id: nil, balances: nil) ⇒ ApiResponse
Get a list of ledger account categories. here here you want to query for records with metadata key ‘Type` and value `Loan`, the query would be `metadata%5BType%5D=Loan`. This encodes the query parameters. here Query categories that are nested underneath a parent category which contain a ledger account directly or through child categories. the balances as of a particular time (ISO8601), the encoded query string would be `balances%5Beffective_at%5D=2000-12-31T12:00:00Z`. The balances as of a time are inclusive of entries with that exact time.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/modern_treasury/controllers/ledger_account_category_controller.rb', line 30 def list_ledger_account_categories(after_cursor: nil, per_page: nil, metadata: nil, name: nil, ledger_id: nil, parent_ledger_account_category_id: nil, ledger_account_id: nil, balances: nil) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/api/ledger_account_categories', Server::DEFAULT) .query_param(new_parameter(after_cursor, key: 'after_cursor')) .query_param(new_parameter(per_page, key: 'per_page')) .query_param(new_parameter(, key: 'metadata')) .query_param(new_parameter(name, key: 'name')) .query_param(new_parameter(ledger_id, key: 'ledger_id')) .query_param(new_parameter(parent_ledger_account_category_id, key: 'parent_ledger_account_category_id')) .query_param(new_parameter(ledger_account_id, key: 'ledger_account_id')) .query_param(new_parameter(balances, key: 'balances')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('basic_auth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(LedgerAccountCategory.method(:from_hash)) .is_api_response(true) .is_response_array(true)) .execute end |
#remove_ledger_account_from_ledger_account_category(id, ledger_account_id) ⇒ ApiResponse
Remove a ledger account from a ledger account category.
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
# File 'lib/modern_treasury/controllers/ledger_account_category_controller.rb', line 220 def remove_ledger_account_from_ledger_account_category(id, ledger_account_id) @api_call .request(new_request_builder(HttpMethodEnum::DELETE, '/api/ledger_account_categories/{id}/ledger_accounts/{ledger_account_id}', Server::DEFAULT) .template_param(new_parameter(id, key: 'id') .is_required(true) .should_encode(true)) .template_param(new_parameter(ledger_account_id, key: 'ledger_account_id') .is_required(true) .should_encode(true)) .auth(Single.new('basic_auth'))) .response(new_response_handler .is_response_void(true) .is_api_response(true) .local_error('403', 'forbidden', ErrorMessageException) .local_error('404', 'not found', ErrorMessageException) .local_error('422', 'unsuccessful', ErrorMessageException)) .execute end |
#update_ledger_account_category(id, body: nil) ⇒ ApiResponse
Update the details of a ledger account category. type description here
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 |
# File 'lib/modern_treasury/controllers/ledger_account_category_controller.rb', line 128 def update_ledger_account_category(id, body: nil) @api_call .request(new_request_builder(HttpMethodEnum::PATCH, '/api/ledger_account_categories/{id}', Server::DEFAULT) .template_param(new_parameter(id, key: 'id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('basic_auth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(LedgerAccountCategory.method(:from_hash)) .is_api_response(true) .local_error('403', 'forbidden', ErrorMessageException) .local_error('404', 'not found', ErrorMessageException) .local_error('422', 'unsuccessful', ErrorMessageException)) .execute end |