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.
-
#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.
35 36 37 |
# File 'lib/comet/models/office_365connection.rb', line 35 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 |
#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.
33 34 35 |
# File 'lib/comet/models/office_365connection.rb', line 33 def unknown_json_fields @unknown_json_fields end |
Instance Method Details
#clear ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'lib/comet/models/office_365connection.rb', line 39 def clear @feature_flag = '' @credential = Comet::Office365Credential.new @custom_setting = Comet::Office365CustomSetting.new @mailbox_unique_members = [] @site_unique_members = [] @unknown_json_fields = {} end |
#from_hash(obj) ⇒ Object
56 57 58 59 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 |
# File 'lib/comet/models/office_365connection.rb', line 56 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 else @unknown_json_fields[k] = v end end end |
#from_json(json_string) ⇒ Object
49 50 51 52 53 |
# File 'lib/comet/models/office_365connection.rb', line 49 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.
114 115 116 |
# File 'lib/comet/models/office_365connection.rb', line 114 def to_h to_hash end |
#to_hash ⇒ Hash
Returns The complete object as a Ruby hash.
100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/comet/models/office_365connection.rb', line 100 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 @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.
119 120 121 |
# File 'lib/comet/models/office_365connection.rb', line 119 def to_json( = {}) to_hash.to_json() end |