viewpoint 1.1.0 → 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
- SHA1:
3
- metadata.gz: 4c7f0f3182b5374e87a352b910d8a4437adeeb7e
4
- data.tar.gz: 4f5418c72292865e2e041f8fdf2db2c3a975774d
2
+ SHA256:
3
+ metadata.gz: 13ece8332b00329ee37c4cffa26e56e1556c80984b9d37d0ae60ace1fc347e3d
4
+ data.tar.gz: 8d7b1dfa6bf36a537a28506fd444ecae58332d2f063288b9ee8c898cb48a08fe
5
5
  SHA512:
6
- metadata.gz: e8650776addf7c9b89a3351150106596252bffa3363e6c625cb14143da2c0f4d818cc7db12fe0c4ce4f970fab70d3a0f25fc7014f099032daa53f2e0fb435d9e
7
- data.tar.gz: bd58e56479fd14c718d02392444a018128efe60e147d97bc4e8ad7203db3d91a4ef87090667e55bcf8050dda5a5ea87fa37d2bed00e92f8337577e31131c9f31
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
@@ -115,9 +115,20 @@ private
115
115
  }
116
116
  default_args[:item_ids] = case item_id
117
117
  when Hash
118
- [{:item_id => item_id}]
118
+ if item_id.keys.index(:id)
119
+ [{:item_id => item_id}]
120
+ else
121
+ [item_id]
122
+ end
119
123
  when Array
120
- item_id.map{|i| {:item_id => {:id => i}}}
124
+ item_id.map do |i|
125
+ case i
126
+ when Hash
127
+ i
128
+ else
129
+ {:item_id => {:id => i}}
130
+ end
131
+ end
121
132
  else
122
133
  [{:item_id => {:id => item_id}}]
123
134
  end
@@ -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)
@@ -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 {
@@ -1186,10 +1193,9 @@ module Viewpoint::EWS::SOAP
1186
1193
  when :item_id
1187
1194
  item_id!(item)
1188
1195
  when :occurrence_item_id
1189
- occurrence_item_id!(
1190
- item[:recurring_master_id], item[:change_key], item[:instance_index])
1196
+ occurrence_item_id!(item)
1191
1197
  when :recurring_master_item_id
1192
- recurring_master_item_id!(item[:occurrence_id], item[:change_key])
1198
+ recurring_master_item_id!(item)
1193
1199
  else
1194
1200
  raise EwsBadArgumentError, "Bad ItemId type. #{type}"
1195
1201
  end
@@ -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.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Wanek
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-09 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
  - - ">="
@@ -166,7 +212,7 @@ files:
166
212
  homepage: http://github.com/zenchild/Viewpoint
167
213
  licenses: []
168
214
  metadata: {}
169
- post_install_message:
215
+ post_install_message:
170
216
  rdoc_options:
171
217
  - "-x"
172
218
  - test/
@@ -185,9 +231,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
231
  - !ruby/object:Gem::Version
186
232
  version: '0'
187
233
  requirements: []
188
- rubyforge_project:
189
- rubygems_version: 2.6.6
190
- signing_key:
234
+ rubygems_version: 3.5.1
235
+ signing_key:
191
236
  specification_version: 4
192
237
  summary: A Ruby client access library for Microsoft Exchange Web Services (EWS)
193
238
  test_files: []