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) ⇒ void
Add a ledger account category to a ledger account category.
-
#add_ledger_account_to_ledger_account_category(id, ledger_account_id) ⇒ void
Add a ledger account to a ledger account category.
-
#create_ledger_account_category(idempotency_key: nil, body: nil) ⇒ LedgerAccountCategory
Create a ledger account category.
-
#delete_ledger_account_category(id) ⇒ LedgerAccountCategory
Delete a ledger account category.
-
#delete_ledger_account_category_from_ledger_account_category(id, sub_category_id) ⇒ void
Delete a ledger account category from a ledger account category.
-
#get_ledger_account_category(id, balances: nil) ⇒ LedgerAccountCategory
Get the details on a single ledger account category.
-
#list_ledger_account_categories(per_page: nil, metadata: nil, name: nil, ledger_id: nil, parent_ledger_account_category_id: nil, ledger_account_id: nil, balances: nil, after_cursor: nil) ⇒ Array[LedgerAccountCategory]
Get a list of ledger account categories.
-
#remove_ledger_account_from_ledger_account_category(id, ledger_account_id) ⇒ void
Remove a ledger account from a ledger account category.
-
#update_ledger_account_category(id, body: nil) ⇒ LedgerAccountCategory
Update the details of a ledger account category.
Methods inherited from BaseController
#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent
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) ⇒ void
This method returns an undefined value.
Add a ledger account category to a ledger account category.
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 |
# File 'lib/modern_treasury/controllers/ledger_account_category_controller.rb', line 238 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') .should_encode(true)) .template_param(new_parameter(sub_category_id, key: 'sub_category_id') .should_encode(true)) .auth(Single.new('basic_auth'))) .response(new_response_handler .is_response_void(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) ⇒ void
This method returns an undefined value.
Add a ledger account to a ledger account category.
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
# File 'lib/modern_treasury/controllers/ledger_account_category_controller.rb', line 180 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') .should_encode(true)) .template_param(new_parameter(ledger_account_id, key: 'ledger_account_id') .should_encode(true)) .auth(Single.new('basic_auth'))) .response(new_response_handler .is_response_void(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) ⇒ LedgerAccountCategory
Create a ledger account category. something unique, preferably something like an UUID. type description here
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/modern_treasury/controllers/ledger_account_category_controller.rb', line 65 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)) .local_error('403', 'forbidden', ErrorMessageException) .local_error('422', 'unsuccessful', ErrorMessageException)) .execute end |
#delete_ledger_account_category(id) ⇒ LedgerAccountCategory
Delete a ledger account category.
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/modern_treasury/controllers/ledger_account_category_controller.rb', line 155 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') .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)) .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) ⇒ void
This method returns an undefined value.
Delete a ledger account category from a ledger account category.
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 |
# File 'lib/modern_treasury/controllers/ledger_account_category_controller.rb', line 267 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') .should_encode(true)) .template_param(new_parameter(sub_category_id, key: 'sub_category_id') .should_encode(true)) .auth(Single.new('basic_auth'))) .response(new_response_handler .is_response_void(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) ⇒ LedgerAccountCategory
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.
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/modern_treasury/controllers/ledger_account_category_controller.rb', line 96 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') .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)) .local_error('404', 'not found', ErrorMessageException) .local_error('422', 'unsuccessful', ErrorMessageException)) .execute end |
#list_ledger_account_categories(per_page: nil, metadata: nil, name: nil, ledger_id: nil, parent_ledger_account_category_id: nil, ledger_account_id: nil, balances: nil, after_cursor: nil) ⇒ Array[LedgerAccountCategory]
Get a list of ledger account categories. 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. here
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 |
# File 'lib/modern_treasury/controllers/ledger_account_category_controller.rb', line 30 def list_ledger_account_categories(per_page: nil, metadata: nil, name: nil, ledger_id: nil, parent_ledger_account_category_id: nil, ledger_account_id: nil, balances: nil, after_cursor: nil) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/api/ledger_account_categories', Server::DEFAULT) .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')) .query_param(new_parameter(after_cursor, key: 'after_cursor')) .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_response_array(true)) .execute end |
#remove_ledger_account_from_ledger_account_category(id, ledger_account_id) ⇒ void
This method returns an undefined value.
Remove a ledger account from a ledger account category.
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
# File 'lib/modern_treasury/controllers/ledger_account_category_controller.rb', line 209 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') .should_encode(true)) .template_param(new_parameter(ledger_account_id, key: 'ledger_account_id') .should_encode(true)) .auth(Single.new('basic_auth'))) .response(new_response_handler .is_response_void(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) ⇒ LedgerAccountCategory
Update the details of a ledger account category. type description here
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 |
# File 'lib/modern_treasury/controllers/ledger_account_category_controller.rb', line 124 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') .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)) .local_error('403', 'forbidden', ErrorMessageException) .local_error('404', 'not found', ErrorMessageException) .local_error('422', 'unsuccessful', ErrorMessageException)) .execute end |