Class: CloudCostTracker::Tracker

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/cloud_cost_tracker/tracker.rb

Overview

Tracks the resources in one or more Fog accounts in an ActiveRecord database

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(accounts = {}, options = {}) ⇒ Tracker

Creates an object for tracking Fog accounts in an ActiveRecord database

Parameters:

  • accounts (Hash) (defaults to: {})

    a Hash of account information (see accounts.yml.example)

  • options (Hash) (defaults to: {})

    optional additional parameters:

    • :delay (Integer) - Override time between polling of accounts (should take a single Exception as its only required parameter)

    • :logger - a Ruby Logger-compatible object



21
22
23
24
25
26
# File 'lib/cloud_cost_tracker/tracker.rb', line 21

def initialize(accounts = {}, options={})
  @delay    = options[:delay]
  @log      = options[:logger] || FogTracker.default_logger
  @running  = false
  @accounts = setup_fog_tracker(accounts)
end

Instance Attribute Details

#accountsObject (readonly)

Returns the value of attribute accounts.



12
13
14
# File 'lib/cloud_cost_tracker/tracker.rb', line 12

def accounts
  @accounts
end