Class: MetricsAdapter::Adapters::Keen

Inherits:
Object
  • Object
show all
Defined in:
lib/metrics_adapter/adapters/keen.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Keen

Returns a new instance of Keen.



6
7
8
9
# File 'lib/metrics_adapter/adapters/keen.rb', line 6

def initialize(options)
  @project_id = options.fetch(:project_id)
  @write_key = options.fetch(:write_key)
end

Instance Attribute Details

#project_idObject (readonly)

Returns the value of attribute project_id.



4
5
6
# File 'lib/metrics_adapter/adapters/keen.rb', line 4

def project_id
  @project_id
end

#write_keyObject (readonly)

Returns the value of attribute write_key.



4
5
6
# File 'lib/metrics_adapter/adapters/keen.rb', line 4

def write_key
  @write_key
end

Instance Method Details

#publish(data) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/metrics_adapter/adapters/keen.rb', line 11

def publish(data)
  name = data.delete(:name)

  ::Keen.project_id = project_id
  ::Keen.write_key = write_key

  ::Keen.publish(name, data)
end