Module: IngramMicroEngine

Defined in:
lib/ingram_micro_engine.rb,
lib/ingram_micro_engine/engine.rb,
lib/ingram_micro_engine/version.rb,
app/helpers/ingram_micro_engine/application_helper.rb,
app/controllers/ingram_micro_engine/webhook_controller.rb

Defined Under Namespace

Modules: ApplicationHelper Classes: Engine, Namespace, NotificationAdapter, WebhookController

Constant Summary collapse

VERSION =
"0.0.3"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.adapterObject

Returns the value of attribute adapter.



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

def adapter
  @adapter
end

.backendObject

Returns the value of attribute backend.



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

def backend
  @backend
end

.configurationObject

Returns the value of attribute configuration.



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

def configuration
  @configuration
end

.namespaceObject

Returns the value of attribute namespace.



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

def namespace
  @namespace
end

Class Method Details

.all(callable = Proc.new) ⇒ Object



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

def all(callable=Proc.new)
  subscribe nil, callable
end

.instrument(transaction_name, xml) ⇒ Object



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

def instrument(transaction_name, xml)
  backend.instrument namespace.call(transaction_name), xml
end

.log(message) ⇒ Object



12
13
14
15
16
# File 'lib/ingram_micro_engine.rb', line 12

def log(message)
  if configuration.debug
    configuration.logger.info "[IngramMicroEngine] #{message}"
  end
end

.subscribe(transaction_name, callable = Proc.new) ⇒ Object



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

def subscribe(transaction_name, callable = Proc.new)
  backend.subscribe namespace.to_regexp(transaction_name), adapter.call(callable)
end