Class: LunchMoney::Calls::Crypto
- Defined in:
- lib/lunchmoney/calls/crypto.rb
Overview
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #crypto ⇒ Array<LunchMoney::Objects::Crypto>, LunchMoney::Errors
- #update_crypto(crypto_id, name: nil, display_name: nil, institution_name: nil, balance: nil, currency: nil) ⇒ LunchMoney::Objects::CryptoBase, LunchMoney::Errors
Methods inherited from Base
Constructor Details
This class inherits a constructor from LunchMoney::Calls::Base
Instance Method Details
#crypto ⇒ Array<LunchMoney::Objects::Crypto>, LunchMoney::Errors
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/lunchmoney/calls/crypto.rb', line 11 def crypto response = get("crypto") api_errors = errors(response) return api_errors if api_errors.present? response.body[:crypto].map do |crypto| LunchMoney::Objects::Crypto.new(**crypto) end end |
#update_crypto(crypto_id, name: nil, display_name: nil, institution_name: nil, balance: nil, currency: nil) ⇒ LunchMoney::Objects::CryptoBase, LunchMoney::Errors
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/lunchmoney/calls/crypto.rb', line 32 def update_crypto(crypto_id, name: nil, display_name: nil, institution_name: nil, balance: nil, currency: nil) params = clean_params({ name:, display_name:, institution_name:, balance:, currency:, }) response = put("crypto/manual/#{crypto_id}", params) api_errors = errors(response) return api_errors if api_errors.present? LunchMoney::Objects::CryptoBase.new(**response.body) end |