viewpoint 1.1.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +13 -8
  3. data/lib/ews/calendar_accessors.rb +37 -33
  4. data/lib/ews/connection.rb +151 -124
  5. data/lib/ews/connection_helper.rb +36 -33
  6. data/lib/ews/convert_accessors.rb +58 -54
  7. data/lib/ews/errors.rb +59 -53
  8. data/lib/ews/ews_client.rb +92 -79
  9. data/lib/ews/exceptions/exceptions.rb +61 -61
  10. data/lib/ews/folder_accessors.rb +235 -234
  11. data/lib/ews/impersonation.rb +29 -23
  12. data/lib/ews/item_accessors.rb +215 -213
  13. data/lib/ews/mailbox_accessors.rb +82 -79
  14. data/lib/ews/meeting_accessors.rb +38 -31
  15. data/lib/ews/message_accessors.rb +83 -81
  16. data/lib/ews/push_subscription_accessors.rb +29 -27
  17. data/lib/ews/room_accessors.rb +48 -46
  18. data/lib/ews/roomlist_accessors.rb +47 -45
  19. data/lib/ews/soap/builders/ews_builder.rb +1186 -1188
  20. data/lib/ews/soap/ews_response.rb +68 -73
  21. data/lib/ews/soap/ews_soap_availability_response.rb +57 -57
  22. data/lib/ews/soap/ews_soap_free_busy_response.rb +115 -117
  23. data/lib/ews/soap/ews_soap_response.rb +99 -101
  24. data/lib/ews/soap/ews_soap_room_response.rb +45 -45
  25. data/lib/ews/soap/ews_soap_roomlist_response.rb +45 -46
  26. data/lib/ews/soap/exchange_availability.rb +54 -52
  27. data/lib/ews/soap/exchange_data_services.rb +693 -711
  28. data/lib/ews/soap/exchange_notification.rb +123 -128
  29. data/lib/ews/soap/exchange_synchronization.rb +82 -82
  30. data/lib/ews/soap/exchange_time_zones.rb +41 -44
  31. data/lib/ews/soap/exchange_user_configuration.rb +30 -27
  32. data/lib/ews/soap/exchange_web_service.rb +237 -233
  33. data/lib/ews/soap/parsers/ews_parser.rb +46 -42
  34. data/lib/ews/soap/parsers/ews_sax_document.rb +63 -58
  35. data/lib/ews/soap/response_message.rb +69 -68
  36. data/lib/ews/soap/responses/create_attachment_response_message.rb +45 -45
  37. data/lib/ews/soap/responses/create_item_response_message.rb +26 -25
  38. data/lib/ews/soap/responses/find_item_response_message.rb +76 -78
  39. data/lib/ews/soap/responses/get_events_response_message.rb +52 -51
  40. data/lib/ews/soap/responses/send_notification_response_message.rb +53 -51
  41. data/lib/ews/soap/responses/subscribe_response_message.rb +37 -34
  42. data/lib/ews/soap/responses/sync_folder_hierarchy_response_message.rb +38 -35
  43. data/lib/ews/soap/responses/sync_folder_items_response_message.rb +38 -35
  44. data/lib/ews/soap.rb +27 -26
  45. data/lib/ews/templates/calendar_item.rb +64 -60
  46. data/lib/ews/templates/forward_item.rb +19 -17
  47. data/lib/ews/templates/message.rb +61 -67
  48. data/lib/ews/templates/reply_to_item.rb +20 -18
  49. data/lib/ews/templates/task.rb +55 -55
  50. data/lib/ews/types/attachment.rb +75 -74
  51. data/lib/ews/types/attendee.rb +27 -25
  52. data/lib/ews/types/calendar_folder.rb +60 -44
  53. data/lib/ews/types/calendar_item.rb +134 -116
  54. data/lib/ews/types/contact.rb +11 -5
  55. data/lib/ews/types/contacts_folder.rb +10 -5
  56. data/lib/ews/types/copied_event.rb +47 -48
  57. data/lib/ews/types/created_event.rb +22 -20
  58. data/lib/ews/types/deleted_event.rb +22 -20
  59. data/lib/ews/types/distribution_list.rb +11 -5
  60. data/lib/ews/types/event.rb +60 -59
  61. data/lib/ews/types/export_items_response_message.rb +54 -50
  62. data/lib/ews/types/file_attachment.rb +63 -61
  63. data/lib/ews/types/folder.rb +58 -57
  64. data/lib/ews/types/free_busy_changed_event.rb +22 -20
  65. data/lib/ews/types/generic_folder.rb +348 -372
  66. data/lib/ews/types/item.rb +401 -397
  67. data/lib/ews/types/item_attachment.rb +87 -80
  68. data/lib/ews/types/item_field_uri_map.rb +201 -200
  69. data/lib/ews/types/mailbox_user.rb +146 -154
  70. data/lib/ews/types/meeting_cancellation.rb +11 -5
  71. data/lib/ews/types/meeting_message.rb +11 -5
  72. data/lib/ews/types/meeting_request.rb +11 -5
  73. data/lib/ews/types/meeting_response.rb +11 -5
  74. data/lib/ews/types/message.rb +11 -5
  75. data/lib/ews/types/modified_event.rb +43 -45
  76. data/lib/ews/types/moved_event.rb +47 -48
  77. data/lib/ews/types/new_mail_event.rb +22 -20
  78. data/lib/ews/types/out_of_office.rb +145 -144
  79. data/lib/ews/types/post_item.rb +11 -5
  80. data/lib/ews/types/search_folder.rb +10 -5
  81. data/lib/ews/types/status_event.rb +37 -36
  82. data/lib/ews/types/task.rb +39 -33
  83. data/lib/ews/types/tasks_folder.rb +32 -22
  84. data/lib/ews/types.rb +134 -139
  85. data/lib/viewpoint/logging/config.rb +19 -19
  86. data/lib/viewpoint/logging.rb +23 -17
  87. data/lib/viewpoint/string_utils.rb +31 -32
  88. data/lib/viewpoint.rb +18 -18
  89. metadata +82 -11
  90. data/Changelog.txt +0 -1004
data/lib/ews/types.rb CHANGED
@@ -1,194 +1,189 @@
1
- module Viewpoint::EWS
2
- module Types
3
- include Viewpoint::StringUtils
4
-
5
- KEY_PATHS = {
6
- extended_properties: [:extended_property],
7
- }
8
- KEY_TYPES = {
9
- extended_properties: :build_extended_properties,
10
- }
11
- KEY_ALIAS = {}
12
-
13
- attr_reader :ews_item
14
-
15
- # @param [SOAP::ExchangeWebService] ews the EWS reference
16
- # @param [Hash] ews_item the EWS parsed response document
17
- def initialize(ews, ews_item)
18
- @ews = ews
19
- @ews_item = ews_item
20
- @shallow = true
21
- @frozen = false
22
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Viewpoint
4
+ module EWS
5
+ # EWS data type models.
6
+ module Types
7
+ include Viewpoint::StringUtils
8
+
9
+ KEY_PATHS = {
10
+ extended_properties: [:extended_property]
11
+ }.freeze
12
+ KEY_TYPES = {
13
+ extended_properties: :build_extended_properties
14
+ }.freeze
15
+ KEY_ALIAS = {}.freeze
16
+
17
+ attr_reader :ews_item
18
+
19
+ # @param [SOAP::ExchangeWebService] ews the EWS reference
20
+ # @param [Hash] ews_item the EWS parsed response document
21
+ def initialize(ews, ews_item)
22
+ @ews = ews
23
+ @ews_item = ews_item
24
+ @shallow = true
25
+ @frozen = false
26
+ end
23
27
 
24
- def method_missing(method_sym, *arguments, &block)
25
- if method_keys.include?(method_sym)
26
- type_convert( method_sym, resolve_method(method_sym) )
27
- else
28
- super
28
+ def method_missing(method_sym, *arguments, &block)
29
+ if method_keys.include?(method_sym)
30
+ type_convert(method_sym, resolve_method(method_sym))
31
+ else
32
+ super
33
+ end
29
34
  end
30
- end
31
35
 
32
- def to_s
33
- "#{self.class.name}: EWS METHODS: #{self.ews_methods.sort.join(', ')}"
34
- end
36
+ def respond_to_missing?(method_sym, include_private = false)
37
+ method_keys.include?(method_sym) || super
38
+ end
35
39
 
36
- def frozen?
37
- @frozen
38
- end
40
+ def to_s
41
+ "#{self.class.name}: EWS METHODS: #{ews_methods.sort.join(', ')}"
42
+ end
39
43
 
40
- # @param ronly [Boolean] true to freeze
41
- def freeze!
42
- @frozen = true
43
- end
44
+ def frozen?
45
+ @frozen
46
+ end
44
47
 
45
- def unfreeze!
46
- @frozen = false
47
- end
48
+ # @param ronly [Boolean] true to freeze
49
+ def freeze!
50
+ @frozen = true
51
+ end
48
52
 
49
- def shallow?
50
- @shallow
51
- end
53
+ def unfreeze!
54
+ @frozen = false
55
+ end
52
56
 
53
- def mark_deep!
54
- @shallow = false
55
- end
57
+ def shallow?
58
+ @shallow
59
+ end
56
60
 
57
- def auto_deepen?
58
- ews.auto_deepen
59
- end
61
+ def mark_deep!
62
+ @shallow = false
63
+ end
64
+
65
+ def auto_deepen?
66
+ ews.auto_deepen
67
+ end
60
68
 
61
- def deepen!
62
- if shallow?
63
- self.get_all_properties!
69
+ def deepen!
70
+ return unless shallow?
71
+
72
+ get_all_properties!
64
73
  @shallow = false
65
74
  true
66
75
  end
67
- end
68
- alias_method :enlighten!, :deepen!
76
+ alias enlighten! deepen!
69
77
 
70
- # @see http://www.ruby-doc.org/core/classes/Object.html#M000333
71
- def respond_to?(method_sym, include_private = false)
72
- if method_keys.include?(method_sym)
73
- true
74
- else
75
- super
78
+ # @see http://www.ruby-doc.org/core/classes/Object.html#M000333
79
+ # rubocop:disable Style/OptionalBooleanParameter -- must match Ruby's core respond_to? signature
80
+ def respond_to?(method_sym, include_private = false)
81
+ method_keys.include?(method_sym) || super
76
82
  end
77
- end
83
+ # rubocop:enable Style/OptionalBooleanParameter
78
84
 
79
- def methods(include_super = true)
80
- super + ews_methods
81
- end
85
+ # rubocop:disable Style/OptionalBooleanParameter -- must match Ruby's core Object#methods signature
86
+ def methods(include_super = true)
87
+ super + ews_methods
88
+ end
89
+ # rubocop:enable Style/OptionalBooleanParameter
82
90
 
83
- def ews_methods
84
- key_paths.keys + key_alias.keys
85
- end
91
+ def ews_methods
92
+ key_paths.keys + key_alias.keys
93
+ end
86
94
 
87
- protected # things like OutOfOffice need protected level access
95
+ protected # things like OutOfOffice need protected level access
88
96
 
89
- def ews
90
- @ews
91
- end
97
+ def ews
98
+ @ews
99
+ end
92
100
 
93
- private
101
+ private
94
102
 
95
- def key_paths
96
- KEY_PATHS
97
- end
103
+ def key_paths
104
+ KEY_PATHS
105
+ end
98
106
 
99
- def key_types
100
- KEY_TYPES
101
- end
107
+ def key_types
108
+ KEY_TYPES
109
+ end
102
110
 
103
- def key_alias
104
- KEY_ALIAS
105
- end
111
+ def key_alias
112
+ KEY_ALIAS
113
+ end
106
114
 
107
- def class_by_name(cname)
108
- if(cname.instance_of? Symbol)
109
- cname = camel_case(cname)
115
+ def class_by_name(cname)
116
+ cname = camel_case(cname) if cname.instance_of? Symbol
117
+ Viewpoint::EWS::Types.const_get(cname)
110
118
  end
111
- Viewpoint::EWS::Types.const_get(cname)
112
- end
113
119
 
114
- def type_convert(key,str)
115
- begin
120
+ def type_convert(key, str)
116
121
  key = key_alias[key] || key
117
122
  if key_types[key]
118
123
  key_types[key].is_a?(Symbol) ? method(key_types[key]).call(str) : key_types[key].call(str)
119
124
  else
120
125
  str
121
126
  end
122
- rescue
127
+ rescue StandardError
123
128
  nil
124
129
  end
125
- end
126
130
 
127
- def resolve_method(method_sym)
128
- begin
131
+ def resolve_method(method_sym)
129
132
  resolve_key_path(@ews_item, method_path(method_sym))
130
- rescue
133
+ rescue StandardError
131
134
  if shallow?
132
135
  if frozen?
133
136
  raise EwsFrozenObjectError, "Could not resolve :#{method_sym} on frozen object."
134
137
  elsif auto_deepen?
135
138
  enlighten!
136
139
  retry
137
- else
138
- if !auto_deepen?
139
- if ews.no_auto_deepen_behavior == :raise
140
- raise EwsMinimalObjectError, "Could not resolve :#{method_sym}. #auto_deepen set to false"
141
- else
142
- nil
143
- end
144
- else
145
- end
140
+ elsif !auto_deepen? && (ews.no_auto_deepen_behavior == :raise)
141
+ raise EwsMinimalObjectError, "Could not resolve :#{method_sym}. #auto_deepen set to false"
142
+
146
143
  end
147
- else
148
- nil
149
144
  end
150
145
  end
151
- end
152
146
 
153
- def resolve_key_path(hsh, path)
154
- k = path.first
155
- return hsh[k] if path.length == 1
156
- resolve_key_path(hsh[k],path[1..-1])
157
- end
147
+ def resolve_key_path(hsh, path)
148
+ k = path.first
149
+ return hsh[k] if path.length == 1
158
150
 
159
- def method_keys
160
- key_paths.keys + key_alias.keys
161
- end
151
+ resolve_key_path(hsh[k], path[1..])
152
+ end
162
153
 
163
- # Resolve the method path with or without an alias
164
- def method_path(sym)
165
- key_paths[key_alias[sym] || sym]
166
- end
154
+ def method_keys
155
+ key_paths.keys + key_alias.keys
156
+ end
167
157
 
168
- def build_extended_properties(eprops)
169
- h = {}
170
- # todo
171
- # the return pattern seems broken in some cases,
172
- # probably needs fixing via a dedicated response parser
173
- eprops.each do |e|
174
- if e.size == 1
175
- e[:elems].each_cons(2) do |k,v|
176
- key = k[:extended_field_u_r_i][:attribs][:property_name].downcase.to_sym
177
- val = v[:value][:text]
178
- h.store(key,val)
179
- end
180
- elsif e.size == 2
181
- e[1].each_cons(2) do |k,v|
182
- key = k[:extended_field_u_r_i][:attribs][:property_name].downcase.to_sym
183
- val = v[:value][:text]
184
- h.store(key,val)
158
+ # Resolve the method path with or without an alias
159
+ def method_path(sym)
160
+ key_paths[key_alias[sym] || sym]
161
+ end
162
+
163
+ def build_extended_properties(eprops)
164
+ h = {}
165
+ # todo
166
+ # the return pattern seems broken in some cases,
167
+ # probably needs fixing via a dedicated response parser
168
+ eprops.each do |e|
169
+ if e.size == 1
170
+ e[:elems].each_cons(2) do |k, v|
171
+ key = k[:extended_field_u_r_i][:attribs][:property_name].downcase.to_sym
172
+ val = v[:value][:text]
173
+ h.store(key, val)
174
+ end
175
+ elsif e.size == 2
176
+ e[1].each_cons(2) do |k, v|
177
+ key = k[:extended_field_u_r_i][:attribs][:property_name].downcase.to_sym
178
+ val = v[:value][:text]
179
+ h.store(key, val)
180
+ end
181
+ else
182
+ raise EwsMinimalObjectError, 'Not prepared to deal with elements greater than 2'
185
183
  end
186
- else
187
- raise EwsMinimalObjectError, "Not prepared to deal with elements greater than 2"
188
184
  end
185
+ h
189
186
  end
190
- h
191
187
  end
192
-
193
188
  end
194
189
  end
@@ -1,24 +1,24 @@
1
- =begin
2
- This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
1
+ # frozen_string_literal: true
3
2
 
4
- Copyright © 2011 Dan Wanek <dan.wanek@gmail.com>
5
-
6
- Licensed under the Apache License, Version 2.0 (the "License");
7
- you may not use this file except in compliance with the License.
8
- You may obtain a copy of the License at
9
-
10
- http://www.apache.org/licenses/LICENSE-2.0
11
-
12
- Unless required by applicable law or agreed to in writing, software
13
- distributed under the License is distributed on an "AS IS" BASIS,
14
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- See the License for the specific language governing permissions and
16
- limitations under the License.
17
- =end
3
+ # This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
4
+ #
5
+ # Copyright © 2011 Dan Wanek <dan.wanek@gmail.com>
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
18
 
19
19
  module Viewpoint
20
+ # Exchange Web Services (EWS) client namespace.
20
21
  module EWS
21
- Logging.logger.root.level = :debug
22
- Logging.logger.root.appenders = Logging.appenders.stdout
23
- end # EWS
22
+ root_logger.level = Logger::DEBUG
23
+ end
24
24
  end
@@ -1,27 +1,33 @@
1
- =begin
2
- This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
1
+ # frozen_string_literal: true
3
2
 
4
- Copyright © 2011 Dan Wanek <dan.wanek@gmail.com>
3
+ # This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
4
+ #
5
+ # Copyright © 2011 Dan Wanek <dan.wanek@gmail.com>
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
5
18
 
6
- Licensed under the Apache License, Version 2.0 (the "License");
7
- you may not use this file except in compliance with the License.
8
- You may obtain a copy of the License at
9
-
10
- http://www.apache.org/licenses/LICENSE-2.0
11
-
12
- Unless required by applicable law or agreed to in writing, software
13
- distributed under the License is distributed on an "AS IS" BASIS,
14
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- See the License for the specific language governing permissions and
16
- limitations under the License.
17
- =end
19
+ require 'logger' unless defined?(Logger)
18
20
 
19
21
  module Viewpoint
22
+ # Exchange Web Services (EWS) client namespace.
20
23
  module EWS
21
24
  attr_reader :logger
22
25
 
26
+ @root_logger = Logger.new($stdout)
27
+ @root_logger.level = Logger::WARN
28
+
23
29
  def self.root_logger
24
- Logging.logger.root
30
+ @root_logger
25
31
  end
26
- end # EWS
32
+ end
27
33
  end
@@ -1,36 +1,34 @@
1
- =begin
2
- This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
1
+ # frozen_string_literal: true
3
2
 
4
- Copyright © 2011 Dan Wanek <dan.wanek@gmail.com>
5
-
6
- Licensed under the Apache License, Version 2.0 (the "License");
7
- you may not use this file except in compliance with the License.
8
- You may obtain a copy of the License at
9
-
10
- http://www.apache.org/licenses/LICENSE-2.0
11
-
12
- Unless required by applicable law or agreed to in writing, software
13
- distributed under the License is distributed on an "AS IS" BASIS,
14
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- See the License for the specific language governing permissions and
16
- limitations under the License.
17
- =end
3
+ # This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
4
+ #
5
+ # Copyright © 2011 Dan Wanek <dan.wanek@gmail.com>
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
18
 
19
19
  module Viewpoint
20
-
21
- class StringFormatException < ::Exception; end
20
+ class StringFormatException < ::StandardError; end
22
21
 
23
22
  # Collection of utility methods for working with Strings
24
23
  module StringUtils
25
-
26
24
  DURATION_RE = /
27
25
  (?<start>P)
28
- ((?<weeks>\d+)W)?
29
- ((?<days>\d+)D)?
26
+ (?:(?<weeks>\d+)W)?
27
+ (?:(?<days>\d+)D)?
30
28
  (?<time>T
31
- ((?<hours>\d+)H)?
32
- ((?<minutes>\d+)M)?
33
- ((?<seconds>\d+)S)?
29
+ (?:(?<hours>\d+)H)?
30
+ (?:(?<minutes>\d+)M)?
31
+ (?:(?<seconds>\d+)S)?
34
32
  )?
35
33
  /x
36
34
 
@@ -51,7 +49,7 @@ module Viewpoint
51
49
  # Change a ruby_cased string to CamelCased
52
50
  def camel_case(input)
53
51
  input.to_s.split(/_/).map { |i|
54
- i.sub(/^./) { |s| s.upcase }
52
+ i.sub(/^./, &:upcase)
55
53
  }.join
56
54
  end
57
55
 
@@ -62,15 +60,16 @@ module Viewpoint
62
60
  # nil if there is no known duration
63
61
  def iso8601_duration_to_seconds(input)
64
62
  return nil if input.nil? || input.empty?
63
+
65
64
  match_data = DURATION_RE.match(input)
66
- raise(StringFormatException, "Invalid duration given") if match_data.nil?
65
+ raise(StringFormatException, 'Invalid duration given') if match_data.nil?
66
+
67
67
  duration = 0
68
- duration += match_data[:weeks].to_i * 604800
69
- duration += match_data[:days].to_i * 86400
68
+ duration += match_data[:weeks].to_i * 604_800
69
+ duration += match_data[:days].to_i * 86_400
70
70
  duration += match_data[:hours].to_i * 3600
71
71
  duration += match_data[:minutes].to_i * 60
72
- duration += match_data[:seconds].to_i
72
+ duration + match_data[:seconds].to_i
73
73
  end
74
-
75
- end # StringUtils
76
- end # Viewpoint
74
+ end
75
+ end
data/lib/viewpoint.rb CHANGED
@@ -1,27 +1,27 @@
1
- =begin
2
- This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
1
+ # frozen_string_literal: true
3
2
 
4
- Copyright © 2011 Dan Wanek <dan.wanek@gmail.com>
3
+ # This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
4
+ #
5
+ # Copyright © 2011 Dan Wanek <dan.wanek@gmail.com>
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
5
18
 
6
- Licensed under the Apache License, Version 2.0 (the "License");
7
- you may not use this file except in compliance with the License.
8
- You may obtain a copy of the License at
9
-
10
- http://www.apache.org/licenses/LICENSE-2.0
11
-
12
- Unless required by applicable law or agreed to in writing, software
13
- distributed under the License is distributed on an "AS IS" BASIS,
14
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- See the License for the specific language governing permissions and
16
- limitations under the License.
17
- =end
18
-
19
- require 'kconv' if(RUBY_VERSION.start_with? '1.9') # bug in rubyntlm with ruby 1.9.x
19
+ require 'kconv' if RUBY_VERSION.start_with? '1.9' # bug in rubyntlm with ruby 1.9.x
20
20
  require 'date'
21
21
  require 'base64'
22
22
  require 'nokogiri'
23
23
  require 'ostruct'
24
- require 'logging'
24
+ require 'logger' unless defined?(Logger)
25
25
 
26
26
  # String utilities
27
27
  require 'viewpoint/string_utils'