Module: GovFakeNotify
- Defined in:
- lib/gov_fake_notify/config.rb,
lib/gov_fake_notify.rb,
lib/gov_fake_notify/store.rb,
lib/gov_fake_notify/version.rb,
lib/gov_fake_notify/cli/root.rb,
lib/gov_fake_notify/root_app.rb,
lib/gov_fake_notify/files_app.rb,
lib/gov_fake_notify/control_app.rb,
lib/gov_fake_notify/templates_app.rb,
lib/gov_fake_notify/current_service.rb,
lib/gov_fake_notify/attachment_store.rb,
lib/gov_fake_notify/notifications_app.rb,
lib/gov_fake_notify/commands/fetch_file_command.rb,
lib/gov_fake_notify/commands/send_email_command.rb,
lib/gov_fake_notify/commands/create_template_command.rb,
lib/gov_fake_notify/commands/fetch_templates_command.rb,
lib/gov_fake_notify/commands/fetch_message_status_command.rb,
lib/gov_fake_notify/commands/fetch_all_messages_status_command.rb
Overview
Defined Under Namespace
Modules: Cli, CurrentService
Classes: AttachmentStore, Config, ControlApp, CreateTemplateCommand, Error, FetchAllMessagesStatusCommand, FetchFileCommand, FetchMessageStatusCommand, FetchTemplatesCommand, FilesApp, NotificationsApp, RootApp, SendEmailCommand, Store, TemplatesApp
Constant Summary
collapse
- VERSION =
'2.0.0'
Class Method Summary
collapse
Class Method Details
.config ⇒ Object
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/gov_fake_notify.rb', line 11
def self.config
Config.instance.tap do |instance|
if block_given?
yield instance
configure_mail
configure_templates
configure_api_keys
end
end
end
|
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/gov_fake_notify.rb', line 43
def self.configure_api_keys(store: Store.instance)
config.include_api_keys.each do |k|
api_key = k.transform_keys(&:to_s)
next if store.transaction { store.root?("apikey-#{api_key['key']}") }
store.transaction do
key = api_key.dup
secret_token = key['key']
key['service_id'] = secret_token[-73..-38]
key['secret_token'] = secret_token[-36..-1]
store["apikey-#{api_key['key']}"] = key
end
end
end
|
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/gov_fake_notify.rb', line 22
def self.configure_mail
our_config = config
Mail.defaults do
case our_config.delivery_method.to_s
when 'smtp'
delivery_method :smtp, address: our_config.smtp_address, port: our_config.smtp_port
when 'test'
delivery_method :test
end
end
end
|
34
35
36
37
38
39
40
41
|
# File 'lib/gov_fake_notify.rb', line 34
def self.configure_templates(store: Store.instance)
config.include_templates.each do |t|
template = t.transform_keys(&:to_s)
next if store.transaction { store.root?("template-#{template['id']}") }
store.transaction { store["template-#{template['id']}"] = template.dup }
end
end
|