Class: LunchMoney::Calls::Crypto

Inherits:
Base
  • Object
show all
Defined in:
lib/lunchmoney/calls/crypto.rb

Overview

https://lunchmoney.dev/#crypto

Constant Summary

Constants inherited from Base

Base::BASE_URL

Instance Attribute Summary

Attributes inherited from Base

#api_key

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from LunchMoney::Calls::Base

Instance Method Details

#cryptoArray<LunchMoney::Objects::Crypto>, LunchMoney::Errors



11
12
13
14
15
16
17
18
19
# File 'lib/lunchmoney/calls/crypto.rb', line 11

def crypto
  response = get("crypto")

  handle_api_response(response) do |body|
    body[:crypto].map do |crypto|
      LunchMoney::Objects::Crypto.new(**crypto)
    end
  end
end

#update_crypto(crypto_id, name: nil, display_name: nil, institution_name: nil, balance: nil, currency: nil) ⇒ LunchMoney::Objects::CryptoBase, LunchMoney::Errors

Parameters:

  • crypto_id (Integer)
  • name (String, nil) (defaults to: nil)
  • display_name (String, nil) (defaults to: nil)
  • institution_name (String, nil) (defaults to: nil)
  • balance (String, nil) (defaults to: nil)
  • currency (String, nil) (defaults to: nil)

Returns:



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/lunchmoney/calls/crypto.rb', line 31

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)

  handle_api_response(response) do |body|
    LunchMoney::Objects::CryptoBase.new(**body)
  end
end