Sha256: c26866127dd031292d2342ca869e102c5fe28514e9c53fa46619f6ae22ca6b5a

Contents?: true

Size: 801 Bytes

Versions: 2

Compression:

Stored size: 801 Bytes

Contents

module Chillout
  class EventDataBuilder
    def initialize(config)
      @config = config
    end

    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

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
chillout-0.4.0 lib/chillout/event_data_builder.rb
chillout-0.3.0 lib/chillout/event_data_builder.rb