Module: Replyr

Defined in:
lib/replyr.rb,
lib/replyr/email.rb,
lib/replyr/config.rb,
lib/replyr/engine.rb,
lib/replyr/version.rb,
lib/replyr/handle_reply.rb,
lib/replyr/handle_bounce.rb,
lib/replyr/reply_address.rb,
lib/replyr/bounce_address.rb,
lib/replyr/address_builder.rb,
lib/generators/replyr/install_generator.rb

Defined Under Namespace

Modules: AddressBuilder, Generators, HandleBounce, HandleReply Classes: BounceAddress, Config, Email, Engine, ReplyAddress

Constant Summary collapse

VERSION =
"0.1.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configObject

Returns the value of attribute config.



17
18
19
# File 'lib/replyr.rb', line 17

def config
  @config
end

.loggerObject

Returns the value of attribute logger.



17
18
19
# File 'lib/replyr.rb', line 17

def logger
  @logger
end

Class Method Details

.bounce_patternObject

Regexp for bounce addresses: bounce-newsletter-12-01ce26dc69094af9246ea7e7ce9970aff2b81cc9@bounce.example.com



37
38
39
# File 'lib/replyr.rb', line 37

def bounce_pattern
  /#{config.bounce_prefix}-(?<model_name>[a-z,#]+)-(?<model_id>\d+)-(?<token>\S+)@#{config.bounce_host}/
end

.process(message) ⇒ Object



49
50
51
# File 'lib/replyr.rb', line 49

def process(message)
  Replyr::Email.process(message)
end

.reply_patternObject

Regexp for reply addresses: reply-comment-12-56-01ce26dc69094af9246ea7e7ce9970aff2b81cc9@reply.example.com



30
31
32
# File 'lib/replyr.rb', line 30

def reply_pattern
  /#{config.reply_prefix}-(?<model_name>[a-z,#]+)-(?<model_id>\d+)-(?<user_id>\d+)-(?<token>\S+)@#{config.reply_host}/
end

.routeObject Also known as: address_pattern

Regexp for bounce and reply addresses. Use this as the Replyr route in your mailman-server.



44
45
46
# File 'lib/replyr.rb', line 44

def route
  /#{reply_pattern}|#{bounce_pattern}/
end

.setup_loggerObject



23
24
25
# File 'lib/replyr.rb', line 23

def setup_logger
  @logger = (defined?(Rails) && Rails.logger) ? Rails.logger : Logger.new(STDOUT)
end