Module: RulesIO

Defined in:
lib/rulesio.rb,
lib/rulesio/base.rb,
lib/rulesio/rack.rb,
lib/rulesio/users.rb,
lib/rulesio/helpers.rb,
lib/rulesio/railtie.rb,
lib/rulesio/version.rb,
lib/rulesio/exceptions.rb,
lib/rulesio/memory_queue.rb,
lib/rulesio/girl_friday_queue.rb

Defined Under Namespace

Modules: Helpers Classes: Base, Exceptions, GirlFridayQueue, MemoryQueue, MiddlewareConfigurator, Rack, RailsConfigurator, Railtie, Users

Constant Summary collapse

VERSION =
'0.10.3'

Class Method Summary collapse

Class Method Details

.flushObject



25
26
27
# File 'lib/rulesio.rb', line 25

def self.flush
  instance.flush
end

.post_payload_to_token(payload, token) ⇒ Object



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

def self.post_payload_to_token(payload, token)
  return if RulesIO.disable_sending_events
  uri = URI(RulesIO.webhook_url + token)
  req = Net::HTTP::Post.new(uri.path)
  req.body = payload.to_json
  req.content_type = 'application/json'
  http = Net::HTTP.new(uri.host, uri.port)
  http.use_ssl = true if RulesIO.webhook_url =~ /^https:/
  http.start do |http|
    http.request(req)
  end
end

.send_event(*args) ⇒ Object



21
22
23
# File 'lib/rulesio.rb', line 21

def self.send_event(*args)
  instance.send_event(*args)
end