Module: PubSubTie
- Extended by:
- PubSubTie
- Included in:
- PubSubTie
- Defined in:
- lib/pubsub_tie.rb,
lib/pubsub_tie/events.rb,
lib/pubsub_tie/railtie.rb,
lib/pubsub_tie/version.rb,
lib/pubsub_tie/publisher.rb
Defined Under Namespace
Modules: Events, Publisher
Classes: Railtie
Constant Summary
collapse
- VERSION =
"1.3.0"
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#logger ⇒ Object
21
22
23
|
# File 'lib/pubsub_tie.rb', line 21
def logger
@logger ||= defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
end
|
Instance Method Details
#app_root ⇒ Object
17
18
19
|
# File 'lib/pubsub_tie.rb', line 17
def app_root
Dir.pwd
end
|
#batch(topic, data, resource: nil) ⇒ Object
43
44
45
|
# File 'lib/pubsub_tie.rb', line 43
def batch(topic, data, resource: nil)
Publisher.batch(topic, data, resource)
end
|
12
13
14
15
|
# File 'lib/pubsub_tie.rb', line 12
def configure
configure_publisher
configure_events
end
|
34
35
36
37
|
# File 'lib/pubsub_tie.rb', line 34
def configure_events
config = YAML.load_file(File.join(app_root, 'config', 'events.yml'))[env]
Events.configure(config)
end
|
29
30
31
32
|
# File 'lib/pubsub_tie.rb', line 29
def configure_publisher
config = YAML.load_file(File.join(app_root, 'config', 'gcp.yml'))[env]
Publisher.configure(config)
end
|
#env ⇒ Object
25
26
27
|
# File 'lib/pubsub_tie.rb', line 25
def env
@env ||= defined?(Rails) ? Rails.env : ENV["ENV"] || 'development'
end
|
#publish(topic, data, resource: nil) ⇒ Object
39
40
41
|
# File 'lib/pubsub_tie.rb', line 39
def publish(topic, data, resource: nil)
Publisher.publish(topic, data, resource)
end
|