Class: ContextIO::EmailSettings
- Inherits:
-
Object
- Object
- ContextIO::EmailSettings
- Defined in:
- lib/contextio/email_settings.rb
Overview
Represents the IMAP settings for a given email address. The API documentation refers to this as 'discovery'. This process is hit-and-miss. If noting is found, many attributes are likely to be nil and blank. Check EmailSettings#found?.
Instance Attribute Summary collapse
-
#documentation ⇒ Array<String>
readonly
A list of documentation pages that pertain to the provider.
-
#email ⇒ String
readonly
The email address associated with these IMAP settings.
-
#found? ⇒ Boolean
readonly
Whether the settings were able to be fetched.
-
#oauth? ⇒ Boolean
readonly
Whether the IMAP server supports OAuth or not.
-
#port ⇒ Integer
readonly
The network port the IMAP server is listening on.
-
#resource_url ⇒ String
readonly
The path for discovering email settings.
-
#server ⇒ String
readonly
FQDN of the IMAP server.
-
#source_type ⇒ String
readonly
The only source type currently supported by the API is 'IMAP'.
-
#type ⇒ String
readonly
The type og the provider (like 'gmail').
-
#use_ssl? ⇒ Boolean
readonly
Whether the IMAP server uses SSL for connections.
-
#username ⇒ String
readonly
The username for authentication purposes.
Instance Method Summary collapse
-
#initialize(api, email, source_type = 'IMAP') ⇒ EmailSettings
constructor
A new instance of EmailSettings.
Constructor Details
#initialize(api, email, source_type = 'IMAP') ⇒ EmailSettings
Returns a new instance of EmailSettings.
47 48 49 50 51 |
# File 'lib/contextio/email_settings.rb', line 47 def initialize(api, email, source_type = 'IMAP') @api = api @email = email @source_type = source_type end |
Instance Attribute Details
#documentation ⇒ Array<String> (readonly)
Returns A list of documentation pages that pertain to the provider. Will fetch from the API if necessary.
24 25 26 27 28 29 30 |
# File 'lib/contextio/email_settings.rb', line 24 def documentation return @documentation if instance_variable_defined?(:@documentation) fetch_attributes @documentation end |
#email ⇒ String (readonly)
Returns The email address associated with these IMAP settings.
34 35 36 |
# File 'lib/contextio/email_settings.rb', line 34 def email @email end |
#found? ⇒ Boolean (readonly)
Returns Whether the settings were able to be fetched. Will fetch from the API if necessary.
62 63 64 |
# File 'lib/contextio/email_settings.rb', line 62 def found? found end |
#oauth? ⇒ Boolean (readonly)
Returns Whether the IMAP server supports OAuth or not. Will fetch from the API if necessary.
90 91 92 |
# File 'lib/contextio/email_settings.rb', line 90 def oauth? !!imap['oauth'] end |
#port ⇒ Integer (readonly)
Returns The network port the IMAP server is listening on. Will fetch from the API if necessary.
83 84 85 |
# File 'lib/contextio/email_settings.rb', line 83 def port imap['port'] end |
#resource_url ⇒ String (readonly)
Returns The path for discovering email settings.
55 56 57 |
# File 'lib/contextio/email_settings.rb', line 55 def resource_url 'discovery' end |
#server ⇒ String (readonly)
Returns FQDN of the IMAP server. Will fetch from the API if necessary.
69 70 71 |
# File 'lib/contextio/email_settings.rb', line 69 def server imap['server'] end |
#source_type ⇒ String (readonly)
Returns The only source type currently supported by the API is 'IMAP'.
34 35 36 |
# File 'lib/contextio/email_settings.rb', line 34 def source_type @source_type end |
#type ⇒ String (readonly)
Returns The type og the provider (like 'gmail'). Will fetch from the API if necessary.
13 14 15 16 17 18 19 |
# File 'lib/contextio/email_settings.rb', line 13 def type return @type if instance_variable_defined?(:@type) fetch_attributes @type end |
#use_ssl? ⇒ Boolean (readonly)
Returns Whether the IMAP server uses SSL for connections. Will fetch from the API if necessary.
97 98 99 |
# File 'lib/contextio/email_settings.rb', line 97 def use_ssl? !!imap['use_ssl'] end |
#username ⇒ String (readonly)
Returns The username for authentication purposes. Will fetch from the API if necessary.
76 77 78 |
# File 'lib/contextio/email_settings.rb', line 76 def username imap['username'] end |