Class: Email::Provider
- Inherits:
-
Object
- Object
- Email::Provider
- Defined in:
- lib/email/provider.rb
Constant Summary collapse
- GMAIL_IMAP_SERVER =
"imap.gmail.com".freeze
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.
21 22 23 |
# File 'lib/email/provider.rb', line 21 def initialize(provider) @provider = provider end |
Instance Attribute Details
#provider ⇒ Object (readonly)
Returns the value of attribute provider.
19 20 21 |
# File 'lib/email/provider.rb', line 19 def provider @provider end |
Class Method Details
.for_address(address) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/email/provider.rb', line 6 def self.for_address(address) case when address.end_with?("@fastmail.com") new(:fastmail) 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
29 30 31 32 33 34 35 36 |
# File 'lib/email/provider.rb', line 29 def host case provider when :gmail GMAIL_IMAP_SERVER when :fastmail "imap.fastmail.com" end end |
#options ⇒ Object
25 26 27 |
# File 'lib/email/provider.rb', line 25 def {port: 993, ssl: {ssl_version: :TLSv1_2}} end |