Module: Stengine

Defined in:
lib/stengine.rb,
lib/stengine/version.rb

Defined Under Namespace

Classes: API, Configuration

Constant Summary collapse

VERSION =
"0.0.6"

Class Method Summary collapse

Class Method Details

.api_tokenObject



26
27
28
29
# File 'lib/stengine.rb', line 26

def self.api_token
  throw "Stengine's API Token was not found." if self.configuration.api_token.nil?
  return self.configuration.api_token
end

.configurationObject



18
19
20
# File 'lib/stengine.rb', line 18

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

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

Yields:



22
23
24
# File 'lib/stengine.rb', line 22

def self.configure
  yield(configuration) if block_given?
end

.event(event_name, model) ⇒ Object



31
32
33
34
35
36
37
38
39
40
# File 'lib/stengine.rb', line 31

def self.event(event_name, model)
  token = self.api_token
  Thread.new{
    API.post("/events", body: {
      name: event_name,
      model: model,
      token: token
    })
  }
end