Class: Imap::Backup::Account
- Inherits:
-
Object
- Object
- Imap::Backup::Account
- Defined in:
- lib/imap/backup/account.rb,
lib/imap/backup/account/folder.rb,
lib/imap/backup/account/connection.rb
Defined Under Namespace
Classes: Connection, Folder
Instance Attribute Summary collapse
-
#changes ⇒ Object
readonly
Returns the value of attribute changes.
-
#connection_options ⇒ Object
Returns the value of attribute connection_options.
-
#folders ⇒ Object
Returns the value of attribute folders.
-
#local_path ⇒ Object
Returns the value of attribute local_path.
-
#marked_for_deletion ⇒ Object
readonly
Returns the value of attribute marked_for_deletion.
-
#password ⇒ Object
Returns the value of attribute password.
-
#server ⇒ Object
Returns the value of attribute server.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
- #clear_changes! ⇒ Object
- #connection ⇒ Object
-
#initialize(options) ⇒ Account
constructor
A new instance of Account.
- #mark_for_deletion! ⇒ Object
- #marked_for_deletion? ⇒ Boolean
- #modified? ⇒ Boolean
- #to_h ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(options) ⇒ Account
Returns a new instance of Account.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/imap/backup/account.rb', line 12 def initialize() @username = [:username] @password = [:password] @local_path = [:local_path] @folders = [:folders] @server = [:server] = [:connection_options] @changes = {} @marked_for_deletion = false end |
Instance Attribute Details
#changes ⇒ Object (readonly)
Returns the value of attribute changes.
9 10 11 |
# File 'lib/imap/backup/account.rb', line 9 def changes @changes end |
#connection_options ⇒ Object
Returns the value of attribute connection_options.
8 9 10 |
# File 'lib/imap/backup/account.rb', line 8 def end |
#folders ⇒ Object
Returns the value of attribute folders.
6 7 8 |
# File 'lib/imap/backup/account.rb', line 6 def folders @folders end |
#local_path ⇒ Object
Returns the value of attribute local_path.
5 6 7 |
# File 'lib/imap/backup/account.rb', line 5 def local_path @local_path end |
#marked_for_deletion ⇒ Object (readonly)
Returns the value of attribute marked_for_deletion.
10 11 12 |
# File 'lib/imap/backup/account.rb', line 10 def marked_for_deletion @marked_for_deletion end |
#password ⇒ Object
Returns the value of attribute password.
4 5 6 |
# File 'lib/imap/backup/account.rb', line 4 def password @password end |
#server ⇒ Object
Returns the value of attribute server.
7 8 9 |
# File 'lib/imap/backup/account.rb', line 7 def server @server end |
#username ⇒ Object
Returns the value of attribute username.
3 4 5 |
# File 'lib/imap/backup/account.rb', line 3 def username @username end |
Instance Method Details
#clear_changes! ⇒ Object
35 36 37 |
# File 'lib/imap/backup/account.rb', line 35 def clear_changes! @changes = {} end |
#connection ⇒ Object
23 24 25 |
# File 'lib/imap/backup/account.rb', line 23 def connection Account::Connection.new(self) end |
#mark_for_deletion! ⇒ Object
39 40 41 |
# File 'lib/imap/backup/account.rb', line 39 def mark_for_deletion! @marked_for_deletion = true end |
#marked_for_deletion? ⇒ Boolean
43 44 45 |
# File 'lib/imap/backup/account.rb', line 43 def marked_for_deletion? @marked_for_deletion end |
#modified? ⇒ Boolean
31 32 33 |
# File 'lib/imap/backup/account.rb', line 31 def modified? changes.any? end |
#to_h ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/imap/backup/account.rb', line 47 def to_h h = { username: @username, password: @password, } h[:local_path] = @local_path if @local_path h[:folders] = @folders if @folders h[:server] = @server if @server h[:connection_options] = if h end |
#valid? ⇒ Boolean
27 28 29 |
# File 'lib/imap/backup/account.rb', line 27 def valid? username && password end |