class GovFakeNotify::CreateTemplateCommand

A service used internally to create a new template from the API / command line

Attributes

params[R]
store[R]

Public Class Methods

call(params) click to toggle source
# File lib/gov_fake_notify/commands/create_template_command.rb, line 7
def self.call(params)
  # do nothing yet
  new(params).call
end
new(params, store: Store.instance) click to toggle source
# File lib/gov_fake_notify/commands/create_template_command.rb, line 12
def initialize(params, store: Store.instance)
  @params = params
  @store = store
end

Public Instance Methods

call() click to toggle source
# File lib/gov_fake_notify/commands/create_template_command.rb, line 17
def call
  store.transaction { store["template-#{params['id']}"] = params }

  self
end
success?() click to toggle source
# File lib/gov_fake_notify/commands/create_template_command.rb, line 23
def success?
  true
end
to_json(*_args) click to toggle source
# File lib/gov_fake_notify/commands/create_template_command.rb, line 27
def to_json(*_args)
  JSON.generate({ success: true })
end