Class: ModernTreasury::Resources::LedgerAccountCategories
- Inherits:
-
Object
- Object
- ModernTreasury::Resources::LedgerAccountCategories
- Defined in:
- lib/modern_treasury/resources/ledger_account_categories.rb
Instance Method Summary collapse
-
#add_ledger_account(ledger_account_id, id: , request_options: {}) ⇒ nil
Add a ledger account to a ledger account category.
-
#add_nested_category(sub_category_id, id: , request_options: {}) ⇒ nil
Add a ledger account category to a ledger account category.
-
#create(currency: , ledger_id: , name: , normal_balance: , currency_exponent: nil, description: nil, ledger_account_category_ids: nil, metadata: nil, request_options: {}) ⇒ ModernTreasury::Models::LedgerAccountCategory
Some parameter documentations has been truncated, see Models::LedgerAccountCategoryCreateParams for more details.
-
#delete(id, request_options: {}) ⇒ ModernTreasury::Models::LedgerAccountCategory
Delete a ledger account category.
-
#initialize(client:) ⇒ LedgerAccountCategories
constructor
private
A new instance of LedgerAccountCategories.
-
#list(id: nil, after_cursor: nil, balances: nil, currency: nil, external_id: nil, ledger_account_id: nil, ledger_id: nil, metadata: nil, name: nil, parent_ledger_account_category_id: nil, per_page: nil, request_options: {}) ⇒ ModernTreasury::Internal::Page<ModernTreasury::Models::LedgerAccountCategory>
Some parameter documentations has been truncated, see Models::LedgerAccountCategoryListParams for more details.
-
#remove_ledger_account(ledger_account_id, id: , request_options: {}) ⇒ nil
Remove a ledger account from a ledger account category.
-
#remove_nested_category(sub_category_id, id: , request_options: {}) ⇒ nil
Delete a ledger account category from a ledger account category.
-
#retrieve(id, balances: nil, request_options: {}) ⇒ ModernTreasury::Models::LedgerAccountCategory
Some parameter documentations has been truncated, see Models::LedgerAccountCategoryRetrieveParams for more details.
-
#update(id, description: nil, metadata: nil, name: nil, request_options: {}) ⇒ ModernTreasury::Models::LedgerAccountCategory
Some parameter documentations has been truncated, see Models::LedgerAccountCategoryUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ LedgerAccountCategories
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of LedgerAccountCategories.
280 281 282 |
# File 'lib/modern_treasury/resources/ledger_account_categories.rb', line 280 def initialize(client:) @client = client end |
Instance Method Details
#add_ledger_account(ledger_account_id, id: , request_options: {}) ⇒ nil
Add a ledger account to a ledger account category.
182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/modern_treasury/resources/ledger_account_categories.rb', line 182 def add_ledger_account(ledger_account_id, params) parsed, = ModernTreasury::LedgerAccountCategoryAddLedgerAccountParams.dump_request(params) id = parsed.delete(:id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :put, path: ["api/ledger_account_categories/%1$s/ledger_accounts/%2$s", id, ledger_account_id], model: NilClass, options: ) end |
#add_nested_category(sub_category_id, id: , request_options: {}) ⇒ nil
Add a ledger account category to a ledger account category.
209 210 211 212 213 214 215 216 217 218 219 220 221 |
# File 'lib/modern_treasury/resources/ledger_account_categories.rb', line 209 def add_nested_category(sub_category_id, params) parsed, = ModernTreasury::LedgerAccountCategoryAddNestedCategoryParams.dump_request(params) id = parsed.delete(:id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :put, path: ["api/ledger_account_categories/%1$s/ledger_account_categories/%2$s", id, sub_category_id], model: NilClass, options: ) end |
#create(currency: , ledger_id: , name: , normal_balance: , currency_exponent: nil, description: nil, ledger_account_category_ids: nil, metadata: nil, request_options: {}) ⇒ ModernTreasury::Models::LedgerAccountCategory
Some parameter documentations has been truncated, see Models::LedgerAccountCategoryCreateParams for more details.
Create a ledger account category.
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/modern_treasury/resources/ledger_account_categories.rb', line 34 def create(params) parsed, = ModernTreasury::LedgerAccountCategoryCreateParams.dump_request(params) @client.request( method: :post, path: "api/ledger_account_categories", body: parsed, model: ModernTreasury::LedgerAccountCategory, options: ) end |
#delete(id, request_options: {}) ⇒ ModernTreasury::Models::LedgerAccountCategory
Delete a ledger account category.
160 161 162 163 164 165 166 167 |
# File 'lib/modern_treasury/resources/ledger_account_categories.rb', line 160 def delete(id, params = {}) @client.request( method: :delete, path: ["api/ledger_account_categories/%1$s", id], model: ModernTreasury::LedgerAccountCategory, options: params[:request_options] ) end |
#list(id: nil, after_cursor: nil, balances: nil, currency: nil, external_id: nil, ledger_account_id: nil, ledger_id: nil, metadata: nil, name: nil, parent_ledger_account_category_id: nil, per_page: nil, request_options: {}) ⇒ ModernTreasury::Internal::Page<ModernTreasury::Models::LedgerAccountCategory>
Some parameter documentations has been truncated, see Models::LedgerAccountCategoryListParams for more details.
Get a list of ledger account categories.
137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/modern_treasury/resources/ledger_account_categories.rb', line 137 def list(params = {}) parsed, = ModernTreasury::LedgerAccountCategoryListParams.dump_request(params) @client.request( method: :get, path: "api/ledger_account_categories", query: parsed, page: ModernTreasury::Internal::Page, model: ModernTreasury::LedgerAccountCategory, options: ) end |
#remove_ledger_account(ledger_account_id, id: , request_options: {}) ⇒ nil
Remove a ledger account from a ledger account category.
236 237 238 239 240 241 242 243 244 245 246 247 248 |
# File 'lib/modern_treasury/resources/ledger_account_categories.rb', line 236 def remove_ledger_account(ledger_account_id, params) parsed, = ModernTreasury::LedgerAccountCategoryRemoveLedgerAccountParams.dump_request(params) id = parsed.delete(:id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :delete, path: ["api/ledger_account_categories/%1$s/ledger_accounts/%2$s", id, ledger_account_id], model: NilClass, options: ) end |
#remove_nested_category(sub_category_id, id: , request_options: {}) ⇒ nil
Delete a ledger account category from a ledger account category.
263 264 265 266 267 268 269 270 271 272 273 274 275 |
# File 'lib/modern_treasury/resources/ledger_account_categories.rb', line 263 def remove_nested_category(sub_category_id, params) parsed, = ModernTreasury::LedgerAccountCategoryRemoveNestedCategoryParams.dump_request(params) id = parsed.delete(:id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :delete, path: ["api/ledger_account_categories/%1$s/ledger_account_categories/%2$s", id, sub_category_id], model: NilClass, options: ) end |
#retrieve(id, balances: nil, request_options: {}) ⇒ ModernTreasury::Models::LedgerAccountCategory
Some parameter documentations has been truncated, see Models::LedgerAccountCategoryRetrieveParams for more details.
Get the details on a single ledger account category.
61 62 63 64 65 66 67 68 69 70 |
# File 'lib/modern_treasury/resources/ledger_account_categories.rb', line 61 def retrieve(id, params = {}) parsed, = ModernTreasury::LedgerAccountCategoryRetrieveParams.dump_request(params) @client.request( method: :get, path: ["api/ledger_account_categories/%1$s", id], query: parsed, model: ModernTreasury::LedgerAccountCategory, options: ) end |
#update(id, description: nil, metadata: nil, name: nil, request_options: {}) ⇒ ModernTreasury::Models::LedgerAccountCategory
Some parameter documentations has been truncated, see Models::LedgerAccountCategoryUpdateParams for more details.
Update the details of a ledger account category.
92 93 94 95 96 97 98 99 100 101 |
# File 'lib/modern_treasury/resources/ledger_account_categories.rb', line 92 def update(id, params = {}) parsed, = ModernTreasury::LedgerAccountCategoryUpdateParams.dump_request(params) @client.request( method: :patch, path: ["api/ledger_account_categories/%1$s", id], body: parsed, model: ModernTreasury::LedgerAccountCategory, options: ) end |