Class: Lago::Api::Resources::WalletTransaction

Inherits:
Base
  • Object
show all
Defined in:
lib/lago/api/resources/wallet_transaction.rb

Instance Attribute Summary

Attributes inherited from Base

#client

Instance Method Summary collapse

Methods inherited from Base

#create, #destroy, #get, #initialize, #update

Constructor Details

This class inherits a constructor from Lago::Api::Resources::Base

Instance Method Details

#api_resourceObject



7
8
9
# File 'lib/lago/api/resources/wallet_transaction.rb', line 7

def api_resource
  'wallet_transactions'
end

#get_all(wallet_id, options = {}) ⇒ Object



15
16
17
18
19
20
# File 'lib/lago/api/resources/wallet_transaction.rb', line 15

def get_all(wallet_id, options = {})
  path = "/api/v1/wallets/#{wallet_id}/wallet_transactions"
  response = connection.get_all(options, path)

  JSON.parse(response.to_json, object_class: OpenStruct)
end

#root_nameObject



11
12
13
# File 'lib/lago/api/resources/wallet_transaction.rb', line 11

def root_name
  'wallet_transactions'
end

#whitelist_params(params) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/lago/api/resources/wallet_transaction.rb', line 22

def whitelist_params(params)
  {
    'wallet_transaction' => {
      wallet_id: params[:wallet_id],
      paid_credits: params[:paid_credits],
      granted_credits: params[:granted_credits]
    }.compact
  }
end