Class: RefreshWalletWorker

Inherits:
Object
  • Object
show all
Includes:
SuckerPunch::Job
Defined in:
lib/eme/billing/workers/refresh_wallet_worker.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.all_connectionsObject



14
15
16
# File 'lib/eme/billing/workers/refresh_wallet_worker.rb', line 14

def self.all_connections
  @available_connections
end

.get_connectionObject



6
7
8
# File 'lib/eme/billing/workers/refresh_wallet_worker.rb', line 6

def self.get_connection
  @available_connections.pop
end

.return_connection(conn) ⇒ Object



10
11
12
# File 'lib/eme/billing/workers/refresh_wallet_worker.rb', line 10

def self.return_connection(conn)
  @available_connections.push(conn)
end

Instance Method Details

#perform(master_account_id, currency = "EMP", opts = {}) ⇒ Object



18
19
20
21
22
# File 'lib/eme/billing/workers/refresh_wallet_worker.rb', line 18

def perform(, currency = "EMP", opts = {})
  conn = RefreshWalletWorker.get_connection
  EME::Billing.reload_wallet(, currency, opts, EME::Billing.connection(conn))
  RefreshWalletWorker.return_connection(conn)
end