inforouter 0.1.0 → 0.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 +8 -8
- data/.gitignore +1 -0
- data/.rubocop.yml +1 -1
- data/.travis.yml +5 -0
- data/Gemfile +0 -3
- data/README.md +102 -2
- data/Rakefile +20 -1
- data/inforouter.gemspec +12 -8
- data/lib/config/locales/en.yml +34 -0
- data/lib/inforouter.rb +26 -7
- data/lib/inforouter/access_list.rb +25 -27
- data/lib/inforouter/access_list_domain_members_item.rb +11 -0
- data/lib/inforouter/access_list_user_group_item.rb +17 -0
- data/lib/inforouter/access_list_user_item.rb +17 -0
- data/lib/inforouter/client.rb +19 -16
- data/lib/inforouter/configuration.rb +10 -4
- data/lib/inforouter/document.rb +64 -0
- data/lib/inforouter/errors.rb +2 -0
- data/lib/inforouter/errors/api_error.rb +17 -0
- data/lib/inforouter/errors/inforouter_error.rb +77 -1
- data/lib/inforouter/errors/missing_config_error.rb +1 -1
- data/lib/inforouter/errors/missing_config_option_error.rb +1 -1
- data/lib/inforouter/errors/soap_error.rb +2 -1
- data/lib/inforouter/errors/unexpected_soap_response_error.rb +18 -0
- data/lib/inforouter/folder.rb +139 -0
- data/lib/inforouter/record.rb +13 -0
- data/lib/inforouter/responses.rb +14 -0
- data/lib/inforouter/responses/base.rb +78 -0
- data/lib/inforouter/responses/create_folder.rb +10 -0
- data/lib/inforouter/responses/delete_folder.rb +10 -0
- data/lib/inforouter/responses/document.rb +48 -0
- data/lib/inforouter/responses/document_exists.rb +10 -0
- data/lib/inforouter/responses/folder.rb +33 -0
- data/lib/inforouter/responses/folder_exists.rb +10 -0
- data/lib/inforouter/responses/generic.rb +28 -0
- data/lib/inforouter/responses/set_access_list.rb +10 -0
- data/lib/inforouter/responses/set_folder_rules.rb +10 -0
- data/lib/inforouter/responses/update_folder_properties.rb +10 -0
- data/lib/inforouter/responses/update_property_set_definition.rb +10 -0
- data/lib/inforouter/responses/update_property_set_row.rb +10 -0
- data/lib/inforouter/responses/users.rb +38 -0
- data/lib/inforouter/rights.rb +18 -0
- data/lib/inforouter/rule_item.rb +25 -0
- data/lib/inforouter/rules.rb +51 -0
- data/lib/inforouter/user.rb +39 -0
- data/lib/inforouter/users.rb +25 -0
- data/lib/inforouter/version.rb +1 -1
- data/test/helper.rb +3 -0
- data/test/test_client.rb +4 -0
- data/test/test_configuration.rb +31 -0
- data/test/test_setup.rb +18 -0
- metadata +96 -6
- data/.rspec +0 -2
- data/lib/inforouter/folder_rule.rb +0 -50
- data/spec/spec_helper.rb +0 -29
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MzY1MjIwNGZmMjQ3YjE1NTRjOTcyYTNmYzVjOWU0ZjYxYjQyYTlmNg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MDBkNWZhNWVhMWM1Yzk5YmRkZjMyNWU2M2I0OGQ0MWM0ZjA4N2Q4Yg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YjQzYWQ0MzQwNmExZjNlM2U3NzFmNTEyMjIzYzBkMjA1Y2VlMDJkZGJkNTRi
|
10
|
+
ODA2NTQ1MDQ4N2UzNTYxY2NmZjU4ZmQxOTJjNWFlZmRjNzM4NTU3MGE1NmEz
|
11
|
+
ZjliZDNjOWFlMjE3NjM5ODAyNjU2NTNhNzQ1ZTUxNGZmMjQxZWQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Y2U5NjBmODhjOTA1OTcwZjRlYjQxMDQwZDYyMTdkMWM0MGZhZmQ4NjE3MzBl
|
14
|
+
M2UyMzQ5MDk1OWJhZTQ1OTliNjA0YTc2MDM2YzE3M2ZkMzUzM2RiYzJlMGM5
|
15
|
+
NjhiZTQ5YTNjYmZmODliYWIzNmUzNjE0OTgyMjhmMmM5NWM0ZTA=
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
@@ -9,9 +9,6 @@ gemspec
|
|
9
9
|
# Add dependencies to develop your gem here.
|
10
10
|
# Include everything needed to run rake, tests, features, etc.
|
11
11
|
group :development do
|
12
|
-
gem "rspec", "~> 2.8.0"
|
13
|
-
gem "rdoc", "~> 3.12"
|
14
|
-
gem "bundler", "~> 1.0"
|
15
12
|
gem "jeweler", "~> 2.0.1"
|
16
13
|
gem "simplecov", ">= 0"
|
17
14
|
end
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# The infoRouter Ruby Gem
|
2
2
|
|
3
|
-
[][gem]
|
3
|
+
[][gem]
|
4
4
|
[][travis]
|
5
5
|
|
6
6
|
[gem]: https://rubygems.org/gems/inforouter
|
@@ -27,12 +27,112 @@ Or install it yourself as:
|
|
27
27
|
Configure your environment. For example, create an initializer in Rails in <tt>config/initializers/inforouter.rb</tt>.
|
28
28
|
|
29
29
|
Inforouter.configure do |config|
|
30
|
+
config.wsdl = Rails.root.join('resources', 'inforouter.wsdl')
|
30
31
|
config.host = 'your_inforouter_host'
|
31
32
|
config.username = 'your_inforouter_username'
|
32
33
|
config.password = 'your_inforouter_password'
|
33
34
|
end
|
34
35
|
|
35
|
-
|
36
|
+
## Using Inforouter
|
37
|
+
|
38
|
+
Creating an infoRouter folder using <tt>Inforouter::Folder</tt>.
|
39
|
+
|
40
|
+
folder = Inforouter::Folder.new path: '/Path/To/Folder'
|
41
|
+
folder.create unless folder.exists?
|
42
|
+
folder.description = 'Some description'
|
43
|
+
folder.update_properties
|
44
|
+
|
45
|
+
Make a SOAP request.
|
46
|
+
|
47
|
+
message = {
|
48
|
+
:path => '/Path/To/Document',
|
49
|
+
'withPropertySets' => 1,
|
50
|
+
'withSecurity' => 0,
|
51
|
+
'withOwner' => 0,
|
52
|
+
'withVersions' => 0
|
53
|
+
}
|
54
|
+
response = Inforouter.client.request :get_document, message
|
55
|
+
|
56
|
+
Return all infoRouter users.
|
57
|
+
|
58
|
+
users = Inforouter::Users.all
|
59
|
+
users.each { |user| puts "#{user.id}\t#{user.name}" }
|
60
|
+
|
61
|
+
Return the specified user.
|
62
|
+
|
63
|
+
user = Inforouter::Users['JoeD']
|
64
|
+
puts user.name # => 'Joe Dimaggio'
|
65
|
+
|
66
|
+
Set the access list of a folder in the specified path.
|
67
|
+
|
68
|
+
folder = Inforouter::Folder.new path: '/Path/To/Folder'
|
69
|
+
access_list = Inforouter::AccessList.new
|
70
|
+
access_list.domain_members = Inforouter::AccessListDomainMembersItem.new(
|
71
|
+
right: Inforouter::Rights::ADD_AND_READ
|
72
|
+
)
|
73
|
+
access_list.user_groups << Inforouter::AccessListUserGroupItem.new(
|
74
|
+
name: 'Authors',
|
75
|
+
right: Inforouter::Rights::ADD_AND_READ
|
76
|
+
)
|
77
|
+
access_list.user_groups << Inforouter::AccessListUserGroupItem.new(
|
78
|
+
name: 'Developers',
|
79
|
+
right: Inforouter::Rights::CHANGE
|
80
|
+
)
|
81
|
+
access_list.user_groups << Inforouter::AccessListUserGroupItem.new(
|
82
|
+
domain: 'ProjectX',
|
83
|
+
name: 'Architect',
|
84
|
+
right: Inforouter::Rights::FULL_CONTROL
|
85
|
+
)
|
86
|
+
access_list.users << Inforouter::AccessListUserItem.new(
|
87
|
+
domain: 'ProjectX',
|
88
|
+
name: 'JoeD',
|
89
|
+
right: Inforouter::Rights::ADD_AND_READ
|
90
|
+
)
|
91
|
+
access_list.users << Inforouter::AccessListUserItem.new(
|
92
|
+
domain: 'ProjectX',
|
93
|
+
name: 'JaneC',
|
94
|
+
right: Inforouter::Rights::FULL_CONTROL
|
95
|
+
)
|
96
|
+
access_list.users << Inforouter::AccessListUserItem.new(
|
97
|
+
name: 'SuzanP',
|
98
|
+
right: Inforouter::Rights::FULL_CONTROL
|
99
|
+
)
|
100
|
+
folder.access_list = access_list
|
101
|
+
folder.update_access_list
|
102
|
+
|
103
|
+
The following constants are defined in <tt>rights.rb</tt>.
|
104
|
+
|
105
|
+
* <tt>NO_ACCESS</tt>
|
106
|
+
* <tt>LIST</tt>
|
107
|
+
* <tt>READ</tt>
|
108
|
+
* <tt>ADD</tt>
|
109
|
+
* <tt>ADD_AND_READ</tt>
|
110
|
+
* <tt>CHANGE</tt>
|
111
|
+
* <tt>FULL_CONTROL</tt>
|
112
|
+
|
113
|
+
Sets the rules of the specified folder.
|
114
|
+
|
115
|
+
folder = Inforouter::Folder.new path: '/Path/To/Folder'
|
116
|
+
folder.rules = Inforouter::Rules.new(
|
117
|
+
allowable_file_types: 'BMP,DOC,JPG,XLS',
|
118
|
+
checkins: false,
|
119
|
+
checkouts: false,
|
120
|
+
document_deletes: false,
|
121
|
+
folder_deletes: false,
|
122
|
+
new_documents: false,
|
123
|
+
new_folders: false,
|
124
|
+
classified_documents: true
|
125
|
+
)
|
126
|
+
folder.update_rules
|
127
|
+
|
128
|
+
Boolean rule items default to false and may be omitted.
|
129
|
+
|
130
|
+
folder = Inforouter::Folder.new path: '/Path/To/Folder'
|
131
|
+
folder.rules = Inforouter::Rules.new(
|
132
|
+
allowable_file_types: 'BMP,DOC,JPG,XLS',
|
133
|
+
classified_documents: true
|
134
|
+
)
|
135
|
+
folder.update_rules
|
36
136
|
|
37
137
|
## Contributing
|
38
138
|
|
data/Rakefile
CHANGED
@@ -1 +1,20 @@
|
|
1
|
-
require
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rake/testtask'
|
3
|
+
|
4
|
+
gemspec = eval(File.read(Dir['*.gemspec'].first))
|
5
|
+
|
6
|
+
Rake::TestTask.new(:test) do |test|
|
7
|
+
test.libs << 'lib' << 'test'
|
8
|
+
test.pattern = 'test/test_*.rb'
|
9
|
+
test.verbose = false
|
10
|
+
end
|
11
|
+
|
12
|
+
desc 'Validate the gemspec.'
|
13
|
+
task :gemspec do
|
14
|
+
puts gemspec.validate
|
15
|
+
end
|
16
|
+
|
17
|
+
require 'rubocop/rake_task'
|
18
|
+
Rubocop::RakeTask.new(:rubocop)
|
19
|
+
|
20
|
+
task :default => [:rubocop, :test]
|
data/inforouter.gemspec
CHANGED
@@ -4,22 +4,26 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'inforouter/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'inforouter'
|
8
8
|
spec.version = Inforouter::Version
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
9
|
+
spec.authors = ['Tom Fenton']
|
10
|
+
spec.email = ['tom@ncs.co.nz']
|
11
11
|
spec.description = %q(A Ruby interface to the infoRouter SOAP API.)
|
12
12
|
spec.summary = spec.description
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
13
|
+
spec.homepage = 'https://github.com/ncssoftware/inforouter'
|
14
|
+
spec.license = 'MIT'
|
15
15
|
|
16
|
-
spec.files = `git ls-files`.split(
|
16
|
+
spec.files = `git ls-files`.split("\n")
|
17
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
-
spec.require_paths = [
|
18
|
+
spec.require_paths = ['lib']
|
19
19
|
|
20
20
|
spec.add_dependency 'nokogiri', '~> 1.5.9'
|
21
|
+
spec.add_dependency 'i18n'
|
21
22
|
spec.add_dependency 'savon', '~> 2.4.0'
|
23
|
+
spec.add_dependency 'activesupport', '>= 3.0'
|
22
24
|
|
25
|
+
spec.add_development_dependency 'bundler', '~> 1.0'
|
26
|
+
spec.add_development_dependency 'rdoc', '~> 3.12'
|
23
27
|
spec.add_development_dependency 'rainbow', '~> 1.99.2'
|
24
28
|
spec.add_development_dependency 'rubocop', '~> 0.16.0'
|
25
|
-
|
29
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
en:
|
2
|
+
inforouter:
|
3
|
+
errors:
|
4
|
+
messages:
|
5
|
+
missing_config:
|
6
|
+
message: "Missing configuration."
|
7
|
+
summary: "infoRouter requires a username and password."
|
8
|
+
resolution: "See your infoRouter system administrator for username and
|
9
|
+
password. Configure the inforouter gem. For example, add the
|
10
|
+
following to `config/initializers/inforouter.rb`.\n
|
11
|
+
\_\_Inforouter.configure do |config|\n
|
12
|
+
\_\_\_config.wsdl = 'your_inforouter_wsdl_location' # optional\n
|
13
|
+
\_\_\_config.host = 'your_inforouter_host'\n
|
14
|
+
\_\_\_config.username = 'your_inforouter_username'\n
|
15
|
+
\_\_\_config.password = 'your_inforouter_password'\n
|
16
|
+
\_\_end\n"
|
17
|
+
missing_config_option:
|
18
|
+
message: "Missing configuration option: %{name}."
|
19
|
+
summary: "A configuration option was not provided when configuration infoRouter."
|
20
|
+
resolution: "Review your `Inforouter.configure` code. Are you using an environment
|
21
|
+
variable that has not been set?"
|
22
|
+
soap_error:
|
23
|
+
message: "%{message}"
|
24
|
+
summary: "The server returned a %{code} error."
|
25
|
+
resolution: "Review the parameters passed to the request."
|
26
|
+
unexpected_soap_response:
|
27
|
+
message: "Expected a value for `%{key}` in `%{chain}` in the infoRouter response."
|
28
|
+
summary: "infoRouter returned an unexpected response: `%{raw}`."
|
29
|
+
resolution: "This is possibly a bug in the inforouter gem.\n
|
30
|
+
Please report it in https://github.com/ncssoftware/inforouter/issues."
|
31
|
+
api_error:
|
32
|
+
message: "%{message}"
|
33
|
+
summary: "The infoRouter server returned an error in the response: `%{raw}`"
|
34
|
+
resolution: "Check the request parameters."
|
data/lib/inforouter.rb
CHANGED
@@ -1,16 +1,35 @@
|
|
1
1
|
require 'savon'
|
2
|
+
require 'i18n'
|
3
|
+
require 'active_support'
|
4
|
+
require 'active_support/core_ext'
|
2
5
|
|
6
|
+
require 'inforouter/version'
|
7
|
+
require 'inforouter/errors'
|
8
|
+
require 'inforouter/responses'
|
9
|
+
require 'inforouter/record'
|
3
10
|
require 'inforouter/access_list'
|
4
|
-
require 'inforouter/
|
5
|
-
require 'inforouter/
|
11
|
+
require 'inforouter/access_list_domain_members_item'
|
12
|
+
require 'inforouter/access_list_user_group_item'
|
13
|
+
require 'inforouter/access_list_user_item'
|
14
|
+
require 'inforouter/document'
|
15
|
+
require 'inforouter/folder'
|
16
|
+
require 'inforouter/rights'
|
17
|
+
require 'inforouter/rule_item'
|
18
|
+
require 'inforouter/rules'
|
19
|
+
require 'inforouter/user'
|
20
|
+
require 'inforouter/users'
|
6
21
|
require 'inforouter/configuration'
|
7
|
-
require 'inforouter/
|
8
|
-
|
22
|
+
require 'inforouter/client'
|
23
|
+
|
24
|
+
I18n.load_path << File.join(File.dirname(__FILE__), 'config', 'locales', 'en.yml')
|
9
25
|
|
10
26
|
module Inforouter
|
11
27
|
class << self
|
12
28
|
attr_accessor :configuration
|
13
29
|
|
30
|
+
# infoRouter API version.
|
31
|
+
API_VERSION = '8.0'
|
32
|
+
|
14
33
|
# Returns true if the gem has been configured.
|
15
34
|
def configured?
|
16
35
|
!!configured
|
@@ -27,16 +46,16 @@ module Inforouter
|
|
27
46
|
@client = nil
|
28
47
|
end
|
29
48
|
|
30
|
-
def client
|
49
|
+
def client(options = {})
|
31
50
|
check_configuration!
|
32
|
-
@client ||= Inforouter::Client.new
|
51
|
+
@client ||= Inforouter::Client.new(options)
|
33
52
|
end
|
34
53
|
|
35
54
|
private
|
36
55
|
|
37
56
|
def check_configuration!
|
38
57
|
fail Inforouter::Errors::MissingConfig.new unless self.configuration
|
39
|
-
self.
|
58
|
+
self.configuration.check!
|
40
59
|
end
|
41
60
|
end
|
42
61
|
end
|
@@ -1,5 +1,20 @@
|
|
1
1
|
module Inforouter
|
2
|
-
class AccessList
|
2
|
+
class AccessList < Record
|
3
|
+
# The <tt>Inforouter::AccessListDomainMembersItem</tt>.
|
4
|
+
attr_accessor :domain_members
|
5
|
+
# Array of <tt>Inforouter::AccessListUserGroupItem</tt>s.
|
6
|
+
attr_accessor :user_groups
|
7
|
+
# Array of <tt>Inforouter::AccessListUserItem</tt>s.
|
8
|
+
attr_accessor :users
|
9
|
+
|
10
|
+
def initialize(params = {})
|
11
|
+
params = {
|
12
|
+
:user_groups => [],
|
13
|
+
:users => []
|
14
|
+
}.merge(params)
|
15
|
+
super params
|
16
|
+
end
|
17
|
+
|
3
18
|
# The AccessList XML fragment should be structures as
|
4
19
|
#
|
5
20
|
# <AccessList>
|
@@ -21,32 +36,15 @@ module Inforouter
|
|
21
36
|
# 4 (Add & Read)
|
22
37
|
# 5 (Change)
|
23
38
|
# 6 (Full Control)
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
xml.DomainMembers(:Right => right)
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.user_group_item(xml, options = {})
|
37
|
-
xml.UserGroup(
|
38
|
-
:Domain => options[:domain],
|
39
|
-
:GroupName => options[:group_name],
|
40
|
-
:Right => options[:right]
|
41
|
-
)
|
42
|
-
end
|
43
|
-
|
44
|
-
def self.user_item(xml, options = {})
|
45
|
-
xml.User(
|
46
|
-
:Domain => options[:domain],
|
47
|
-
:UserName => options[:user_name],
|
48
|
-
:Right => options[:right]
|
49
|
-
)
|
39
|
+
def to_xml
|
40
|
+
builder = Nokogiri::XML::Builder.new do |xml|
|
41
|
+
xml.AccessList do
|
42
|
+
xml.DomainMembers(domain_members.to_hash) if domain_members
|
43
|
+
user_groups.each { |user_group| xml.UserGroup(user_group.to_hash) }
|
44
|
+
users.each { |user| xml.User(user.to_hash) }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
builder.doc.root.to_xml
|
50
48
|
end
|
51
49
|
end
|
52
50
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Inforouter
|
2
|
+
class AccessListUserGroupItem < Record
|
3
|
+
attr_accessor :domain
|
4
|
+
attr_accessor :name
|
5
|
+
attr_accessor :right
|
6
|
+
attr_accessor :description
|
7
|
+
|
8
|
+
# Convert the object to a useable hash for SOAP requests.
|
9
|
+
def to_hash
|
10
|
+
{
|
11
|
+
'Domain' => domain,
|
12
|
+
'UserGroupName' => name,
|
13
|
+
'Right' => right
|
14
|
+
}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Inforouter
|
2
|
+
class AccessListUserItem < Record
|
3
|
+
attr_accessor :domain
|
4
|
+
attr_accessor :name
|
5
|
+
attr_accessor :right
|
6
|
+
attr_accessor :description
|
7
|
+
|
8
|
+
# Convert the object to a useable hash for SOAP requests.
|
9
|
+
def to_hash
|
10
|
+
{
|
11
|
+
'Domain' => domain,
|
12
|
+
'UserName' => name,
|
13
|
+
'Right' => right
|
14
|
+
}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/inforouter/client.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Inforouter
|
2
|
-
# A <tt>Client</tt> communicates with the
|
2
|
+
# A <tt>Client</tt> communicates with the infoRouter service.
|
3
3
|
class Client
|
4
|
-
attr_reader :client, :ticket
|
4
|
+
attr_reader :client, :ticket
|
5
5
|
|
6
6
|
# Initializes a new Client object
|
7
7
|
#
|
@@ -14,10 +14,8 @@ module Inforouter
|
|
14
14
|
:log_level => :info
|
15
15
|
}.merge(options)
|
16
16
|
|
17
|
-
@wsdl = options[:wsdl] || File.dirname(__FILE__) + '/../../resources/inforouter.wsdl'
|
18
|
-
|
19
17
|
@client = Savon.client(
|
20
|
-
:wsdl =>
|
18
|
+
:wsdl => Inforouter.configuration.wsdl,
|
21
19
|
:convert_request_keys_to => :camelcase,
|
22
20
|
:pretty_print_xml => true,
|
23
21
|
:log => options[:log],
|
@@ -37,7 +35,7 @@ module Inforouter
|
|
37
35
|
#
|
38
36
|
# @return [String]
|
39
37
|
def ticket
|
40
|
-
|
38
|
+
@ticket = authenticate_user unless valid_ticket?(@ticket)
|
41
39
|
@ticket
|
42
40
|
end
|
43
41
|
|
@@ -48,10 +46,14 @@ module Inforouter
|
|
48
46
|
# @param message [Hash]
|
49
47
|
def call(method, message = {})
|
50
48
|
safe do
|
51
|
-
|
49
|
+
@client.call method, :message => message.merge(authentication_params)
|
52
50
|
end
|
53
51
|
end
|
54
52
|
|
53
|
+
def request(method, message = {})
|
54
|
+
call method, message
|
55
|
+
end
|
56
|
+
|
55
57
|
private
|
56
58
|
|
57
59
|
# @return [Hash]
|
@@ -76,17 +78,19 @@ module Inforouter
|
|
76
78
|
raise Inforouter::Errors::SOAPError.new(e)
|
77
79
|
end
|
78
80
|
|
79
|
-
#
|
80
|
-
|
81
|
-
|
82
|
-
|
81
|
+
# Authenticate the specified user against infoRouter and returns a ticket.
|
82
|
+
#
|
83
|
+
# @return [String]
|
84
|
+
def authenticate_user
|
85
|
+
ticket = nil
|
83
86
|
response = @client.call(:authenticate_user, :message => message_params)
|
84
87
|
if response.success?
|
85
88
|
data = response.to_array(:authenticate_user_response,
|
86
89
|
:authenticate_user_result,
|
87
90
|
:response).first
|
88
|
-
|
91
|
+
ticket = data[:@ticket] if data[:@success] == 'true'
|
89
92
|
end
|
93
|
+
ticket
|
90
94
|
end
|
91
95
|
|
92
96
|
# Determines whether the given ticket is still valid or not.
|
@@ -94,14 +98,13 @@ module Inforouter
|
|
94
98
|
# @params ticket [String]
|
95
99
|
# @return [Boolean]
|
96
100
|
def valid_ticket?(ticket)
|
97
|
-
# isValidTicket
|
98
101
|
result = false
|
99
102
|
unless ticket.nil?
|
100
103
|
message = { :authentication_ticket => ticket }
|
101
|
-
response = @client.call(:
|
104
|
+
response = @client.call(:is_valid_ticket, :message => message)
|
102
105
|
if response.success?
|
103
|
-
data = response.to_array(:
|
104
|
-
:
|
106
|
+
data = response.to_array(:is_valid_ticket_response,
|
107
|
+
:is_valid_ticket_result,
|
105
108
|
:response).first
|
106
109
|
result = true if data[:@success] == 'true'
|
107
110
|
end
|