viewpoint 1.1.1 → 1.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a68b06955c37c1754b683df062fac54eed03b683a9c7a165afac56b99d6ce246
4
- data.tar.gz: f634063cda62c76cb0c8efc073e9f3ac7af677990212d57f8352fa074402b9af
3
+ metadata.gz: 13ece8332b00329ee37c4cffa26e56e1556c80984b9d37d0ae60ace1fc347e3d
4
+ data.tar.gz: 8d7b1dfa6bf36a537a28506fd444ecae58332d2f063288b9ee8c898cb48a08fe
5
5
  SHA512:
6
- metadata.gz: b8dc96f1b982e96f0b09a421d37f2b93a60e5b89f0d758937c1ce8614521d3b858e7aff40a9b0eefb20be56809d387a34a8431c214df09ab2636aeb6b50db9d1
7
- data.tar.gz: 9913637dc1c11ce0559cd142564724eec902bfb6463b35d887479f28b5db4f79ea0d6e5f3ca62812e1bfdf5ca074a2bfb5507433f347677b06252b9f20538a33
6
+ metadata.gz: 746e02661dfd754fb47afb74ec487ec6d1739249e3623ef4657b3a384c3276f86b3a3c2fb3730caf681cb98f9a668bc189bb344740fe2e17e3290be9b7dba56f
7
+ data.tar.gz: 77bd344ed0b39d044c99ec57065a8b4bc1a70472615ad3adb79cacfbd8d8b7c7f63262bc33129916bed800e6669fddd193e8ee6eb45df1c503ab9835076bc34a
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # Viewpoint for Exchange Web Services
2
- [![Build Status](https://img.shields.io/travis/WinRb/Viewpoint.svg?branch=master)](https://travis-ci.org/WinRb/Viewpoint)
2
+ [![Ruby](https://github.com/WinRb/Viewpoint/actions/workflows/ruby.yml/badge.svg?branch=main)](https://github.com/WinRb/Viewpoint/actions/workflows/ruby.yml)
3
3
  [![Gem Version](https://img.shields.io/gem/v/viewpoint.svg)](https://rubygems.org/gems/viewpoint)
4
4
  [![License](https://img.shields.io/github/license/WinRb/Viewpoint.svg)](https://github.com/WinRb/Viewpoint/blob/master/LICENSE)
5
5
  [![Wiki](https://img.shields.io/badge/docs-wiki-lightgrey.svg)](http://github.com/WinRb/Viewpoint/wiki)
@@ -196,8 +196,8 @@ end
196
196
  If you see something that could be done better or would like
197
197
  to help out in the development of this code please feel free to clone the
198
198
  'git' repository and send me patches:
199
- `git clone git://github.com/zenchild/Viewpoint.git`
199
+ `git clone https://github.com/WinRb/Viewpoint.git`
200
200
  or add an issue on GitHub:
201
- http://github.com/zenchild/Viewpoint/issues
201
+ https://github.com/WinRb/Viewpoint/issues
202
202
 
203
203
  Cheers!
@@ -22,9 +22,11 @@ class Viewpoint::EWS::Connection
22
22
  include Viewpoint::EWS
23
23
 
24
24
  attr_reader :endpoint
25
+ @@supported_httpclient_opts = %i[agent_name default_header]
26
+
25
27
  # @param [String] endpoint the URL of the web service.
26
28
  # @example https://<site>/ews/Exchange.asmx
27
- # @param [Hash] opts Misc config options (mostly for developement)
29
+ # @param [Hash] opts Misc config options (mostly for development)
28
30
  # @option opts [Fixnum] :ssl_verify_mode
29
31
  # @option opts [Fixnum] :receive_timeout override the default receive timeout
30
32
  # seconds
@@ -34,11 +36,9 @@ class Viewpoint::EWS::Connection
34
36
  # @option opts [String] :user_agent the http user agent to use in all requests
35
37
  def initialize(endpoint, opts = {})
36
38
  @log = Logging.logger[self.class.name.to_s.to_sym]
37
- if opts[:user_agent]
38
- @httpcli = HTTPClient.new(agent_name: opts[:user_agent])
39
- else
40
- @httpcli = HTTPClient.new
41
- end
39
+
40
+ httpclient_opts = opts.slice(*@@supported_httpclient_opts)
41
+ @httpcli = HTTPClient.new(**httpclient_opts)
42
42
 
43
43
  if opts[:trust_ca]
44
44
  @httpcli.ssl_config.clear_cert_store
@@ -45,8 +45,8 @@ module Viewpoint::EWS::MessageAccessors
45
45
  yield msg if block_given?
46
46
  if msg.has_attachments?
47
47
  draft = msg.draft
48
- msg.draft = true
49
48
  resp = parse_create_item(ews.create_item(msg.to_ews))
49
+ msg.draft = true
50
50
  msg.file_attachments.each do |f|
51
51
  next unless f.kind_of?(File) or f.kind_of?(Tempfile)
52
52
  resp.add_file_attachment(f)
@@ -132,7 +132,7 @@ module Viewpoint::EWS::SOAP
132
132
  @nbuild[NS_EWS_MESSAGES].ItemShape {
133
133
  @nbuild.parent.default_namespace = @default_ns
134
134
  base_shape!(item_shape[:base_shape])
135
- include_mime_content!(item_shape[:include_mime_content]) if item_shape.has_key?(:include_mime_content)
135
+ mime_content!(item_shape[:include_mime_content]) if item_shape.has_key?(:include_mime_content)
136
136
  body_type!(item_shape[:body_type]) if item_shape[:body_type]
137
137
  if(item_shape[:additional_properties])
138
138
  additional_properties!(item_shape[:additional_properties])
@@ -155,7 +155,7 @@ module Viewpoint::EWS::SOAP
155
155
  @nbuild[NS_EWS_TYPES].BaseShape(camel_case(base_shape))
156
156
  end
157
157
 
158
- def include_mime_content!(include_mime_content)
158
+ def mime_content!(include_mime_content)
159
159
  @nbuild[NS_EWS_TYPES].IncludeMimeContent(include_mime_content.to_s.downcase)
160
160
  end
161
161
 
@@ -705,6 +705,13 @@ module Viewpoint::EWS::SOAP
705
705
  @nbuild[NS_EWS_MESSAGES].ContactsView(attribs)
706
706
  end
707
707
 
708
+ # @see https://msdn.microsoft.com/en-us/library/aa565683(v=exchg.140).aspx
709
+ def categories!(fa)
710
+ @nbuild[NS_EWS_TYPES].Categories {
711
+ @nbuild[NS_EWS_TYPES].String(fa)
712
+ }
713
+ end
714
+
708
715
  # @see http://msdn.microsoft.com/en-us/library/aa579678(v=EXCHG.140).aspx
709
716
  def event_types!(evtypes)
710
717
  @nbuild[NS_EWS_TYPES].EventTypes {
@@ -822,24 +829,6 @@ module Viewpoint::EWS::SOAP
822
829
  }
823
830
  end
824
831
 
825
- def categories!(categories)
826
- nbuild[NS_EWS_TYPES].Categories {
827
- categories.each do |c|
828
- nbuild[NS_EWS_TYPES].String(c)
829
- end
830
- }
831
- end
832
-
833
- def is_from_me!(ans)
834
- return unless ans
835
-
836
- nbuild[NS_EWS_TYPES].IsFromMe
837
- end
838
-
839
- def mime_content!(mime_content)
840
- @nbuild[NS_EWS_TYPES].MimeContent(mime_content)
841
- end
842
-
843
832
  def is_read!(read)
844
833
  nbuild[NS_EWS_TYPES].IsRead(read)
845
834
  end
@@ -986,13 +975,7 @@ module Viewpoint::EWS::SOAP
986
975
 
987
976
  def from!(f)
988
977
  nbuild[NS_EWS_TYPES].From {
989
- mailbox! f[:mailbox]
990
- }
991
- end
992
-
993
- def sender!(f)
994
- nbuild[NS_EWS_TYPES].Sender {
995
- mailbox! f[:mailbox]
978
+ mailbox! f
996
979
  }
997
980
  end
998
981
 
@@ -66,17 +66,8 @@ module Viewpoint::EWS
66
66
 
67
67
  msg[:is_read] = is_read
68
68
 
69
- is_from_me && msg[:is_from_me] = is_from_me
70
-
71
- from && msg[:from] = {mailbox: {email_address: from}}
72
- sender && msg[:sender] = {mailbox: {email_address: sender}}
73
-
74
- mime_content && msg[:mime_content] = mime_content
75
-
76
69
  msg[:extended_properties] = extended_properties unless extended_properties.empty?
77
70
 
78
- msg[:categories] = categories if categories && !categories.empty?
79
-
80
71
  [ews_opts, msg]
81
72
  end
82
73
 
@@ -28,6 +28,19 @@ module Viewpoint::EWS::Types
28
28
  end
29
29
  end
30
30
 
31
+ # Fetch items between a given time period using a calendar view.
32
+ # The calendar view will include occurences of recurring calendar items
33
+ # next to the regular single calendar items.
34
+ # @param [DateTime] start_date the time to start fetching Items from
35
+ # @param [DateTime] end_date the time to stop fetching Items from
36
+ # @param opts [Hash]
37
+ # @option opts :max_entries_returned [Integer] the maximum number of entries to return
38
+ def items_between_calendar_view(start_date, end_date, opts={})
39
+ view_opts = {:start_date => start_date, :end_date => end_date}
40
+ view_opts[:max_entries_returned] = opts.delete(:max_entries_returned) if opts[:max_entries_returned]
41
+ items(opts.merge(:calendar_view => view_opts))
42
+ end
43
+
31
44
  # Creates a new appointment
32
45
  # @param attributes [Hash] Parameters of the calendar item. Some example attributes are listed below.
33
46
  # @option attributes :subject [String]
@@ -42,7 +55,11 @@ module Viewpoint::EWS::Types
42
55
  if rm && rm.success?
43
56
  CalendarItem.new ews, rm.items.first[:calendar_item][:elems].first
44
57
  else
45
- raise EwsCreateItemError, "Could not create item in folder. #{rm.code}: #{rm.message_text}" unless rm
58
+ if rm
59
+ raise EwsCreateItemError, "Could not create item in folder. #{rm.code}: #{rm.message_text}"
60
+ else
61
+ raise EwsCreateItemError, "Could not create item in folder."
62
+ end
46
63
  end
47
64
  end
48
65
 
@@ -40,6 +40,18 @@ module Viewpoint::EWS::Types
40
40
  }
41
41
  CALENDAR_ITEM_KEY_ALIAS = {}
42
42
 
43
+ # Delete this calendar item
44
+ # @param deltype [Symbol] The delete type; must be :hard, :soft, or :recycle.
45
+ # By default EWS will do a hard delete of this calendar item. See the=
46
+ # MSDN docs for more info: http://msdn.microsoft.com/en-us/library/aa562961.aspx
47
+ # @param cancel_type [String] 'SendToNone'/'SendOnlyToAll'/'SendToAllAndSaveCopy'
48
+ # Default is 'SendOnlyToAll'
49
+ # @return [Boolean] Whether or not the calendar item was deleted
50
+ def delete!(deltype = :hard, cancel_type = 'SendOnlyToAll', opts = {})
51
+ opts = opts.merge(:send_meeting_cancellations => cancel_type)
52
+ super(deltype, opts)
53
+ end
54
+
43
55
  # Updates the specified item attributes
44
56
  #
45
57
  # Uses `SetItemField` if value is present and `DeleteItemField` if value is nil
@@ -99,7 +111,11 @@ module Viewpoint::EWS::Types
99
111
  self.get_all_properties!
100
112
  self
101
113
  else
102
- raise EwsCreateItemError, "Could not update calendar item. #{rm.code}: #{rm.message_text}" unless rm
114
+ if rm
115
+ raise EwsCreateItemError, "Could not update calendar item. #{rm.code}: #{rm.message_text}"
116
+ else
117
+ raise EwsCreateItemError, "Could not update calendar item."
118
+ end
103
119
  end
104
120
  end
105
121
 
@@ -20,7 +20,11 @@ module Viewpoint::EWS::Types
20
20
  if rm && rm.success?
21
21
  Task.new ews, rm.items.first[:task][:elems].first
22
22
  else
23
- raise EwsCreateItemError, "Could not create item in folder. #{rm.code}: #{rm.message_text}" unless rm
23
+ if rm
24
+ raise EwsCreateItemError, "Could not create item in folder. #{rm.code}: #{rm.message_text}"
25
+ else
26
+ raise EwsCreateItemError, "Could not create item in folder."
27
+ end
24
28
  end
25
29
  end
26
30
  end
metadata CHANGED
@@ -1,17 +1,49 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: viewpoint
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Wanek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-02 00:00:00.000000000 Z
11
+ date: 2025-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "!="
18
+ - !ruby/object:Gem::Version
19
+ version: 1.12.3
20
+ - - "!="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.12.2
23
+ - - "!="
24
+ - !ruby/object:Gem::Version
25
+ version: 1.12.1
26
+ - - "!="
27
+ - !ruby/object:Gem::Version
28
+ version: 1.12.0
29
+ type: :runtime
30
+ prerelease: false
31
+ version_requirements: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - "!="
34
+ - !ruby/object:Gem::Version
35
+ version: 1.12.3
36
+ - - "!="
37
+ - !ruby/object:Gem::Version
38
+ version: 1.12.2
39
+ - - "!="
40
+ - !ruby/object:Gem::Version
41
+ version: 1.12.1
42
+ - - "!="
43
+ - !ruby/object:Gem::Version
44
+ version: 1.12.0
45
+ - !ruby/object:Gem::Dependency
46
+ name: httpclient
15
47
  requirement: !ruby/object:Gem::Requirement
16
48
  requirements:
17
49
  - - ">="
@@ -25,7 +57,7 @@ dependencies:
25
57
  - !ruby/object:Gem::Version
26
58
  version: '0'
27
59
  - !ruby/object:Gem::Dependency
28
- name: httpclient
60
+ name: rubyntlm
29
61
  requirement: !ruby/object:Gem::Requirement
30
62
  requirements:
31
63
  - - ">="
@@ -39,7 +71,7 @@ dependencies:
39
71
  - !ruby/object:Gem::Version
40
72
  version: '0'
41
73
  - !ruby/object:Gem::Dependency
42
- name: rubyntlm
74
+ name: logging
43
75
  requirement: !ruby/object:Gem::Requirement
44
76
  requirements:
45
77
  - - ">="
@@ -53,7 +85,21 @@ dependencies:
53
85
  - !ruby/object:Gem::Version
54
86
  version: '0'
55
87
  - !ruby/object:Gem::Dependency
56
- name: logging
88
+ name: syslog
89
+ requirement: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ type: :runtime
95
+ prerelease: false
96
+ version_requirements: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ - !ruby/object:Gem::Dependency
102
+ name: mutex_m
57
103
  requirement: !ruby/object:Gem::Requirement
58
104
  requirements:
59
105
  - - ">="
@@ -185,7 +231,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
231
  - !ruby/object:Gem::Version
186
232
  version: '0'
187
233
  requirements: []
188
- rubygems_version: 3.0.8
234
+ rubygems_version: 3.5.1
189
235
  signing_key:
190
236
  specification_version: 4
191
237
  summary: A Ruby client access library for Microsoft Exchange Web Services (EWS)