Class: MailDude::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/mail_dude/configuration.rb

Constant Summary collapse

SUPPORTED_STORES =
%i[file memory database].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/mail_dude/configuration.rb', line 23

def initialize
  @enabled_environments = %w[development qa test]
  @storage = :file
  @storage_path = default_storage_path
  @max_messages = 1_000
  @retention_period = 7.days
  @max_message_size = 25.megabytes
  @allow_production = false
  @capture_attachments = true
  @capture_mailer_metadata_headers = true
  @default_per_page = 50
  @live_updates = false
  @live_update_stream_name = default_live_update_stream_name
  @live_update_authorizer = ->(_connection) { false }
end

Instance Attribute Details

#allow_productionObject

Returns the value of attribute allow_production.



9
10
11
# File 'lib/mail_dude/configuration.rb', line 9

def allow_production
  @allow_production
end

#capture_attachmentsObject

Returns the value of attribute capture_attachments.



9
10
11
# File 'lib/mail_dude/configuration.rb', line 9

def capture_attachments
  @capture_attachments
end

#capture_mailer_metadata_headersObject

Returns the value of attribute capture_mailer_metadata_headers.



9
10
11
# File 'lib/mail_dude/configuration.rb', line 9

def 
  @capture_mailer_metadata_headers
end

#default_per_pageObject

Returns the value of attribute default_per_page.



9
10
11
# File 'lib/mail_dude/configuration.rb', line 9

def default_per_page
  @default_per_page
end

#enabled_environmentsObject

Returns the value of attribute enabled_environments.



9
10
11
# File 'lib/mail_dude/configuration.rb', line 9

def enabled_environments
  @enabled_environments
end

#live_update_authorizerObject

Returns the value of attribute live_update_authorizer.



9
10
11
# File 'lib/mail_dude/configuration.rb', line 9

def live_update_authorizer
  @live_update_authorizer
end

#live_update_stream_nameObject

Returns the value of attribute live_update_stream_name.



9
10
11
# File 'lib/mail_dude/configuration.rb', line 9

def live_update_stream_name
  @live_update_stream_name
end

#live_updatesObject

Returns the value of attribute live_updates.



9
10
11
# File 'lib/mail_dude/configuration.rb', line 9

def live_updates
  @live_updates
end

#max_message_sizeObject

Returns the value of attribute max_message_size.



9
10
11
# File 'lib/mail_dude/configuration.rb', line 9

def max_message_size
  @max_message_size
end

#max_messagesObject

Returns the value of attribute max_messages.



9
10
11
# File 'lib/mail_dude/configuration.rb', line 9

def max_messages
  @max_messages
end

#retention_periodObject

Returns the value of attribute retention_period.



9
10
11
# File 'lib/mail_dude/configuration.rb', line 9

def retention_period
  @retention_period
end

#storageObject

Returns the value of attribute storage.



9
10
11
# File 'lib/mail_dude/configuration.rb', line 9

def storage
  @storage
end

#storage_pathObject

Returns the value of attribute storage_path.



9
10
11
# File 'lib/mail_dude/configuration.rb', line 9

def storage_path
  @storage_path
end

Instance Method Details

#validate!Object



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/mail_dude/configuration.rb', line 39

def validate!
  normalize!
  validate_storage!
  validate_storage_path!
  validate_positive!(:max_messages, max_messages)
  validate_positive!(:retention_period, retention_period)
  validate_positive!(:max_message_size, max_message_size)
  validate_positive!(:default_per_page, default_per_page)
  validate_live_updates!
  self
end