Class: FlexOps::Resources::Wallet
- Inherits:
-
Object
- Object
- FlexOps::Resources::Wallet
- Defined in:
- lib/flexops/resources/wallet.rb
Instance Method Summary collapse
- #add_funds(amount) ⇒ Object
- #configure_auto_reload(enabled:, threshold: nil, amount: nil) ⇒ Object
- #get_balance ⇒ Object
-
#initialize(http, ws_id_proc) ⇒ Wallet
constructor
A new instance of Wallet.
- #list_transactions(page: nil, page_size: nil, start_date: nil, end_date: nil) ⇒ Object
Constructor Details
#initialize(http, ws_id_proc) ⇒ Wallet
Returns a new instance of Wallet.
12 13 14 15 |
# File 'lib/flexops/resources/wallet.rb', line 12 def initialize(http, ws_id_proc) @http = http @ws_id = ws_id_proc end |
Instance Method Details
#add_funds(amount) ⇒ Object
21 22 23 |
# File 'lib/flexops/resources/wallet.rb', line 21 def add_funds(amount) @http.post("#{ws_path}/wallet/add-funds", body: { amount: amount }) end |
#configure_auto_reload(enabled:, threshold: nil, amount: nil) ⇒ Object
30 31 32 |
# File 'lib/flexops/resources/wallet.rb', line 30 def configure_auto_reload(enabled:, threshold: nil, amount: nil) @http.put("#{ws_path}/wallet/auto-reload", body: { enabled: enabled, threshold: threshold, amount: amount }.compact) end |
#get_balance ⇒ Object
17 18 19 |
# File 'lib/flexops/resources/wallet.rb', line 17 def get_balance @http.get("#{ws_path}/wallet/balance") end |
#list_transactions(page: nil, page_size: nil, start_date: nil, end_date: nil) ⇒ Object
25 26 27 28 |
# File 'lib/flexops/resources/wallet.rb', line 25 def list_transactions(page: nil, page_size: nil, start_date: nil, end_date: nil) query = { page: page, pageSize: page_size, startDate: start_date, endDate: end_date }.compact @http.get("#{ws_path}/wallet/transactions", query: query.empty? ? nil : query) end |