Module: LaMetric

Defined in:
lib/la_metric.rb,
lib/la_metric/frame.rb,
lib/la_metric/frames.rb,
lib/la_metric/configuration.rb

Defined Under Namespace

Classes: Configuration, ConfigurationMissing, Frame, Frames

Class Method Summary collapse

Class Method Details

.configurationObject



6
7
8
# File 'lib/la_metric.rb', line 6

def self.configuration
  @configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



10
11
12
# File 'lib/la_metric.rb', line 10

def self.configure
  yield(configuration)
end

.push(frames) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/la_metric.rb', line 14

def self.push(frames)
  configuration.validate!

  conn = Faraday.new(url: configuration.url)
  conn.post do |req|
    req.headers['Accept'] = 'application/json'
    req.headers['Cache-Control'] = 'no-cache'
    req.headers['X-Access-Token'] = configuration.access_token
    req.body = frames.serialize
  end
end