Class: Email::Provider
- Inherits:
-
Object
- Object
- Email::Provider
- Defined in:
- lib/email/provider.rb
Instance Attribute Summary collapse
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
Class Method Summary collapse
Instance Method Summary collapse
- #host ⇒ Object
-
#initialize(provider) ⇒ Provider
constructor
A new instance of Provider.
- #options ⇒ Object
Constructor Details
#initialize(provider) ⇒ Provider
Returns a new instance of Provider.
17 18 19 |
# File 'lib/email/provider.rb', line 17 def initialize(provider) @provider = provider end |
Instance Attribute Details
#provider ⇒ Object (readonly)
Returns the value of attribute provider.
15 16 17 |
# File 'lib/email/provider.rb', line 15 def provider @provider end |
Class Method Details
.for_address(address) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/email/provider.rb', line 4 def self.for_address(address) case when address.end_with?("@gmail.com") new(:gmail) when address.end_with?("@fastmail.fm") new(:fastmail) else new(:default) end end |
Instance Method Details
#host ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/email/provider.rb', line 32 def host case provider when :gmail "imap.gmail.com" when :fastmail "mail.messagingengine.com" end end |
#options ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/email/provider.rb', line 21 def case provider when :gmail {port: 993, ssl: true} when :fastmail {port: 993, ssl: true} else {port: 993, ssl: true} end end |