Class: LunchMoney::Calls::Assets
- Defined in:
- lib/lunchmoney/calls/assets.rb
Overview
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #assets ⇒ Array<LunchMoney::Objects::Asset>, LunchMoney::Errors
- #create_asset(type_name:, name:, balance:, subtype_name: nil, display_name: nil, balance_as_of: nil, currency: nil, institution_name: nil, closed_on: nil, exclude_transactions: nil) ⇒ LunchMoney::Objects::Asset, LunchMoney::Errors
- #update_asset(asset_id, type_name: nil, name: nil, balance: nil, subtype_name: nil, display_name: nil, balance_as_of: nil, currency: nil, institution_name: nil, closed_on: nil, exclude_transactions: nil) ⇒ LunchMoney::Objects::Asset, LunchMoney::Errors
Methods inherited from Base
Constructor Details
This class inherits a constructor from LunchMoney::Calls::Base
Instance Method Details
#assets ⇒ Array<LunchMoney::Objects::Asset>, LunchMoney::Errors
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/lunchmoney/calls/assets.rb', line 11 def assets response = get("assets") api_errors = errors(response) return api_errors if api_errors.present? response.body[:assets].map do |asset| LunchMoney::Objects::Asset.new(**asset) end end |
#create_asset(type_name:, name:, balance:, subtype_name: nil, display_name: nil, balance_as_of: nil, currency: nil, institution_name: nil, closed_on: nil, exclude_transactions: nil) ⇒ LunchMoney::Objects::Asset, LunchMoney::Errors
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/lunchmoney/calls/assets.rb', line 36 def create_asset(type_name:, name:, balance:, subtype_name: nil, display_name: nil, balance_as_of: nil, currency: nil, institution_name: nil, closed_on: nil, exclude_transactions: nil) params = { type_name:, name:, balance:, subtype_name:, display_name:, balance_as_of:, currency:, institution_name:, closed_on:, exclude_transactions:, } response = post("assets", params) api_errors = errors(response) return api_errors if api_errors.present? LunchMoney::Objects::Asset.new(**response.body) end |
#update_asset(asset_id, type_name: nil, name: nil, balance: nil, subtype_name: nil, display_name: nil, balance_as_of: nil, currency: nil, institution_name: nil, closed_on: nil, exclude_transactions: nil) ⇒ LunchMoney::Objects::Asset, LunchMoney::Errors
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/lunchmoney/calls/assets.rb', line 74 def update_asset(asset_id, type_name: nil, name: nil, balance: nil, subtype_name: nil, display_name: nil, balance_as_of: nil, currency: nil, institution_name: nil, closed_on: nil, exclude_transactions: nil) params = { type_name:, name:, balance:, subtype_name:, display_name:, balance_as_of:, currency:, institution_name:, closed_on:, exclude_transactions:, } response = put("assets/#{asset_id}", params) api_errors = errors(response) return api_errors if api_errors.present? LunchMoney::Objects::Asset.new(**response.body) end |