Class: Comet::Office365Connection
- Inherits:
-
Object
- Object
- Comet::Office365Connection
- Defined in:
- lib/comet/models/office_365connection.rb
Overview
Office365Connection is a typed class wrapper around the underlying Comet Server API data structure.
Instance Attribute Summary collapse
-
#credential ⇒ Object
Returns the value of attribute credential.
-
#custom_setting ⇒ Object
Returns the value of attribute custom_setting.
-
#custom_setting_v2 ⇒ Object
Returns the value of attribute custom_setting_v2.
-
#feature_flag ⇒ Object
Returns the value of attribute feature_flag.
-
#mailbox_unique_members ⇒ Object
Returns the value of attribute mailbox_unique_members.
-
#site_unique_members ⇒ Object
Returns the value of attribute site_unique_members.
-
#unknown_json_fields ⇒ Object
Returns the value of attribute unknown_json_fields.
Instance Method Summary collapse
- #clear ⇒ Object
- #from_hash(obj) ⇒ Object
- #from_json(json_string) ⇒ Object
-
#initialize ⇒ Office365Connection
constructor
A new instance of Office365Connection.
-
#to_h ⇒ Hash
The complete object as a Ruby hash.
-
#to_hash ⇒ Hash
The complete object as a Ruby hash.
-
#to_json(options = {}) ⇒ String
The complete object as a JSON string.
Constructor Details
#initialize ⇒ Office365Connection
Returns a new instance of Office365Connection.
38 39 40 |
# File 'lib/comet/models/office_365connection.rb', line 38 def initialize clear end |
Instance Attribute Details
#credential ⇒ Object
Returns the value of attribute credential.
21 22 23 |
# File 'lib/comet/models/office_365connection.rb', line 21 def credential @credential end |
#custom_setting ⇒ Object
Returns the value of attribute custom_setting.
24 25 26 |
# File 'lib/comet/models/office_365connection.rb', line 24 def custom_setting @custom_setting end |
#custom_setting_v2 ⇒ Object
Returns the value of attribute custom_setting_v2.
33 34 35 |
# File 'lib/comet/models/office_365connection.rb', line 33 def custom_setting_v2 @custom_setting_v2 end |
#feature_flag ⇒ Object
Returns the value of attribute feature_flag.
18 19 20 |
# File 'lib/comet/models/office_365connection.rb', line 18 def feature_flag @feature_flag end |
#mailbox_unique_members ⇒ Object
Returns the value of attribute mailbox_unique_members.
27 28 29 |
# File 'lib/comet/models/office_365connection.rb', line 27 def mailbox_unique_members @mailbox_unique_members end |
#site_unique_members ⇒ Object
Returns the value of attribute site_unique_members.
30 31 32 |
# File 'lib/comet/models/office_365connection.rb', line 30 def site_unique_members @site_unique_members end |
#unknown_json_fields ⇒ Object
Returns the value of attribute unknown_json_fields.
36 37 38 |
# File 'lib/comet/models/office_365connection.rb', line 36 def unknown_json_fields @unknown_json_fields end |
Instance Method Details
#clear ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/comet/models/office_365connection.rb', line 42 def clear @feature_flag = '' @credential = Comet::Office365Credential.new @custom_setting = Comet::Office365CustomSetting.new @mailbox_unique_members = [] @site_unique_members = [] @custom_setting_v2 = Comet::Office365CustomSettingV2.new @unknown_json_fields = {} end |
#from_hash(obj) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/comet/models/office_365connection.rb', line 60 def from_hash(obj) raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash obj.each do |k, v| case k when 'FeatureFlag' raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String @feature_flag = v when 'Credential' @credential = Comet::Office365Credential.new @credential.from_hash(v) when 'CustomSetting' @custom_setting = Comet::Office365CustomSetting.new @custom_setting.from_hash(v) when 'MailboxUniqueMembers' if v.nil? @mailbox_unique_members = [] else @mailbox_unique_members = Array.new(v.length) v.each_with_index do |v1, i1| raise TypeError, "'v1' expected String, got #{v1.class}" unless v1.is_a? String @mailbox_unique_members[i1] = v1 end end when 'SiteUniqueMembers' if v.nil? @site_unique_members = [] else @site_unique_members = Array.new(v.length) v.each_with_index do |v1, i1| raise TypeError, "'v1' expected String, got #{v1.class}" unless v1.is_a? String @site_unique_members[i1] = v1 end end when 'CustomSettingV2' @custom_setting_v2 = Comet::Office365CustomSettingV2.new @custom_setting_v2.from_hash(v) else @unknown_json_fields[k] = v end end end |
#from_json(json_string) ⇒ Object
53 54 55 56 57 |
# File 'lib/comet/models/office_365connection.rb', line 53 def from_json(json_string) raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String from_hash(JSON.parse(json_string)) end |
#to_h ⇒ Hash
Returns The complete object as a Ruby hash.
122 123 124 |
# File 'lib/comet/models/office_365connection.rb', line 122 def to_h to_hash end |
#to_hash ⇒ Hash
Returns The complete object as a Ruby hash.
107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/comet/models/office_365connection.rb', line 107 def to_hash ret = {} ret['FeatureFlag'] = @feature_flag ret['Credential'] = @credential ret['CustomSetting'] = @custom_setting ret['MailboxUniqueMembers'] = @mailbox_unique_members ret['SiteUniqueMembers'] = @site_unique_members ret['CustomSettingV2'] = @custom_setting_v2 @unknown_json_fields.each do |k, v| ret[k] = v end ret end |
#to_json(options = {}) ⇒ String
Returns The complete object as a JSON string.
127 128 129 |
# File 'lib/comet/models/office_365connection.rb', line 127 def to_json( = {}) to_hash.to_json() end |