Module: FFWD::Schema::Spotify100::ApplicationJSON

Defined in:
lib/ffwd/schema/spotify100.rb

Class Method Summary collapse

Class Method Details

.dump_event(e) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/ffwd/schema/spotify100.rb', line 40

def self.dump_event e
  d = {}
  d[:version] = VERSION
  d[:time] = (e.time.to_f * 1000).to_i if e.time
  d[:key] = e.key if e.key
  d[:value] = e.value if e.value
  d[:host] = e.host if e.host
  d[:state] = e.state if e.state
  d[:description] = e.description if e.description
  d[:ttl] = e.ttl if e.ttl
  d[:tags] = e.tags.to_a if e.tags
  d[:attributes] = e.attributes if e.attributes
  JSON.dump d
end

.dump_metric(m) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/ffwd/schema/spotify100.rb', line 28

def self.dump_metric m
  d = {}
  d[:version] = VERSION
  d[:time] = (m.time.to_f * 1000).to_i if m.time
  d[:key] = m.key if m.key
  d[:value] = m.value if m.value
  d[:host] = m.host if m.host
  d[:tags] = m.tags.to_a if m.tags
  d[:attributes] = m.attributes if m.attributes
  JSON.dump d
end