module Services::PublicApi

Public Class Methods

default_proc(body, rabbit_wrapper) click to toggle source
# File lib/services/public_api/public_api.rb, line 8
def self.default_proc(body, rabbit_wrapper)
  puts "
    No proc given but received this msg: #{body} \n
    With this instance of rabbit: #{rabbit_wrapper}

    Pass a proc to CultivatedRabbit.load_from_config(sub_proc: Proc.new { |body, rabbit_wrapper| your logic })
  "
  rabbit_wrapper.publish('Hello World')
end
load_from_config(config_path: '', sub_proc: nil) click to toggle source

returns a rabbit class from config file

# File lib/services/public_api/public_api.rb, line 19
def self.load_from_config(config_path: '', sub_proc: nil)
  config = Services::Config::Parser.new(config_path)
  proc_default = proc { |body, rabbit| default_proc(body, rabbit) }

  Services::RabbitWrapper::FromConfig.run(config: config, sub_proc: sub_proc.nil? ? proc_default : sub_proc)
end
logs() click to toggle source

internal logs, to be implemented

# File lib/services/public_api/public_api.rb, line 32
def self.logs
  raise NotImplementedError
end
rabbit_wrapper() click to toggle source

returns a rabbit_wrapper class reference with no config

# File lib/services/public_api/public_api.rb, line 27
def self.rabbit_wrapper
  Services::RabbitWrapper::Base
end