Module: Subledger::Store::Api::Categories
- Included in:
- Store
- Defined in:
- lib/subledger/store/api/roles/categories.rb
Instance Method Summary collapse
- #attach_account_to_category(args) ⇒ Object
- #collect_accounts_for_category(category) ⇒ Object
- #detach_account_from_category(args) ⇒ Object
Instance Method Details
#attach_account_to_category(args) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/subledger/store/api/roles/categories.rb', line 5 def attach_account_to_category args category = args[:category] account = args[:account] path = Path.for_entity( :anchor => category ) + '/attach' attach_post_hash = { 'account' => account.id } begin json_body = http.post do |req| req.url path req.body = attach_post_hash end.body rescue Exception => e raise AttachError, "Cannot attach #{account}: #{e}" end account end |
#collect_accounts_for_category(category) ⇒ Object
45 46 47 |
# File 'lib/subledger/store/api/roles/categories.rb', line 45 def collect_accounts_for_category category raise CategoryError, 'category#accounts is not yet implemented' end |
#detach_account_from_category(args) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/subledger/store/api/roles/categories.rb', line 25 def detach_account_from_category args category = args[:category] account = args[:account] path = Path.for_entity( :anchor => category ) + '/detach' detach_post_hash = { 'account' => account.id } begin json_body = http.post do |req| req.url path req.body = detach_post_hash end.body rescue Exception => e raise DetachError, "Cannot detach #{account}: #{e}" end account end |