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
-
#concurrency ⇒ Object
Returns the value of attribute concurrency.
-
#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.
-
#log_level ⇒ Object
Returns the value of attribute log_level.
-
#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.
42 43 44 |
# File 'lib/comet/models/office_365connection.rb', line 42 def initialize clear end |
Instance Attribute Details
#concurrency ⇒ Object
Returns the value of attribute concurrency.
16 17 18 |
# File 'lib/comet/models/office_365connection.rb', line 16 def concurrency @concurrency end |
#credential ⇒ Object
Returns the value of attribute credential.
19 20 21 |
# File 'lib/comet/models/office_365connection.rb', line 19 def credential @credential end |
#custom_setting ⇒ Object
Returns the value of attribute custom_setting.
22 23 24 |
# File 'lib/comet/models/office_365connection.rb', line 22 def custom_setting @custom_setting end |
#custom_setting_v2 ⇒ Object
Returns the value of attribute custom_setting_v2.
25 26 27 |
# File 'lib/comet/models/office_365connection.rb', line 25 def custom_setting_v2 @custom_setting_v2 end |
#feature_flag ⇒ Object
Returns the value of attribute feature_flag.
28 29 30 |
# File 'lib/comet/models/office_365connection.rb', line 28 def feature_flag @feature_flag end |
#log_level ⇒ Object
Returns the value of attribute log_level.
31 32 33 |
# File 'lib/comet/models/office_365connection.rb', line 31 def log_level @log_level end |
#mailbox_unique_members ⇒ Object
Returns the value of attribute mailbox_unique_members.
34 35 36 |
# File 'lib/comet/models/office_365connection.rb', line 34 def mailbox_unique_members @mailbox_unique_members end |
#site_unique_members ⇒ Object
Returns the value of attribute site_unique_members.
37 38 39 |
# File 'lib/comet/models/office_365connection.rb', line 37 def site_unique_members @site_unique_members end |
#unknown_json_fields ⇒ Object
Returns the value of attribute unknown_json_fields.
40 41 42 |
# File 'lib/comet/models/office_365connection.rb', line 40 def unknown_json_fields @unknown_json_fields end |
Instance Method Details
#clear ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/comet/models/office_365connection.rb', line 46 def clear @concurrency = 0 @credential = Comet::Office365Credential.new @custom_setting = Comet::Office365CustomSetting.new @custom_setting_v2 = Comet::Office365CustomSettingV2.new @feature_flag = '' @log_level = '' @mailbox_unique_members = [] @site_unique_members = [] @unknown_json_fields = {} end |
#from_hash(obj) ⇒ Object
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 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/comet/models/office_365connection.rb', line 66 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 'Concurrency' raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric @concurrency = v when 'Credential' @credential = Comet::Office365Credential.new @credential.from_hash(v) when 'CustomSetting' @custom_setting = Comet::Office365CustomSetting.new @custom_setting.from_hash(v) when 'CustomSettingV2' @custom_setting_v2 = Comet::Office365CustomSettingV2.new @custom_setting_v2.from_hash(v) when 'FeatureFlag' raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String @feature_flag = v when 'LogLevel' raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String @log_level = 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
59 60 61 62 63 |
# File 'lib/comet/models/office_365connection.rb', line 59 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.
138 139 140 |
# File 'lib/comet/models/office_365connection.rb', line 138 def to_h to_hash end |
#to_hash ⇒ Hash
Returns The complete object as a Ruby hash.
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/comet/models/office_365connection.rb', line 121 def to_hash ret = {} ret['Concurrency'] = @concurrency ret['Credential'] = @credential ret['CustomSetting'] = @custom_setting ret['CustomSettingV2'] = @custom_setting_v2 ret['FeatureFlag'] = @feature_flag ret['LogLevel'] = @log_level 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.
143 144 145 |
# File 'lib/comet/models/office_365connection.rb', line 143 def to_json( = {}) to_hash.to_json() end |