Class: MetrifoxSDK::Wallets::API

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/metrifox_sdk/wallets/api.rb

Instance Method Summary collapse

Instance Method Details

#get_credit_allocation(base_url, api_key, allocation_id) ⇒ Object



22
23
24
25
26
# File 'lib/metrifox_sdk/wallets/api.rb', line 22

def get_credit_allocation(base_url, api_key, allocation_id)
  uri = URI.join(base_url, "credit_systems/v2/credit-allocations/#{allocation_id}")
  response = make_request(uri, "GET", api_key)
  parse_response(response, "Failed to get credit allocation")
end

#list_credit_allocations(base_url, api_key, wallet_id, status: nil) ⇒ Object



15
16
17
18
19
20
# File 'lib/metrifox_sdk/wallets/api.rb', line 15

def list_credit_allocations(base_url, api_key, wallet_id, status: nil)
  uri = URI.join(base_url, "credit_systems/v2/wallets/#{wallet_id}/credit-allocations")
  uri.query = URI.encode_www_form(status: status) if status && !status.to_s.empty?
  response = make_request(uri, "GET", api_key)
  parse_response(response, "Failed to list credit allocations")
end

#list_wallets(base_url, api_key, customer_key) ⇒ Object



8
9
10
11
12
13
# File 'lib/metrifox_sdk/wallets/api.rb', line 8

def list_wallets(base_url, api_key, customer_key)
  uri = URI.join(base_url, "credit_systems/v2/wallets")
  uri.query = URI.encode_www_form(customer_key: customer_key)
  response = make_request(uri, "GET", api_key)
  parse_response(response, "Failed to list wallets")
end