Class: Viewpoint::EWS::Types::MailboxUser
- Inherits:
-
Object
- Object
- Viewpoint::EWS::Types::MailboxUser
- Includes:
- Viewpoint::EWS, Viewpoint::EWS::Types
- Defined in:
- lib/ews/types/mailbox_user.rb
Overview
Design a Class method that resolves to an Array of MailboxUsers
This represents a Mailbox object in the Exchange data store
Direct Known Subclasses
Constant Summary collapse
- MAILBOX_KEY_PATHS =
{ name: [:name], email_address: [:email_address], }
- MAILBOX_KEY_TYPES =
{}
- MAILBOX_KEY_ALIAS =
{ email: :email_address, }
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
Attributes included from Viewpoint::EWS::Types
Attributes included from Viewpoint::EWS
Instance Method Summary collapse
-
#add_delegate!(delegate_email, permissions) ⇒ true
Adds one or more delegates to a principal’s mailbox and sets specific access permissions.
- #get_delegate_info ⇒ Object
-
#get_user_availability(email_address, start_time, end_time) ⇒ Object
Get information about when the user with the given email address is available.
-
#initialize(ews, mbox_user) ⇒ MailboxUser
constructor
A new instance of MailboxUser.
- #out_of_office_settings ⇒ Object
- #update_delegate!(delegate_email, permissions) ⇒ Object
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(ews, mbox_user) ⇒ MailboxUser
Returns a new instance of MailboxUser.
37 38 39 40 41 |
# File 'lib/ews/types/mailbox_user.rb', line 37 def initialize(ews, mbox_user) @ews = ews @ews_item = mbox_user simplify! end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Viewpoint::EWS::Types
Instance Method Details
#add_delegate!(delegate_email, permissions) ⇒ true
Adds one or more delegates to a principal’s mailbox and sets specific access permissions
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/ews/types/mailbox_user.rb', line 91 def add_delegate!(delegate_email, ) # Use a new hash so the passed hash is not modified in case we are in a loop. # Thanks to Markus Roberts for pointing this out. formatted_perms = {} # Modify permissions so we can pass it to the builders .each_pair do |k,v| formatted_perms[k] = {:text => v} end resp = (Viewpoint::EWS::EWS.instance).ews.add_delegate(self.email_address, delegate_email, formatted_perms) if(resp.status == 'Success') return true else raise EwsError, "Could not add delegate access for user #{delegate_email}: #{resp.code}, #{resp.}" end end |
#get_delegate_info ⇒ Object
123 124 125 126 127 128 129 130 |
# File 'lib/ews/types/mailbox_user.rb', line 123 def get_delegate_info() resp = (Viewpoint::EWS::EWS.instance).ews.get_delegate(self.email_address) # if(resp.status == 'Success') # return true # else # raise EwsError, "Could not update delegate access for user #{delegate_email}: #{resp.code}, #{resp.message}" # end end |
#get_user_availability(email_address, start_time, end_time) ⇒ Object
Get information about when the user with the given email address is available.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/ews/types/mailbox_user.rb', line 64 def get_user_availability(email_address, start_time, end_time) opts = { mailbox_data: [ :email =>{:address => email_address} ], free_busy_view_options: { time_window: {start_time: start_time, end_time: end_time}, } } resp = (Viewpoint::EWS::EWS.instance).ews.get_user_availability(opts) if(resp.status == 'Success') return resp.items else raise EwsError, "GetUserAvailability produced an error: #{resp.code}: #{resp.}" end end |
#out_of_office_settings ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/ews/types/mailbox_user.rb', line 43 def out_of_office_settings mailbox = {:address => self.email_address} resp = @ews.get_user_oof_settings(mailbox) ewsi = resp.response.clone ewsi.delete(:response_message) return OutOfOffice.new(self,ewsi) s = resp[:oof_settings] @oof_state = s[:oof_state][:text] @oof_ext_audience = s[:external_audience][:text] @oof_start = DateTime.parse(s[:duration][:start_time][:text]) @oof_end = DateTime.parse(s[:duration][:end_time][:text]) @oof_internal_reply = s[:internal_reply][:message][:text] @oof_external_reply = s[:internal_reply][:message][:text] true end |
#update_delegate!(delegate_email, permissions) ⇒ Object
108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/ews/types/mailbox_user.rb', line 108 def update_delegate!(delegate_email, ) # Modify permissions so we can pass it to the builders formatted_perms = {} .each_pair do |k,v| formatted_perms[k] = {:text => v} end resp = (Viewpoint::EWS::EWS.instance).ews.update_delegate(self.email_address, delegate_email, formatted_perms) if(resp.status == 'Success') return true else raise EwsError, "Could not update delegate access for user #{delegate_email}: #{resp.code}, #{resp.}" end end |