viewpoint 0.1.9 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/field_hash.txt +197 -0
- data/lib/field_hash2.txt +1 -0
- data/lib/model/calendar_folder.rb +13 -15
- data/lib/model/contact.rb +83 -0
- data/lib/model/generic_folder.rb +12 -11
- data/lib/model/item.rb +44 -5
- data/lib/model/item_attachment.rb +2 -1
- data/lib/model/item_field_uri_map.rb +206 -0
- data/lib/model/message.rb +4 -4
- data/lib/model/model.rb +41 -3
- data/lib/model/task.rb +7 -9
- data/lib/soap/handsoap/ews_service.rb +7 -3
- data/lib/soap/handsoap/parsers/ews_parser.rb +4 -1
- data/lib/viewpoint.rb +3 -0
- metadata +32 -38
- data/Rakefile +0 -79
- data/VERSION +0 -1
- data/preamble +0 -19
- data/test/.rspec +0 -7
- data/test/spec/basic_functions.spec +0 -69
- data/test/spec/folder_subscriptions.spec +0 -35
- data/test/spec/folder_synchronization.spec +0 -36
- data/test/spec/item_tests.spec +0 -44
- data/utils/ewsWSDL2rb.rb +0 -29
data/Rakefile
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rake/clean'
|
3
|
-
require 'rake/gempackagetask'
|
4
|
-
require 'date'
|
5
|
-
require 'metric_fu'
|
6
|
-
|
7
|
-
CLEAN.include("pkg")
|
8
|
-
CLEAN.include("doc")
|
9
|
-
|
10
|
-
GEMSPEC = Gem::Specification.new do |gem|
|
11
|
-
gem.name = "viewpoint"
|
12
|
-
gem.version = File.open('VERSION').readline.chomp
|
13
|
-
gem.date = Date.today.to_s
|
14
|
-
gem.platform = Gem::Platform::RUBY
|
15
|
-
gem.rubyforge_project = nil
|
16
|
-
|
17
|
-
gem.author = "Dan Wanek"
|
18
|
-
gem.email = "dan.wanek@gmail.com"
|
19
|
-
gem.homepage = "http://github.com/zenchild/Viewpoint"
|
20
|
-
|
21
|
-
gem.summary = "A Ruby client access library for Microsoft Exchange Web Services (EWS)"
|
22
|
-
gem.description = <<-EOF
|
23
|
-
A Ruby client access library for Microsoft Exchange Web Services (EWS). Examples can be found here: http://distributed-frostbite.blogspot.com
|
24
|
-
EOF
|
25
|
-
|
26
|
-
gem.files = `git ls-files`.split(/\n/)
|
27
|
-
gem.require_path = "lib"
|
28
|
-
gem.rdoc_options = %w(-x test/ -x examples/)
|
29
|
-
gem.extra_rdoc_files = %w(README COPYING.txt)
|
30
|
-
|
31
|
-
gem.required_ruby_version = '>= 1.8.7'
|
32
|
-
gem.add_runtime_dependency 'handsoap'
|
33
|
-
gem.add_runtime_dependency 'nokogiri'
|
34
|
-
gem.add_runtime_dependency 'httpclient'
|
35
|
-
gem.add_runtime_dependency 'rubyntlm'
|
36
|
-
gem.add_runtime_dependency 'icalendar', '>= 1.1.5'
|
37
|
-
gem.add_runtime_dependency 'mail', '>= 2.2.5'
|
38
|
-
end
|
39
|
-
|
40
|
-
Rake::GemPackageTask.new(GEMSPEC) do |pkg|
|
41
|
-
pkg.need_tar = true
|
42
|
-
end
|
43
|
-
|
44
|
-
task :default => [:buildgem]
|
45
|
-
|
46
|
-
desc "Build the gem without a version change"
|
47
|
-
task :buildgem => [:clean, :repackage]
|
48
|
-
|
49
|
-
desc "Build the gem, but increment the version first"
|
50
|
-
task :newrelease => [:versionup, :clean, :repackage]
|
51
|
-
|
52
|
-
|
53
|
-
desc "Increment the version by 1 minor release"
|
54
|
-
task :versionup do
|
55
|
-
ver = up_min_version
|
56
|
-
puts "New version: #{ver}"
|
57
|
-
end
|
58
|
-
|
59
|
-
|
60
|
-
def up_min_version
|
61
|
-
f = File.open('VERSION', 'r+')
|
62
|
-
ver = f.readline.chomp
|
63
|
-
v_arr = ver.split(/\./).map do |v|
|
64
|
-
v.to_i
|
65
|
-
end
|
66
|
-
v_arr[2] += 1
|
67
|
-
ver = v_arr.join('.')
|
68
|
-
f.rewind
|
69
|
-
f.write(ver)
|
70
|
-
ver
|
71
|
-
end
|
72
|
-
|
73
|
-
MetricFu::Configuration.run do |config|
|
74
|
-
#define which metrics you want to use
|
75
|
-
# config.metrics = [:churn, :saikuro, :stats, :flog, :flay]
|
76
|
-
config.metrics = [:flog, :flay]
|
77
|
-
config.graphs = [:flog, :flay]
|
78
|
-
end
|
79
|
-
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.1.9
|
data/preamble
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
#############################################################################
|
2
|
-
# Copyright © 2010 Dan Wanek <dan.wanek@gmail.com>
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# This file is part of Viewpoint.
|
6
|
-
#
|
7
|
-
# Viewpoint is free software: you can redistribute it and/or
|
8
|
-
# modify it under the terms of the GNU General Public License as published
|
9
|
-
# by the Free Software Foundation, either version 3 of the License, or (at
|
10
|
-
# your option) any later version.
|
11
|
-
#
|
12
|
-
# Viewpoint is distributed in the hope that it will be useful,
|
13
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
15
|
-
# Public License for more details.
|
16
|
-
#
|
17
|
-
# You should have received a copy of the GNU General Public License along
|
18
|
-
# with Viewpoint. If not, see <http://www.gnu.org/licenses/>.
|
19
|
-
#############################################################################
|
data/test/.rspec
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
$: << File.dirname(__FILE__) + '/../../lib/'
|
2
|
-
require 'kconv'
|
3
|
-
require 'viewpoint'
|
4
|
-
require 'json'
|
5
|
-
|
6
|
-
# To run this test put a file called 'creds.json' in this directory with the following format:
|
7
|
-
# {"user":"myuser","pass":"mypass","endpoint":"https://mydomain.com/ews/exchange.asmx"}
|
8
|
-
|
9
|
-
|
10
|
-
describe "Test the basic features of Viewpoint" do
|
11
|
-
before(:all) do
|
12
|
-
creds = JSON.load(File.open('spec/creds.json','r'))
|
13
|
-
Viewpoint::EWS::EWS.endpoint = creds['endpoint']
|
14
|
-
Viewpoint::EWS::EWS.set_auth(creds['user'],creds['pass'])
|
15
|
-
@ews = Viewpoint::EWS::EWS.instance
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'should retrieve the various Folder Types' do
|
19
|
-
(Viewpoint::EWS::GenericFolder.get_folder :inbox).should be_instance_of(Viewpoint::EWS::Folder)
|
20
|
-
(Viewpoint::EWS::GenericFolder.get_folder :calendar).should be_instance_of(Viewpoint::EWS::CalendarFolder)
|
21
|
-
(Viewpoint::EWS::GenericFolder.get_folder :contacts).should be_instance_of(Viewpoint::EWS::ContactsFolder)
|
22
|
-
(Viewpoint::EWS::GenericFolder.get_folder :tasks).should be_instance_of(Viewpoint::EWS::TasksFolder)
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'should retrive the Inbox by name' do
|
26
|
-
(Viewpoint::EWS::GenericFolder.get_folder_by_name 'Inbox').should be_instance_of(Viewpoint::EWS::Folder)
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'should retrive the Inbox by FolderId' do
|
30
|
-
inbox = Viewpoint::EWS::GenericFolder.get_folder_by_name 'Inbox'
|
31
|
-
(Viewpoint::EWS::GenericFolder.get_folder inbox.id).should be_instance_of(Viewpoint::EWS::Folder)
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'should retrieve an Array of Folder Types' do
|
35
|
-
flds = Viewpoint::EWS::GenericFolder.find_folders
|
36
|
-
flds.should be_instance_of(Array)
|
37
|
-
flds.first.should be_kind_of(Viewpoint::EWS::GenericFolder)
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'should retrieve messages from a mail folder' do
|
41
|
-
inbox = Viewpoint::EWS::GenericFolder.get_folder :inbox
|
42
|
-
msgs = inbox.find_items
|
43
|
-
msgs.should be_instance_of(Array)
|
44
|
-
if(msgs.length > 0)
|
45
|
-
msgs.first.should be_kind_of(Viewpoint::EWS::Item)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'should retrieve an item by id if one exists' do
|
50
|
-
inbox = Viewpoint::EWS::GenericFolder.get_folder :inbox
|
51
|
-
msgs = inbox.find_items
|
52
|
-
if(msgs.length > 0)
|
53
|
-
item = inbox.get_item(msgs.first.id)
|
54
|
-
item.should be_kind_of(Viewpoint::EWS::Item)
|
55
|
-
else
|
56
|
-
msgs.should be_empty
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
it 'should retrieve a folder by name' do
|
61
|
-
inbox = Viewpoint::EWS::GenericFolder.get_folder_by_name("Inbox")
|
62
|
-
inbox.should be_instance_of(Viewpoint::EWS::Folder)
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'should retrieve a list of folder names' do
|
66
|
-
Viewpoint::EWS::GenericFolder.folder_names.should_not be_empty
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
$: << File.dirname(__FILE__) + '/../../lib/'
|
2
|
-
require 'kconv'
|
3
|
-
require 'viewpoint'
|
4
|
-
require 'json'
|
5
|
-
|
6
|
-
# To run this test put a file called 'creds.json' in this directory with the following format:
|
7
|
-
# {"user":"myuser","pass":"mypass","endpoint":"https://mydomain.com/ews/exchange.asmx"}
|
8
|
-
|
9
|
-
|
10
|
-
describe "Folder Subscriptions" do
|
11
|
-
before(:all) do
|
12
|
-
creds = JSON.load(File.open('spec/creds.json','r'))
|
13
|
-
Viewpoint::EWS::EWS.endpoint = creds['endpoint']
|
14
|
-
Viewpoint::EWS::EWS.set_auth(creds['user'],creds['pass'])
|
15
|
-
@ews = Viewpoint::EWS::EWS.instance
|
16
|
-
@inbox = Viewpoint::EWS::GenericFolder.get_folder :inbox
|
17
|
-
end
|
18
|
-
|
19
|
-
describe "Example Folder Subscription for the Inbox" do
|
20
|
-
|
21
|
-
it 'should subscribe to the Inbox Folder' do
|
22
|
-
@inbox.subscribe.should be_true
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'should retrieve new subscription events' do
|
26
|
-
@inbox.get_events.should_not be_empty
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'should unsubscribe to the Inbox Folder' do
|
30
|
-
@inbox.unsubscribe.should be_true
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
$: << File.dirname(__FILE__) + '/../../lib/'
|
2
|
-
require 'kconv'
|
3
|
-
require 'viewpoint'
|
4
|
-
require 'json'
|
5
|
-
|
6
|
-
# To run this test put a file called 'creds.json' in this directory with the following format:
|
7
|
-
# {"user":"myuser","pass":"mypass","endpoint":"https://mydomain.com/ews/exchange.asmx"}
|
8
|
-
|
9
|
-
|
10
|
-
describe "Folder Synchronization" do
|
11
|
-
before(:all) do
|
12
|
-
creds = JSON.load(File.open('spec/creds.json','r'))
|
13
|
-
Viewpoint::EWS::EWS.endpoint = creds['endpoint']
|
14
|
-
Viewpoint::EWS::EWS.set_auth(creds['user'],creds['pass'])
|
15
|
-
@ews = Viewpoint::EWS::EWS.instance
|
16
|
-
@inbox = Viewpoint::EWS::GenericFolder.get_folder :inbox
|
17
|
-
end
|
18
|
-
|
19
|
-
describe "An unsynchronized Inbox Folder" do
|
20
|
-
after(:all) do
|
21
|
-
@inbox.clear_sync_state!
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'should start synchronization of the Inbox Folder' do
|
25
|
-
@inbox.sync_items!(2)
|
26
|
-
@inbox.sync_state.should_not be_nil
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'should synchronized to a given DateTime' do
|
30
|
-
@inbox.sync_items_since!(DateTime.parse((Date.today - 1).to_s))
|
31
|
-
@inbox.sync_state.should_not be_nil
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
data/test/spec/item_tests.spec
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
$: << File.dirname(__FILE__) + '/../../lib/'
|
2
|
-
require 'kconv'
|
3
|
-
require 'viewpoint'
|
4
|
-
require 'json'
|
5
|
-
|
6
|
-
# To run this test put a file called 'creds.json' in this directory with the following format:
|
7
|
-
# {"user":"myuser","pass":"mypass","endpoint":"https://mydomain.com/ews/exchange.asmx"}
|
8
|
-
|
9
|
-
|
10
|
-
describe "Test the basic functionality of Items" do
|
11
|
-
before(:all) do
|
12
|
-
creds = JSON.load(File.open('spec/creds.json','r'))
|
13
|
-
Viewpoint::EWS::EWS.endpoint = creds['endpoint']
|
14
|
-
Viewpoint::EWS::EWS.set_auth(creds['user'],creds['pass'])
|
15
|
-
@ews = Viewpoint::EWS::EWS.instance
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'should create a new Message Item (with attachments) that we can test with.' do
|
19
|
-
f = File.open(File.expand_path(__FILE__), 'r+')
|
20
|
-
$message = Viewpoint::EWS::Message.send('RSPEC test subject', 'RSPEC test body', [@ews.me.email_address],nil,nil,[f],true)
|
21
|
-
$message.should be_instance_of(Viewpoint::EWS::Message)
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'should move the Message Item to the Inbox folder' do
|
25
|
-
inbox = Viewpoint::EWS::GenericFolder.get_folder :inbox
|
26
|
-
$message.move!(inbox).should be_true
|
27
|
-
end
|
28
|
-
it 'should copy the Message Item to the Drafts folder' do
|
29
|
-
drafts = Viewpoint::EWS::GenericFolder.get_folder :drafts
|
30
|
-
$msg_copy = $message.copy(drafts)
|
31
|
-
$msg_copy.should be_instance_of(Viewpoint::EWS::Message)
|
32
|
-
end
|
33
|
-
|
34
|
-
describe "Clean up after ourselves." do
|
35
|
-
it 'should delete the initial Message' do
|
36
|
-
$message.delete!.should be_true
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'should send the copy message to Deleted Items' do
|
40
|
-
$msg_copy.recycle!.should be_true
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
data/utils/ewsWSDL2rb.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'nokogiri'
|
3
|
-
|
4
|
-
wsdl = Nokogiri::XML(File.read('Services.wsdl'))
|
5
|
-
|
6
|
-
methods = []
|
7
|
-
|
8
|
-
wsdl.xpath('//wsdl:binding/wsdl:operation').each do |op|
|
9
|
-
meth_name = op[:name].gsub(/([a-z])([A-Z])/, '\1_\2').downcase
|
10
|
-
methods << meth_name
|
11
|
-
str = " def #{meth_name}\n"
|
12
|
-
str << " action = '#{op.xpath('soap:operation').first[:soapAction]}'\n"
|
13
|
-
str << " resp = invoke('tns:#{op[:name]}', :soap_action => action) do |#{meth_name}|\n"
|
14
|
-
str << " build_#{meth_name}!(#{meth_name})\n"
|
15
|
-
str << " end\n"
|
16
|
-
str << " parse_#{meth_name}(resp)\n"
|
17
|
-
str << " end\n\n"
|
18
|
-
puts str
|
19
|
-
end
|
20
|
-
|
21
|
-
puts "\n\n ## Helper methods (builders and parsers)\n"
|
22
|
-
puts " private\n\n"
|
23
|
-
methods.each do |meth|
|
24
|
-
str = " def build_#{meth}!(#{meth})\n"
|
25
|
-
str << " end\n\n"
|
26
|
-
str << " def parse_#{meth}()\n"
|
27
|
-
str << " end\n\n"
|
28
|
-
puts str
|
29
|
-
end
|