Class: GovFakeNotify::CreateTemplateCommand
- Inherits:
-
Object
- Object
- GovFakeNotify::CreateTemplateCommand
- Defined in:
- lib/gov_fake_notify/commands/create_template_command.rb
Overview
A service used internally to create a new template from the API / command line
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(params, store: Store.instance) ⇒ CreateTemplateCommand
constructor
A new instance of CreateTemplateCommand.
- #success? ⇒ Boolean
- #to_json(*_args) ⇒ Object
Constructor Details
#initialize(params, store: Store.instance) ⇒ CreateTemplateCommand
Returns a new instance of CreateTemplateCommand.
12 13 14 15 |
# File 'lib/gov_fake_notify/commands/create_template_command.rb', line 12 def initialize(params, store: Store.instance) @params = params @store = store end |
Class Method Details
.call(params) ⇒ Object
7 8 9 10 |
# File 'lib/gov_fake_notify/commands/create_template_command.rb', line 7 def self.call(params) # do nothing yet new(params).call end |
Instance Method Details
#call ⇒ Object
17 18 19 20 21 |
# File 'lib/gov_fake_notify/commands/create_template_command.rb', line 17 def call store.transaction { store["template-#{params['id']}"] = params } self end |
#success? ⇒ Boolean
23 24 25 |
# File 'lib/gov_fake_notify/commands/create_template_command.rb', line 23 def success? true end |
#to_json(*_args) ⇒ Object
27 28 29 |
# File 'lib/gov_fake_notify/commands/create_template_command.rb', line 27 def to_json(*_args) JSON.generate({ success: true }) end |