groupwise 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,40 @@
1
+ GroupWise Schemas
2
+
3
+
4
+ The GroupWise WSDL and schemas are written using industry standards from W3c. You can find the link to the XML schemas definitions at: http://www.w3.org/XML/Schema. From the point of GroupWise, we provide developers schemas and WSDL files. Developers decide the specific development framework they want to use to build GroupWise applications. Each development framework compiles its own library with the GroupWise schemas and WSDL. Different frameworks have different levels of support for Web Services. This means that each generated library could have a different set of bugs.
5
+
6
+ In GroupWise development, we have tested with Sun's Java libraries and Microsoft .Net. Sun's Java libraries support our schemas without any modifications. However, we have found some issues with Microsoft's implementation of the GroupWise schemas. For Microsoft .Net 2003 and 2005, we provide a set of schemas that will work.
7
+
8
+
9
+ GroupWise 2012
10
+
11
+ We have included the GroupWise 2012 schemas. You will find the shipping schemas for GroupWise 2012 and 2012 SP1.
12
+
13
+
14
+ GroupWise 8
15
+
16
+ In GroupWise 8, we have consolidated the schemas down to one set for all frameworks. In GroupWise 7, we had a general set of schemas for all frameworks except .Net. We had a separate set of schemas for .Net.
17
+
18
+ In the GW8 directory, you will find the WSDL and schema files. Below this is a directory called "Differences - GW703 and GW8". This directory contains the differences between the GroupWise 7.03 and GroupWise 8 WSDL and schemas in HTML format. This may prove useful in understanding the changes.
19
+
20
+
21
+ GroupWise 7 Only
22
+
23
+ We have included the GroupWise 7 schemas for convenience. You will find the shipping schemas for GroupWise 7 SP1, SP2 and SP3.
24
+
25
+
26
+
27
+ Using the Right Schema in GroupWise 7
28
+
29
+ With each iteration of GroupWise, GroupWise schemas and WSDL will change. Our intention is to make sure that we are backward compatible with older versions of the schema. However, we can't predict how each development framework will react to schema changes. We don't have the time or the resources to verify that all developement frameworks are backward compatible with our schema changes.
30
+
31
+ In the GroupWise Web Services download, you will find the "WSDL and schema" directory. In that directory, you will find the GW7SP1 and GW7SP2 directory. It has the GroupWise 7 SP1 and SP2 WSDL and schemas. We recommend using the SP2 schemas. Libraries build using the SP2 schemas should work with GroupWise 7 SP1 POAs.
32
+
33
+ If you are using Microsoft .Net 2003 or 2005. See below for more information.
34
+
35
+
36
+ Microsoft .Net 2003 and 2005
37
+
38
+ We have found that Microsoft .Net 2003 and 2005 do not support some W3C schema elements. We have modified the schemas to address the issues. You can find the .Net schemas in the MS.Net directory below the WSDL and schemas directory. We can't say for certain that we have identified all .Net schema issues. Despite the schema changes, we believe that GroupWise Web Services and .Net should work together.
39
+
40
+ The following list is not comprehensive. Diff the schemas in the "WSDL and schemas" and the MS.Net directory for a complete list.
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'groupwise/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "groupwise"
8
+ spec.version = Groupwise::VERSION
9
+ spec.authors = ["Curtis Schiewek"]
10
+ spec.email = ["curtis.schiewek@gmail.com"]
11
+ spec.summary = %q{Wrapper for Groupwise SOAP web services.}
12
+ spec.description = spec.summary
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "savon", "~> 2.6.0", ">= 2.6.0"
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.6"
24
+ spec.add_development_dependency "rake", "~> 10.3.2", ">= 10.3.2"
25
+ spec.add_development_dependency "rspec", "~> 3.0.0", ">= 3.0.0"
26
+ spec.add_development_dependency "debugger", "~> 1.6.8", ">= 1.6.8"
27
+ end
@@ -0,0 +1,16 @@
1
+ require 'savon'
2
+ require 'groupwise/version'
3
+
4
+ module Groupwise
5
+ require 'groupwise/free_busy_session_message'
6
+ require 'groupwise/post_office_agent'
7
+
8
+ def self.wsdl_version(version)
9
+ version = version.tr('.','').to_i
10
+ dir = File.expand_path('../../contrib/novell/GW*', __FILE__)
11
+ versions = Dir[dir].map do |dir|
12
+ dir.match(/(?<=GW)([^\n\r]*)/).captures.first.to_i
13
+ end
14
+ versions.min{|a,b| (version-a).abs <=> (version-b).abs }.to_s
15
+ end
16
+ end
@@ -0,0 +1,22 @@
1
+ module Groupwise
2
+ class FreeBusySessionMessage
3
+ def initialize(email_addresses, start_time = nil, end_time = nil)
4
+ @email_addresses = email_addresses.is_a?(Array) ? email_addresses : [email_addresses]
5
+ @start_time, @end_time = start_time, end_time
6
+ end
7
+
8
+ def to_s
9
+ builder = Builder::XmlMarkup.new
10
+
11
+ builder.users { |b|
12
+ @email_addresses.each do |email|
13
+ b.user { |u| u.email(email) }
14
+ end
15
+ }
16
+ builder.startDate(@start_time.utc.iso8601) if @start_time
17
+ builder.endDate(@end_time.utc.iso8601) if @end_time
18
+
19
+ builder
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,68 @@
1
+ module Groupwise
2
+ class PostOfficeAgent
3
+ attr_reader :endpoint, :client
4
+
5
+ def initialize(endpoint, username, app_name, app_key)
6
+ @endpoint, @username, @app_name, @app_key = endpoint, username, app_name, app_key
7
+ @client = Savon.client(wsdl: wsdl, endpoint: endpoint)
8
+ login
9
+ end
10
+
11
+ def version
12
+ @version ||= begin
13
+ body = HTTPI.get(HTTPI::Request.new(endpoint)).body
14
+ version = body.match(/(?<=POA )([^\n\r]*)/).captures.first
15
+ end
16
+ end
17
+
18
+ def wsdl
19
+ @wsdl ||= begin
20
+ wsdl_version = Groupwise.wsdl_version(version)
21
+ File.expand_path("../../../contrib/novell/GW#{wsdl_version}/groupwise.wsdl", __FILE__)
22
+ end
23
+ end
24
+
25
+ def logout
26
+ response = authenticated_request(:logout)
27
+ @session = nil if response[:status][:code] == '0'
28
+ return response
29
+ end
30
+
31
+ def free_busy(email_addresses, wait_time = 0, start_time = nil, end_time = nil)
32
+ message = { free_busy_session_id: free_busy_session(email_addresses, start_time, end_time) }
33
+ sleep wait_time
34
+ response = authenticated_request(:get_free_busy, message)[:free_busy_info]
35
+ end
36
+
37
+ private
38
+
39
+ def login
40
+ message = {
41
+ auth: { username: @username, name: @app_name, key: @app_key },
42
+ version: '1.05', language: 'en',
43
+ attributes!: { auth: { 'xsi:type' => 'q1:TrustedApplication' } }
44
+ }
45
+ response = @client.call(:login_request, message: message)
46
+ @session = response.body[:login_response][:session]
47
+ response.body[:login_response]
48
+ end
49
+
50
+ def authenticated_request(method, message = nil)
51
+ response = @client.call(
52
+ "#{method}_request".to_sym,
53
+ message: message,
54
+ soap_header: { session: @session }
55
+ )
56
+ response.body["#{method}_response".to_sym]
57
+ end
58
+
59
+ def free_busy_session(email_addresses, start_time = nil, end_time = nil)
60
+ @free_busy_session ||= begin
61
+ message = FreeBusySessionMessage.new(email_addresses, start_time, end_time)
62
+ response = authenticated_request(:start_free_busy_session, message)
63
+ response[:free_busy_session_id]
64
+ end
65
+ end
66
+
67
+ end
68
+ end
@@ -0,0 +1,3 @@
1
+ module Groupwise
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,41 @@
1
+ require 'spec_helper'
2
+ require 'groupwise'
3
+ include Groupwise
4
+
5
+ describe PostOfficeAgent do
6
+ before do
7
+ @config = RSpec.configuration.groupwise_config['post_office_agent']
8
+ @poa = PostOfficeAgent.new(
9
+ @config['endpoint'], @config['username'], @config['app_name'], @config['app_key']
10
+ )
11
+ end
12
+
13
+ it 'should have an endpoint' do
14
+ expect(@poa.endpoint).to eq(@config['endpoint'])
15
+ end
16
+
17
+ it 'should detect the version' do
18
+ expect(@poa.version).to eq(@config['version'])
19
+ end
20
+
21
+ it 'should set the wsdl' do
22
+ expect(@poa.wsdl.split('/').last).to eq('groupwise.wsdl')
23
+ end
24
+
25
+ it 'should have a Savon client' do
26
+ expect(@poa.client).to be_a(Savon::Client)
27
+ end
28
+
29
+ it 'should set the session' do
30
+ expect(@poa.instance_variable_get('@session')).to_not be_nil
31
+ end
32
+
33
+ it 'should allow you to logout' do
34
+ expect(@poa.logout[:status][:code]).to eq('0')
35
+ end
36
+
37
+ it 'should be return free busy information' do
38
+ email_addresses = @config['users']
39
+ expect(@poa.free_busy(email_addresses)).to_not be_nil
40
+ end
41
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Version' do
4
+ it 'should exist' do
5
+ expect(Groupwise::VERSION).to_not be_nil
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ post_office_agent:
2
+ endpoint: 'http://127.0.0.1:7191/soap'
3
+ username: 'user'
4
+ app_name: 'TrustedApplication'
5
+ app_key: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
6
+ version: '12.0.2'
7
+ users:
8
+ - 'john.doe@domain.com'
9
+ - 'jane.doe@domain.com'
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe Groupwise do
4
+ it 'should be defined' do
5
+ expect(defined?(Groupwise)).to eq('constant')
6
+ end
7
+
8
+ describe '.wsdl_version' do
9
+ it 'should return the closest matching version' do
10
+ expect(Groupwise.wsdl_version('12.0.2')).to eq('1201')
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,6 @@
1
+ require 'yaml'
2
+
3
+ RSpec.configure do |config|
4
+ config.add_setting :groupwise_config,
5
+ default: YAML.load(File.read('./spec/groupwise_config.yml'))
6
+ end
metadata ADDED
@@ -0,0 +1,173 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: groupwise
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Curtis Schiewek
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-07-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: savon
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 2.6.0
20
+ - - '>='
21
+ - !ruby/object:Gem::Version
22
+ version: 2.6.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 2.6.0
30
+ - - '>='
31
+ - !ruby/object:Gem::Version
32
+ version: 2.6.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: bundler
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ~>
38
+ - !ruby/object:Gem::Version
39
+ version: '1.6'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ version: '1.6'
47
+ - !ruby/object:Gem::Dependency
48
+ name: rake
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 10.3.2
54
+ - - '>='
55
+ - !ruby/object:Gem::Version
56
+ version: 10.3.2
57
+ type: :development
58
+ prerelease: false
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ~>
62
+ - !ruby/object:Gem::Version
63
+ version: 10.3.2
64
+ - - '>='
65
+ - !ruby/object:Gem::Version
66
+ version: 10.3.2
67
+ - !ruby/object:Gem::Dependency
68
+ name: rspec
69
+ requirement: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ~>
72
+ - !ruby/object:Gem::Version
73
+ version: 3.0.0
74
+ - - '>='
75
+ - !ruby/object:Gem::Version
76
+ version: 3.0.0
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ~>
82
+ - !ruby/object:Gem::Version
83
+ version: 3.0.0
84
+ - - '>='
85
+ - !ruby/object:Gem::Version
86
+ version: 3.0.0
87
+ - !ruby/object:Gem::Dependency
88
+ name: debugger
89
+ requirement: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: 1.6.8
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: 1.6.8
97
+ type: :development
98
+ prerelease: false
99
+ version_requirements: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: 1.6.8
104
+ - - '>='
105
+ - !ruby/object:Gem::Version
106
+ version: 1.6.8
107
+ description: Wrapper for Groupwise SOAP web services.
108
+ email:
109
+ - curtis.schiewek@gmail.com
110
+ executables: []
111
+ extensions: []
112
+ extra_rdoc_files: []
113
+ files:
114
+ - .gitignore
115
+ - .rspec
116
+ - Gemfile
117
+ - LICENSE.txt
118
+ - README.md
119
+ - Rakefile
120
+ - contrib/novell/GW1200/archive.wsdl
121
+ - contrib/novell/GW1200/archive.xsd
122
+ - contrib/novell/GW1200/events.xsd
123
+ - contrib/novell/GW1200/groupwise.wsdl
124
+ - contrib/novell/GW1200/methods.xsd
125
+ - contrib/novell/GW1200/types.xsd
126
+ - contrib/novell/GW1201/archive.wsdl
127
+ - contrib/novell/GW1201/archive.xsd
128
+ - contrib/novell/GW1201/events.xsd
129
+ - contrib/novell/GW1201/groupwise.wsdl
130
+ - contrib/novell/GW1201/methods.xsd
131
+ - contrib/novell/GW1201/types.xsd
132
+ - contrib/novell/readme.txt
133
+ - groupwise.gemspec
134
+ - lib/groupwise.rb
135
+ - lib/groupwise/free_busy_session_message.rb
136
+ - lib/groupwise/post_office_agent.rb
137
+ - lib/groupwise/version.rb
138
+ - spec/groupwise/post_office_agent_spec.rb
139
+ - spec/groupwise/version_spec.rb
140
+ - spec/groupwise_config.yml.sample
141
+ - spec/groupwise_spec.rb
142
+ - spec/spec_helper.rb
143
+ homepage: ''
144
+ licenses:
145
+ - MIT
146
+ metadata: {}
147
+ post_install_message:
148
+ rdoc_options: []
149
+ require_paths:
150
+ - lib
151
+ required_ruby_version: !ruby/object:Gem::Requirement
152
+ requirements:
153
+ - - '>='
154
+ - !ruby/object:Gem::Version
155
+ version: '0'
156
+ required_rubygems_version: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - '>='
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ requirements: []
162
+ rubyforge_project:
163
+ rubygems_version: 2.3.0
164
+ signing_key:
165
+ specification_version: 4
166
+ summary: Wrapper for Groupwise SOAP web services.
167
+ test_files:
168
+ - spec/groupwise/post_office_agent_spec.rb
169
+ - spec/groupwise/version_spec.rb
170
+ - spec/groupwise_config.yml.sample
171
+ - spec/groupwise_spec.rb
172
+ - spec/spec_helper.rb
173
+ has_rdoc: