Module: LetterOpenerWeb

Defined in:
lib/letter_opener_web.rb,
lib/letter_opener_web/engine.rb,
lib/letter_opener_web/version.rb,
app/models/letter_opener_web/letter.rb,
lib/letter_opener_web/delivery_method.rb,
app/models/letter_opener_web/aws_letter.rb,
app/models/letter_opener_web/s3_message.rb,
app/models/letter_opener_web/base_letter.rb,
app/controllers/letter_opener_web/letters_controller.rb,
app/controllers/letter_opener_web/application_controller.rb

Defined Under Namespace

Classes: ApplicationController, AwsLetter, BaseLetter, Config, DeliveryMethod, Engine, Letter, LettersController, S3Message

Constant Summary collapse

VERSION =
'2.0.1'

Class Method Summary collapse

Class Method Details

.aws_clientObject



45
46
47
48
49
50
51
# File 'lib/letter_opener_web.rb', line 45

def self.aws_client
  @aws_client ||= ::Aws::S3::Client.new(
    access_key_id: LetterOpenerWeb.config.aws_access_key_id,
    secret_access_key: LetterOpenerWeb.config.aws_secret_access_key,
    region: LetterOpenerWeb.config.aws_region
  )
end

.configObject



29
30
31
32
33
# File 'lib/letter_opener_web.rb', line 29

def self.config
  @config ||= Config.new.tap do |conf|
    conf.letters_storage = :local
  end
end

.configure {|config| ... } ⇒ Object

Yields:



35
36
37
# File 'lib/letter_opener_web.rb', line 35

def self.configure
  yield config if block_given?
end

.reset!Object



39
40
41
42
43
# File 'lib/letter_opener_web.rb', line 39

def self.reset!
  @config = nil
  @aws_client = nil
  @letters_location = nil
end