Class: Viewpoint::EWS::Types::OutOfOffice
- Inherits:
-
Object
- Object
- Viewpoint::EWS::Types::OutOfOffice
- Includes:
- Viewpoint::EWS, Viewpoint::EWS::Types
- Defined in:
- lib/ews/types/out_of_office.rb
Overview
This represents OutOfOffice settings
Constant Summary
Constants included from Viewpoint::EWS::Types
KEY_ALIAS, KEY_PATHS, KEY_TYPES, OOF_KEY_ALIAS, OOF_KEY_PATHS, OOF_KEY_TYPES
Constants included from StringUtils
Constants included from Viewpoint::EWS
Instance Attribute Summary collapse
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Attributes included from Viewpoint::EWS::Types
Attributes included from Viewpoint::EWS
Instance Method Summary collapse
- #changed? ⇒ Boolean
- #disable ⇒ Object
- #enable ⇒ Object
-
#external_reply=(message) ⇒ Object
A message to send to external users.
-
#initialize(user, ews_item) ⇒ OutOfOffice
constructor
A new instance of OutOfOffice.
-
#internal_reply=(message) ⇒ Object
A message to send to internal users.
- #save! ⇒ Object
-
#schedule(start_time, end_time) ⇒ Object
Schedule an out of office.
-
#set_duration(start_time, end_time) ⇒ Object
Specify a duration for this Out Of Office setting.
Methods included from Viewpoint::EWS::Types
#auto_deepen?, #deepen!, #ews_methods, #freeze!, #frozen?, #mark_deep!, #method_missing, #methods, #respond_to?, #shallow?, #to_s, #unfreeze!
Methods included from StringUtils
Methods included from Viewpoint::EWS
#remove_impersonation, root_logger, #set_impersonation
Constructor Details
#initialize(user, ews_item) ⇒ OutOfOffice
Returns a new instance of OutOfOffice.
45 46 47 48 49 50 51 |
# File 'lib/ews/types/out_of_office.rb', line 45 def initialize(user, ews_item) @ews = user.ews @user = user @ews_item = ews_item @changed = false simplify! end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Viewpoint::EWS::Types
Instance Attribute Details
#user ⇒ Object (readonly)
Returns the value of attribute user.
41 42 43 |
# File 'lib/ews/types/out_of_office.rb', line 41 def user @user end |
Instance Method Details
#changed? ⇒ Boolean
53 54 55 |
# File 'lib/ews/types/out_of_office.rb', line 53 def changed? @changed end |
#disable ⇒ Object
75 76 77 78 79 |
# File 'lib/ews/types/out_of_office.rb', line 75 def disable return true unless enabled? || scheduled? @changed = true @ews_item[:oof_settings][:oof_state] = :disabled end |
#enable ⇒ Object
69 70 71 72 73 |
# File 'lib/ews/types/out_of_office.rb', line 69 def enable return true if enabled? @changed = true @ews_item[:oof_settings][:oof_state] = :enabled end |
#external_reply=(message) ⇒ Object
A message to send to external users
108 109 110 111 |
# File 'lib/ews/types/out_of_office.rb', line 108 def external_reply=() @changed = true @ews_item[:oof_settings][:external_reply] = end |
#internal_reply=(message) ⇒ Object
A message to send to internal users
101 102 103 104 |
# File 'lib/ews/types/out_of_office.rb', line 101 def internal_reply=() @changed = true @ews_item[:oof_settings][:internal_reply] = end |
#save! ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/ews/types/out_of_office.rb', line 57 def save! return true unless changed? opts = { mailbox: {address: user.email_address} }.merge(@ews_item[:oof_settings]) resp = @ews.set_user_oof_settings(opts) if resp.success? @changed = false true else raise SaveFailed, "Could not save #{self.class}. #{resp.code}: #{resp.}" end end |
#schedule(start_time, end_time) ⇒ Object
Schedule an out of office.
84 85 86 87 88 |
# File 'lib/ews/types/out_of_office.rb', line 84 def schedule(start_time, end_time) @changed = true @ews_item[:oof_settings][:oof_state] = :scheduled set_duration start_time, end_time end |
#set_duration(start_time, end_time) ⇒ Object
Specify a duration for this Out Of Office setting
93 94 95 96 97 |
# File 'lib/ews/types/out_of_office.rb', line 93 def set_duration(start_time, end_time) @changed = true @ews_item[:oof_settings][:duration][:start_time] = start_time @ews_item[:oof_settings][:duration][:end_time] = end_time end |