Module: Slnky

Defined in:
lib/slnky.rb,
lib/slnky/cli.rb,
lib/slnky/data.rb,
lib/slnky/message.rb,
lib/slnky/service.rb,
lib/slnky/version.rb,
lib/slnky/generator.rb,
lib/slnky/cli/notify.rb,
lib/slnky/cli/generate.rb,
lib/slnky/service/queues.rb,
lib/slnky/generator/command.rb,
lib/slnky/generator/service.rb,
lib/slnky/service/exchanges.rb,
lib/slnky/service/periodics.rb,
lib/slnky/service/subscriptions.rb

Defined Under Namespace

Modules: CLI, Generator, Service Classes: Data, Message

Constant Summary collapse

VERSION =
"0.8.0"

Class Method Summary collapse

Class Method Details

.configObject



16
17
18
19
# File 'lib/slnky.rb', line 16

def config
  load_config unless @config
  @config
end

.load_config(file = '~/.slnky/config.yaml') ⇒ Object



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

def load_config(file='~/.slnky/config.yaml')
  path = File.expand_path(file)
  @config = Slnky::Data.new(YAML.load_file(path))
end

.notify(msg, server = nil) ⇒ Object



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

def notify(msg, server=nil)
  server ||= config.slnky.url
  params = {name: msg.name, event: msg.to_h}
  RestClient.post "#{server}/hooks/notify", params.to_json, content_type: :json, accept: :json
end

.versionObject



12
13
14
# File 'lib/slnky.rb', line 12

def version
  Slnky::VERSION
end