Class: GovFakeNotify::Cli::Root
- Inherits:
-
Thor
- Object
- Thor
- GovFakeNotify::Cli::Root
- Defined in:
- lib/gov_fake_notify/cli/root.rb
Overview
Root of all commands
Instance Method Summary collapse
Instance Method Details
#create_template ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/gov_fake_notify/cli/root.rb', line 48 def create_template data = { id: .template_id, message: File.read(.path), name: .name, subject: .subject } res = Net::HTTP.post(URI("#{GovFakeNotify.config.base_url}/control/templates"), JSON.generate(data), { 'Content-Type' => 'application/json', 'Accept' => 'application/json' }) puts res.body end |
#start ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/gov_fake_notify/cli/root.rb', line 27 def start if .config GovFakeNotify.config do |c| c.from(YAML.parse(File.read(.config)).to_ruby.merge(.slice(*(.keys - ['config'])))) end end conf = Puma::Configuration.new do |user_config| user_config.threads 1, 1 user_config.workers 1 user_config.port GovFakeNotify.config.port user_config.app { GovFakeNotify::RootApp } end Puma::Launcher.new(conf, log_writer: Puma::LogWriter.stdio).run end |