Class: Chillout::EventDataBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/chillout/event_data_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ EventDataBuilder

Returns a new instance of EventDataBuilder.



3
4
5
# File 'lib/chillout/event_data_builder.rb', line 3

def initialize(config)
  @config = config
end

Instance Method Details

#build_creations_content(creations_container) ⇒ Object



19
20
21
22
23
24
# File 'lib/chillout/event_data_builder.rb', line 19

def build_creations_content(creations_container)
  creation_tuples = creations_container.resource_keys.map do |key|
    [key, creations_container[key]]
  end
  Hash[creation_tuples]
end

#build_from_creations_container(creations_container, timestamp) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/chillout/event_data_builder.rb', line 7

def build_from_creations_container(creations_container, timestamp)
  {
    :metric => "creations",
    :timestamp => timestamp,
    :content => {
      :creations => build_creations_content(creations_container),
      :environment => @config.environment
    },
    :notifier => build_notifier
  }
end

#build_notifierObject



26
27
28
29
30
31
32
# File 'lib/chillout/event_data_builder.rb', line 26

def build_notifier
  {
    :name => @config.notifier_name,
    :version => @config.version,
    :url => @config.notifier_url
  }
end