Class: SnapshotsBiller
Overview
Biller for VM Snapshots
Instance Method Summary collapse
- #bill(bill:, state:, delta:, record: nil) ⇒ Object
-
#check_biller ⇒ Object
Checking if Snapshots costs are given, otherwise there is no point to calculate it.
Methods inherited from Biller
#billing_period, #costs, #initialize
Constructor Details
This class inherits a constructor from Biller
Instance Method Details
#bill(bill:, state:, delta:, record: nil) ⇒ Object
15 16 17 18 |
# File 'service/billers/snapshots.rb', line 15 def bill bill:, state:, delta:, record: nil bill[:snapshots] = delta * @cost * state[:snaps] bill end |
#check_biller ⇒ Object
Checking if Snapshots costs are given, otherwise there is no point to calculate it
4 5 6 7 8 9 10 11 12 |
# File 'service/billers/snapshots.rb', line 4 def check_biller @cost = JSON.parse(costs['SNAPSHOT_COST']) return false if @cost.nil? @cost = @cost.to_f return @cost > 0 rescue return false end |