inforouter 0.2.0 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +9 -9
- data/.rubocop.yml +0 -3
- data/README.md +30 -0
- data/inforouter.gemspec +2 -2
- data/lib/inforouter.rb +3 -1
- data/lib/inforouter/access_list.rb +20 -6
- data/lib/inforouter/access_list_domain_members_item.rb +0 -5
- data/lib/inforouter/access_list_user_group_item.rb +0 -9
- data/lib/inforouter/access_list_user_item.rb +0 -9
- data/lib/inforouter/client.rb +15 -14
- data/lib/inforouter/document.rb +12 -8
- data/lib/inforouter/errors/api_error.rb +1 -4
- data/lib/inforouter/errors/inforouter_error.rb +1 -1
- data/lib/inforouter/errors/missing_config_option_error.rb +1 -1
- data/lib/inforouter/errors/soap_error.rb +2 -2
- data/lib/inforouter/errors/unexpected_soap_response_error.rb +3 -3
- data/lib/inforouter/folder.rb +68 -42
- data/lib/inforouter/property_row.rb +11 -0
- data/lib/inforouter/property_set.rb +34 -0
- data/lib/inforouter/responses.rb +4 -0
- data/lib/inforouter/responses/access_list.rb +10 -0
- data/lib/inforouter/responses/add_property_set_row.rb +10 -0
- data/lib/inforouter/responses/document.rb +22 -22
- data/lib/inforouter/responses/documents.rb +39 -0
- data/lib/inforouter/responses/folder.rb +8 -8
- data/lib/inforouter/responses/folders.rb +29 -0
- data/lib/inforouter/responses/users.rb +11 -11
- data/lib/inforouter/rule_item.rb +2 -2
- data/lib/inforouter/rules.rb +33 -17
- data/lib/inforouter/user.rb +1 -1
- data/lib/inforouter/version.rb +1 -1
- data/test/test_configuration.rb +3 -3
- data/test/test_setup.rb +0 -1
- metadata +11 -5
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MWE4Mzc1Y2Y1ODA2ZjkwMTUxYWQwZjE4Y2ZhZmQ2ZTNhZmI4M2IxNA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
7
|
-
|
6
|
+
MTc5NTgyZGRiZDBjYzk0ZWZhMWIyZGEwNTczZjMzMjU3YTViNzNmMw==
|
7
|
+
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MWU5ZTlmNzg5NDliZGE2YzNhNmY0MTRkNWU1ZDQ1YjA2NDZjN2NiZDYwZTU5
|
10
|
+
OTFmMjgwYjAwYjJmNjVmNTFjZTQ3MGIyZWZjN2I3YTMxZTAxYjc4M2M0ZGZk
|
11
|
+
ZTliZTU5ZDg2OWUwYTRkYjY4ZGFlYzM3YzU3OGFlNDI2YTYyMDc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MWU4ZjM5MjA5YTRjY2QwODFlMmZjYWE5ZWYwMWE0NTA1ODRkODg0MmRjMTdl
|
14
|
+
YzRmMDdkNzY1MDk5YWZhNmE5ODZmZDI5YmNhNjNlYTE1M2RmYjYyYzI4MjBk
|
15
|
+
NmI0MmE3YWRhOGU2NjM1ZDQ3ZWU3ZDQzMzlkY2E3NTFiZTZmYmM=
|
data/.rubocop.yml
CHANGED
data/README.md
CHANGED
@@ -110,6 +110,36 @@ The following constants are defined in <tt>rights.rb</tt>.
|
|
110
110
|
* <tt>CHANGE</tt>
|
111
111
|
* <tt>FULL_CONTROL</tt>
|
112
112
|
|
113
|
+
Update a property set row on a folder.
|
114
|
+
|
115
|
+
class LetterRow < Inforouter::PropertyRow
|
116
|
+
attr_accessor :letter_type
|
117
|
+
attr_accessor :subject
|
118
|
+
|
119
|
+
def to_hash
|
120
|
+
{
|
121
|
+
'RowNbr' => index + 1,
|
122
|
+
'LetterType' => letter_type,
|
123
|
+
'Subject' => subject
|
124
|
+
}
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
folder = Inforouter::Folder.new path: '/Path/To/Folder'
|
129
|
+
property_set = Inforouter::PropertySet.new name: 'LETTER'
|
130
|
+
property_set.rows << LetterRow.new(
|
131
|
+
index: 0,
|
132
|
+
letter_type: 'Business',
|
133
|
+
subject: 'Subject 1 - updated subject. Lorem dolor sit amet.'
|
134
|
+
)
|
135
|
+
property_set.rows << LetterRow.new(
|
136
|
+
index: 1,
|
137
|
+
letter_type: 'Business',
|
138
|
+
subject: 'Subject 2 - updated subject. Lorem Dolor Sit amet.'
|
139
|
+
)
|
140
|
+
folder.property_sets << property_set
|
141
|
+
folder.update_property_sets
|
142
|
+
|
113
143
|
Sets the rules of the specified folder.
|
114
144
|
|
115
145
|
folder = Inforouter::Folder.new path: '/Path/To/Folder'
|
data/inforouter.gemspec
CHANGED
@@ -7,10 +7,10 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = 'inforouter'
|
8
8
|
spec.version = Inforouter::Version
|
9
9
|
spec.authors = ['Tom Fenton']
|
10
|
-
spec.email = ['tom@
|
10
|
+
spec.email = ['tom.fenton@ncschameleon.co.nz']
|
11
11
|
spec.description = %q(A Ruby interface to the infoRouter SOAP API.)
|
12
12
|
spec.summary = spec.description
|
13
|
-
spec.homepage = 'https://github.com/
|
13
|
+
spec.homepage = 'https://github.com/ncschameleon/inforouter'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split("\n")
|
data/lib/inforouter.rb
CHANGED
@@ -13,6 +13,8 @@ require 'inforouter/access_list_user_group_item'
|
|
13
13
|
require 'inforouter/access_list_user_item'
|
14
14
|
require 'inforouter/document'
|
15
15
|
require 'inforouter/folder'
|
16
|
+
require 'inforouter/property_set'
|
17
|
+
require 'inforouter/property_row'
|
16
18
|
require 'inforouter/rights'
|
17
19
|
require 'inforouter/rule_item'
|
18
20
|
require 'inforouter/rules'
|
@@ -32,7 +34,7 @@ module Inforouter
|
|
32
34
|
|
33
35
|
# Returns true if the gem has been configured.
|
34
36
|
def configured?
|
35
|
-
|
37
|
+
!configured.nil?
|
36
38
|
end
|
37
39
|
|
38
40
|
# Configure the gem
|
@@ -9,8 +9,8 @@ module Inforouter
|
|
9
9
|
|
10
10
|
def initialize(params = {})
|
11
11
|
params = {
|
12
|
-
:
|
13
|
-
:
|
12
|
+
user_groups: [],
|
13
|
+
users: []
|
14
14
|
}.merge(params)
|
15
15
|
super params
|
16
16
|
end
|
@@ -36,15 +36,29 @@ module Inforouter
|
|
36
36
|
# 4 (Add & Read)
|
37
37
|
# 5 (Change)
|
38
38
|
# 6 (Full Control)
|
39
|
+
#
|
40
|
+
# @return [String]
|
39
41
|
def to_xml
|
40
42
|
builder = Nokogiri::XML::Builder.new do |xml|
|
41
43
|
xml.AccessList do
|
42
|
-
xml.DomainMembers(domain_members.
|
43
|
-
user_groups.each
|
44
|
-
|
44
|
+
xml.DomainMembers(Right: domain_members.right) if domain_members
|
45
|
+
user_groups.each do |user_group|
|
46
|
+
xml.UserGroup(
|
47
|
+
Domain: user_group.domain,
|
48
|
+
GroupName: user_group.name,
|
49
|
+
Right: user_group.right
|
50
|
+
)
|
51
|
+
end
|
52
|
+
users.each do |user|
|
53
|
+
xml.User(
|
54
|
+
Domain: user.domain,
|
55
|
+
UserName: user.name,
|
56
|
+
Right: user.right
|
57
|
+
)
|
58
|
+
end
|
45
59
|
end
|
46
60
|
end
|
47
|
-
builder.doc.root.
|
61
|
+
builder.doc.root.to_s
|
48
62
|
end
|
49
63
|
end
|
50
64
|
end
|
@@ -4,14 +4,5 @@ module Inforouter
|
|
4
4
|
attr_accessor :name
|
5
5
|
attr_accessor :right
|
6
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
7
|
end
|
17
8
|
end
|
@@ -4,14 +4,5 @@ module Inforouter
|
|
4
4
|
attr_accessor :name
|
5
5
|
attr_accessor :right
|
6
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
7
|
end
|
17
8
|
end
|
data/lib/inforouter/client.rb
CHANGED
@@ -9,18 +9,19 @@ module Inforouter
|
|
9
9
|
# @return [Inforouter::Client]
|
10
10
|
def initialize(options = {})
|
11
11
|
options = {
|
12
|
-
:
|
13
|
-
:
|
14
|
-
:
|
12
|
+
log: false,
|
13
|
+
logger: Logger.new($stdout),
|
14
|
+
log_level: :info
|
15
15
|
}.merge(options)
|
16
16
|
|
17
17
|
@client = Savon.client(
|
18
|
-
:
|
19
|
-
:
|
20
|
-
:
|
21
|
-
:
|
22
|
-
:
|
23
|
-
:
|
18
|
+
wsdl: Inforouter.configuration.wsdl,
|
19
|
+
convert_request_keys_to: :camelcase,
|
20
|
+
pretty_print_xml: true,
|
21
|
+
ssl_verify_mode: :none,
|
22
|
+
log: options[:log],
|
23
|
+
logger: options[:logger],
|
24
|
+
log_level: options[:log_level]
|
24
25
|
)
|
25
26
|
|
26
27
|
@ticket = nil
|
@@ -46,7 +47,7 @@ module Inforouter
|
|
46
47
|
# @param message [Hash]
|
47
48
|
def call(method, message = {})
|
48
49
|
safe do
|
49
|
-
@client.call method, :
|
50
|
+
@client.call method, message: message.merge(authentication_params)
|
50
51
|
end
|
51
52
|
end
|
52
53
|
|
@@ -68,7 +69,7 @@ module Inforouter
|
|
68
69
|
# @return [Hash]
|
69
70
|
def authentication_params
|
70
71
|
{
|
71
|
-
:
|
72
|
+
authentication_ticket: ticket
|
72
73
|
}
|
73
74
|
end
|
74
75
|
|
@@ -83,7 +84,7 @@ module Inforouter
|
|
83
84
|
# @return [String]
|
84
85
|
def authenticate_user
|
85
86
|
ticket = nil
|
86
|
-
response = @client.call(:authenticate_user, :
|
87
|
+
response = @client.call(:authenticate_user, message: message_params)
|
87
88
|
if response.success?
|
88
89
|
data = response.to_array(:authenticate_user_response,
|
89
90
|
:authenticate_user_result,
|
@@ -100,8 +101,8 @@ module Inforouter
|
|
100
101
|
def valid_ticket?(ticket)
|
101
102
|
result = false
|
102
103
|
unless ticket.nil?
|
103
|
-
message = { :
|
104
|
-
response = @client.call(:is_valid_ticket, :
|
104
|
+
message = { authentication_ticket: ticket }
|
105
|
+
response = @client.call(:is_valid_ticket, message: message)
|
105
106
|
if response.success?
|
106
107
|
data = response.to_array(:is_valid_ticket_response,
|
107
108
|
:is_valid_ticket_result,
|
data/lib/inforouter/document.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Inforouter #:nodoc
|
2
2
|
class Document < Record
|
3
3
|
# Document ID.
|
4
|
-
attr_accessor :
|
4
|
+
attr_accessor :id
|
5
5
|
# Document name.
|
6
6
|
attr_accessor :name
|
7
7
|
# Document path.
|
@@ -16,10 +16,10 @@ module Inforouter #:nodoc
|
|
16
16
|
attr_accessor :modification_date
|
17
17
|
# Document checkout date.
|
18
18
|
attr_accessor :checkout_date
|
19
|
-
# Document checkout by.
|
20
|
-
attr_accessor :
|
21
|
-
# Document checkout by
|
22
|
-
attr_accessor :
|
19
|
+
# Document checkout by username.
|
20
|
+
attr_accessor :checkout_by_username
|
21
|
+
# Document checkout by full name.
|
22
|
+
attr_accessor :checkout_by_full_name
|
23
23
|
# Document size.
|
24
24
|
attr_accessor :size
|
25
25
|
# Document type.
|
@@ -44,8 +44,12 @@ module Inforouter #:nodoc
|
|
44
44
|
attr_accessor :doc_type_id
|
45
45
|
# Document doc type name.
|
46
46
|
attr_accessor :doc_type_name
|
47
|
-
# Document version
|
48
|
-
attr_accessor :
|
47
|
+
# Document version.
|
48
|
+
attr_accessor :version
|
49
|
+
# Document published version.
|
50
|
+
attr_accessor :published_version
|
51
|
+
# Document type.
|
52
|
+
attr_accessor :type
|
49
53
|
|
50
54
|
# @return [Boolean]
|
51
55
|
def exists?
|
@@ -58,7 +62,7 @@ module Inforouter #:nodoc
|
|
58
62
|
|
59
63
|
# @return [Hash]
|
60
64
|
def path_params
|
61
|
-
{ :
|
65
|
+
{ path: path }
|
62
66
|
end
|
63
67
|
end
|
64
68
|
end
|
@@ -7,10 +7,7 @@ module Inforouter #:nodoc:
|
|
7
7
|
# @param message [String] Error message.
|
8
8
|
# @param raw [String] Raw data from the SOAP response.
|
9
9
|
def initialize(message, raw)
|
10
|
-
super(compose_message('api_error',
|
11
|
-
:message => message,
|
12
|
-
:raw => raw
|
13
|
-
))
|
10
|
+
super(compose_message('api_error', message: message, raw: raw))
|
14
11
|
end
|
15
12
|
end
|
16
13
|
end
|
@@ -31,7 +31,7 @@ module Inforouter #:nodoc:
|
|
31
31
|
# message.
|
32
32
|
#
|
33
33
|
# @example Translate the message.
|
34
|
-
# error.translate(
|
34
|
+
# error.translate('errors', key: value)
|
35
35
|
#
|
36
36
|
# @param key [String] The key of the error in the locales.
|
37
37
|
# @param options [Hash] The objects to pass to create the message.
|
@@ -5,7 +5,7 @@ module Inforouter #:nodoc:
|
|
5
5
|
class MissingConfigOption < InforouterError
|
6
6
|
# @param name [String]
|
7
7
|
def initialize(name)
|
8
|
-
super(compose_message('missing_config_option', :
|
8
|
+
super(compose_message('missing_config_option', name: name))
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -12,8 +12,8 @@ module Inforouter #:nodoc:
|
|
12
12
|
fault_code = fault[:fault][:faultcode]
|
13
13
|
fault_string = parse_fault(fault[:fault][:faultstring])
|
14
14
|
super(compose_message('soap_error',
|
15
|
-
:
|
16
|
-
:
|
15
|
+
message: fault_string,
|
16
|
+
code: fault_code
|
17
17
|
))
|
18
18
|
end
|
19
19
|
end
|
@@ -8,9 +8,9 @@ module Inforouter #:nodoc:
|
|
8
8
|
# @param chain [String] Complete SOAP response chain in which the key could not be found.
|
9
9
|
def initialize(raw, key, chain)
|
10
10
|
super(compose_message('unexpected_soap_response',
|
11
|
-
:
|
12
|
-
:
|
13
|
-
:
|
11
|
+
key: key,
|
12
|
+
raw: raw,
|
13
|
+
chain: chain
|
14
14
|
))
|
15
15
|
end
|
16
16
|
end
|
data/lib/inforouter/folder.rb
CHANGED
@@ -2,7 +2,7 @@ module Inforouter #:nodoc:
|
|
2
2
|
# A <tt>Folder</tt> defines an infoRouter folder.
|
3
3
|
class Folder < Record
|
4
4
|
# Folder ID.
|
5
|
-
attr_accessor :
|
5
|
+
attr_accessor :id
|
6
6
|
# Folder parent ID.
|
7
7
|
attr_accessor :parent_id
|
8
8
|
# Folder name.
|
@@ -19,6 +19,8 @@ module Inforouter #:nodoc:
|
|
19
19
|
attr_accessor :domain_id
|
20
20
|
# Folder access list.
|
21
21
|
attr_accessor :access_list
|
22
|
+
# Folder property sets. Array of <tt>Inforouter::PropertySet</tt>s.
|
23
|
+
attr_accessor :property_sets
|
22
24
|
# Folder rules.
|
23
25
|
attr_accessor :rules
|
24
26
|
# Folder folders. Array of <tt>Inforouter::Folder</tt>s.
|
@@ -27,14 +29,10 @@ module Inforouter #:nodoc:
|
|
27
29
|
attr_accessor :documents
|
28
30
|
|
29
31
|
def initialize(params = {})
|
30
|
-
params = {
|
31
|
-
:folders = [],
|
32
|
-
:documents = []
|
33
|
-
}.merge(params)
|
32
|
+
params = { property_sets: [] }.merge(params)
|
34
33
|
super params
|
35
34
|
end
|
36
35
|
|
37
|
-
# @return [String]
|
38
36
|
def description
|
39
37
|
@description ||= begin
|
40
38
|
response = Inforouter.client.request :get_folder, folder_params
|
@@ -43,6 +41,28 @@ module Inforouter #:nodoc:
|
|
43
41
|
end
|
44
42
|
end
|
45
43
|
|
44
|
+
def documents
|
45
|
+
@documents ||= begin
|
46
|
+
response = Inforouter.client.request :get_documents1, path_params
|
47
|
+
@documents = Inforouter::Responses::Documents.parse response
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def folders
|
52
|
+
@folders ||= begin
|
53
|
+
response = Inforouter.client.request :get_folders1, path_params
|
54
|
+
@folders = Inforouter::Responses::Folders.parse response
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def property_sets
|
59
|
+
@property_sets ||= begin
|
60
|
+
response = Inforouter.client.request :get_folder, folder_params(with_property_sets: true)
|
61
|
+
folder = Inforouter::Responses::Folder.parse response
|
62
|
+
@property_sets = folder.property_sets
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
46
66
|
# Setting the path also sets the name if not already set.
|
47
67
|
def path=(path)
|
48
68
|
@name ||= path.split('/').last
|
@@ -63,42 +83,59 @@ module Inforouter #:nodoc:
|
|
63
83
|
result[:@success] == 'true'
|
64
84
|
end
|
65
85
|
|
66
|
-
# @return [
|
67
|
-
def
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
@documents ||= begin
|
78
|
-
response = Inforouter.client.request :get_folders_and_documents, folders_and_documents_params
|
79
|
-
@folders, @documents = Inforouter::Responses::FoldersDocuments.parse response
|
80
|
-
@documents
|
81
|
-
end
|
86
|
+
# @return [Boolean]
|
87
|
+
def update_access_list(options = {})
|
88
|
+
options = { apply_to_tree: false }.merge(options)
|
89
|
+
request_params = {
|
90
|
+
:path => path,
|
91
|
+
'AccessListXML' => access_list.to_xml,
|
92
|
+
:apply_to_tree => options[:apply_to_tree] ? 1 : 0
|
93
|
+
}
|
94
|
+
response = Inforouter.client.request :set_access_list, request_params
|
95
|
+
result = Inforouter::Responses::SetAccessList.parse response
|
96
|
+
result[:@success] == 'true'
|
82
97
|
end
|
83
98
|
|
84
99
|
# @return [Boolean]
|
85
100
|
def update_properties
|
86
101
|
request_params = {
|
87
|
-
:
|
88
|
-
:
|
89
|
-
:
|
102
|
+
path: path,
|
103
|
+
new_folder_name: name,
|
104
|
+
new_description: description
|
90
105
|
}
|
91
106
|
response = Inforouter.client.request :update_folder_properties, request_params
|
92
107
|
result = Inforouter::Responses::UpdateFolderProperties.parse response
|
93
108
|
result[:@success] == 'true'
|
94
109
|
end
|
95
110
|
|
111
|
+
# @return [Boolean]
|
112
|
+
def add_property_sets
|
113
|
+
request_params = {
|
114
|
+
:path => path,
|
115
|
+
'xmlpset' => PropertySet.to_xml(property_sets)
|
116
|
+
}
|
117
|
+
response = Inforouter.client.request :add_property_set_row, request_params
|
118
|
+
result = Inforouter::Responses::AddPropertySetRow.parse response
|
119
|
+
result[:@success] == 'true'
|
120
|
+
end
|
121
|
+
|
122
|
+
# @return [Boolean]
|
123
|
+
def update_property_sets
|
124
|
+
request_params = {
|
125
|
+
:path => path,
|
126
|
+
'xmlpset' => PropertySet.to_xml(property_sets)
|
127
|
+
}
|
128
|
+
response = Inforouter.client.request :update_property_set_row, request_params
|
129
|
+
result = Inforouter::Responses::UpdatePropertySetRow response
|
130
|
+
result[:@success] == 'true'
|
131
|
+
end
|
132
|
+
|
96
133
|
# @return [Boolean]
|
97
134
|
def update_rules(options = {})
|
98
|
-
options = { :
|
135
|
+
options = { apply_to_tree: false }.merge(options)
|
99
136
|
request_params = {
|
100
137
|
:path => path,
|
101
|
-
'xmlRules' => rules.
|
138
|
+
'xmlRules' => rules.to_hash,
|
102
139
|
:apply_to_tree => options[:apply_to_tree] ? 1 : 0
|
103
140
|
}
|
104
141
|
response = Inforouter.client.request :set_folder_rules, request_params
|
@@ -110,30 +147,19 @@ module Inforouter #:nodoc:
|
|
110
147
|
|
111
148
|
# @return [Hash]
|
112
149
|
def path_params
|
113
|
-
{ :
|
150
|
+
{ path: path }
|
114
151
|
end
|
115
152
|
|
116
153
|
# @return [Hash]
|
117
|
-
def folder_params
|
154
|
+
def folder_params(options = {})
|
155
|
+
options = { with_property_sets: false }.merge(options)
|
118
156
|
{
|
119
157
|
:path => path,
|
120
158
|
:with_rules => 0,
|
121
|
-
'withPropertySets' => 0,
|
159
|
+
'withPropertySets' => options[:with_property_sets] ? 1 : 0,
|
122
160
|
'withSecurity' => 0,
|
123
161
|
'withOwner' => 0
|
124
162
|
}
|
125
163
|
end
|
126
|
-
|
127
|
-
# @return [Hash]
|
128
|
-
def folders_and_documents_params
|
129
|
-
{
|
130
|
-
:path => path,
|
131
|
-
'withrules' => 0,
|
132
|
-
'withPropertySets' => 0,
|
133
|
-
'withSecurity' => 0,
|
134
|
-
'withOwner' => 0,
|
135
|
-
'withVersions' => 0
|
136
|
-
}
|
137
|
-
end
|
138
164
|
end
|
139
165
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Inforouter #:nodoc:
|
2
|
+
class PropertySet < Record
|
3
|
+
# Property set name.
|
4
|
+
attr_accessor :name
|
5
|
+
# Array of <tt>Inforouter::PropertyRow</tt>s.
|
6
|
+
attr_accessor :rows
|
7
|
+
|
8
|
+
def initialize(params = {})
|
9
|
+
params = { rows: [] }.merge(params)
|
10
|
+
super params
|
11
|
+
end
|
12
|
+
|
13
|
+
# <Propertysets>
|
14
|
+
# <propertyset Name="LETTER">
|
15
|
+
# <propertyrow RowNbr="1" LetterType="Business" Subject="Subject 1 - updated subject Lorem dolor sit amet.."/>
|
16
|
+
# <propertyrow RowNbr="2" LetterType="Business" Subject="Subject 2 - updated subject ..Lorem Dolor Sit amet.."/>
|
17
|
+
# </propertyset>
|
18
|
+
# </Propertysets>
|
19
|
+
#
|
20
|
+
# @return [String]
|
21
|
+
def self.to_xml(property_sets)
|
22
|
+
builder = Nokogiri::XML::Builder.new do |xml|
|
23
|
+
xml.Propertysets do
|
24
|
+
property_sets.each do |property_set|
|
25
|
+
xml.propertyset(Name: property_set.name) do
|
26
|
+
property_set.rows.each { |row| row.to_xml(xml) }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
builder.doc.root.to_xml
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/inforouter/responses.rb
CHANGED
@@ -1,14 +1,18 @@
|
|
1
1
|
require 'inforouter/responses/base'
|
2
2
|
require 'inforouter/responses/generic'
|
3
|
+
require 'inforouter/responses/access_list'
|
3
4
|
require 'inforouter/responses/create_folder'
|
4
5
|
require 'inforouter/responses/delete_folder'
|
5
6
|
require 'inforouter/responses/document'
|
6
7
|
require 'inforouter/responses/document_exists'
|
8
|
+
require 'inforouter/responses/documents'
|
7
9
|
require 'inforouter/responses/folder'
|
8
10
|
require 'inforouter/responses/folder_exists'
|
11
|
+
require 'inforouter/responses/folders'
|
9
12
|
require 'inforouter/responses/set_access_list'
|
10
13
|
require 'inforouter/responses/set_folder_rules'
|
11
14
|
require 'inforouter/responses/update_folder_properties'
|
12
15
|
require 'inforouter/responses/update_property_set_definition'
|
16
|
+
require 'inforouter/responses/add_property_set_row'
|
13
17
|
require 'inforouter/responses/update_property_set_row'
|
14
18
|
require 'inforouter/responses/users'
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module Inforouter #:nodoc:
|
2
|
+
module Responses #:nodoc:
|
3
|
+
# Response to an infoRouter Get Access List API call.
|
4
|
+
#
|
5
|
+
# See http://www.inforouter.com/web-services-80/default.aspx?op=GetAccessList
|
6
|
+
class AccessList < Generic
|
7
|
+
response_key :get_access_list
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module Inforouter #:nodoc:
|
2
|
+
module Responses #:nodoc:
|
3
|
+
# Response to an infoRouter Add Property Set Row API call.
|
4
|
+
#
|
5
|
+
# See http://www.inforouter.com/web-services-80/default.aspx?op=AddPropertySetRow
|
6
|
+
class AddPropertySetRow < Generic
|
7
|
+
response_key :add_property_set_row
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -18,28 +18,28 @@ module Inforouter #:nodoc:
|
|
18
18
|
response = new(savon_response)
|
19
19
|
document = response.match('get_document_response/get_document_result/response/document')
|
20
20
|
Inforouter::Document.new(
|
21
|
-
:
|
22
|
-
:
|
23
|
-
:
|
24
|
-
:
|
25
|
-
:
|
26
|
-
:
|
27
|
-
:
|
28
|
-
:
|
29
|
-
:
|
30
|
-
:
|
31
|
-
:
|
32
|
-
:
|
33
|
-
:
|
34
|
-
:
|
35
|
-
:
|
36
|
-
:
|
37
|
-
:
|
38
|
-
:
|
39
|
-
:
|
40
|
-
:
|
41
|
-
:
|
42
|
-
:
|
21
|
+
id: document[:@document_id].to_i,
|
22
|
+
name: document[:@name].strip,
|
23
|
+
path: document[:@path].strip,
|
24
|
+
description: document[:@description].strip,
|
25
|
+
update_instructions: document[:@update_instructions].strip,
|
26
|
+
creation_date: parse_datetime(document[:@creation_date]),
|
27
|
+
modification_date: parse_datetime(document[:@modification_date]),
|
28
|
+
checkout_date: parse_datetime(document[:@checkout_date]),
|
29
|
+
checkout_by_username: document[:@checkout_by_user_name].strip,
|
30
|
+
checkout_by_full_name: document[:@checkout_by].strip,
|
31
|
+
size: document[:@size].to_i,
|
32
|
+
type: document[:@type].strip,
|
33
|
+
percent_complete: document[:@percent_complete].to_i,
|
34
|
+
importance: document[:@importance].strip,
|
35
|
+
retention_date: parse_datetime(document[:@retention_date]),
|
36
|
+
disposition_date: parse_datetime(document[:@disposition_date]),
|
37
|
+
expiration_date: parse_datetime(document[:@expiration_date]),
|
38
|
+
register_date: parse_datetime(document[:@register_date]),
|
39
|
+
registered_by: document[:@registered_by].strip,
|
40
|
+
doc_type_id: document[:@doc_type_id].to_i,
|
41
|
+
doc_type_name: document[:@doc_type_name].strip,
|
42
|
+
version: document[:@version_number].to_i
|
43
43
|
)
|
44
44
|
end
|
45
45
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Inforouter #:nodoc:
|
2
|
+
module Responses #:nodoc:
|
3
|
+
# Returns the list of documents in the specified path in short form.
|
4
|
+
#
|
5
|
+
# http://www.inforouter.com/web-services-80/default.aspx?op=GetDocuments1
|
6
|
+
class Documents < Base
|
7
|
+
response_success 'get_documents1_response/get_documents1_result/response/@success'
|
8
|
+
error_message 'get_documents1_response/get_documents1_result/response/@error'
|
9
|
+
|
10
|
+
class << self
|
11
|
+
# Parse an infoRouter response.
|
12
|
+
#
|
13
|
+
# @param savon_response [Savon::Response] SOAP response.
|
14
|
+
#
|
15
|
+
# @return [Array<Inforouter::Document>]
|
16
|
+
def parse(savon_response)
|
17
|
+
response = new(savon_response)
|
18
|
+
documents = response.match('get_documents1_response/get_documents1_result/response/d')
|
19
|
+
documents.map do |document|
|
20
|
+
Inforouter::Document.new(
|
21
|
+
id: document[:@id].to_i,
|
22
|
+
name: document[:@n].strip,
|
23
|
+
modification_date: parse_datetime(document[:@mdate]),
|
24
|
+
creation_date: parse_datetime(document[:@cdate]),
|
25
|
+
size: document[:@size].to_i,
|
26
|
+
description: document[:@dformat].strip,
|
27
|
+
checkout_by_username: document[:@chkoutbyusername].strip,
|
28
|
+
checkout_by_full_name: document[:@chkoutbyfullname].strip,
|
29
|
+
version: document[:@version].to_i,
|
30
|
+
register_date: parse_datetime(document[:@regdate]),
|
31
|
+
published_version: document[:@publishedversion].to_i,
|
32
|
+
type: document[:@dtype].to_i
|
33
|
+
)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -17,14 +17,14 @@ module Inforouter #:nodoc:
|
|
17
17
|
response = new(savon_response)
|
18
18
|
folder = response.match('get_folder_response/get_folder_result/response/folder')
|
19
19
|
Inforouter::Folder.new(
|
20
|
-
:
|
21
|
-
:
|
22
|
-
:
|
23
|
-
:
|
24
|
-
:
|
25
|
-
:
|
26
|
-
:
|
27
|
-
:
|
20
|
+
id: folder[:@folder_id].to_i,
|
21
|
+
parent_id: folder[:@parent_id].to_i,
|
22
|
+
name: folder[:@name].strip,
|
23
|
+
path: folder[:@path].strip,
|
24
|
+
description: folder[:@description].strip,
|
25
|
+
creation_date: parse_datetime(folder[:@creation_date]),
|
26
|
+
owner_name: folder[:@owner_name].strip,
|
27
|
+
domain_id: folder[:@domain_id].to_i
|
28
28
|
)
|
29
29
|
end
|
30
30
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Inforouter #:nodoc:
|
2
|
+
module Responses #:nodoc:
|
3
|
+
# Returns the list of sub folders in the specified path in short form.
|
4
|
+
#
|
5
|
+
# http://www.inforouter.com/web-services-80/default.aspx?op=GetFolders1
|
6
|
+
class Folders < Base
|
7
|
+
response_success 'get_folders1_response/get_folders1_result/response/@success'
|
8
|
+
error_message 'get_folders1_response/get_folders1_result/response/@error'
|
9
|
+
|
10
|
+
class << self
|
11
|
+
# Parse an infoRouter response.
|
12
|
+
#
|
13
|
+
# @param savon_response [Savon::Response] SOAP response.
|
14
|
+
#
|
15
|
+
# @return [Array<Inforouter::Folder>]
|
16
|
+
def parse(savon_response)
|
17
|
+
response = new(savon_response)
|
18
|
+
folders = response.match('get_folders1_response/get_folders1_result/response/f')
|
19
|
+
folders.map do |folder|
|
20
|
+
Inforouter::Folder.new(
|
21
|
+
id: folder[:@id].to_i,
|
22
|
+
name: folder[:@n].strip
|
23
|
+
)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -18,17 +18,17 @@ module Inforouter #:nodoc:
|
|
18
18
|
users = response.match('get_all_users_response/get_all_users_result/response/users/user')
|
19
19
|
users.map do |user|
|
20
20
|
Inforouter::User.new(
|
21
|
-
:
|
22
|
-
:
|
23
|
-
:
|
24
|
-
:
|
25
|
-
:
|
26
|
-
:
|
27
|
-
:
|
28
|
-
:
|
29
|
-
:
|
30
|
-
:
|
31
|
-
:
|
21
|
+
id: user[:@user_id].to_i,
|
22
|
+
domain: user[:@domain].strip,
|
23
|
+
user_name: user[:@user_name].strip,
|
24
|
+
first_name: user[:@first_name].strip,
|
25
|
+
last_name: user[:@last_name].strip,
|
26
|
+
last_logon: DateTime.strptime(user[:@last_logon_date], '%Y-%m-%d %H:%M:%S'),
|
27
|
+
last_password_change: DateTime.strptime(user[:@last_password_change_date], '%Y-%m-%d %H:%M:%S'),
|
28
|
+
authentication_authority: user[:@authentication_authority].strip,
|
29
|
+
read_only: user[:@read_only_user] == 'TRUE',
|
30
|
+
email: user[:@email].strip,
|
31
|
+
enabled: user[:@enabled] == 'TRUE'
|
32
32
|
)
|
33
33
|
end
|
34
34
|
end
|
data/lib/inforouter/rule_item.rb
CHANGED
data/lib/inforouter/rules.rb
CHANGED
@@ -5,20 +5,20 @@ module Inforouter
|
|
5
5
|
|
6
6
|
def initialize(params = {})
|
7
7
|
params = {
|
8
|
-
:
|
9
|
-
:
|
10
|
-
:
|
11
|
-
:
|
12
|
-
:
|
13
|
-
:
|
14
|
-
:
|
15
|
-
:
|
8
|
+
allowable_file_types: '',
|
9
|
+
checkins: false,
|
10
|
+
checkouts: false,
|
11
|
+
document_deletes: false,
|
12
|
+
folder_deletes: false,
|
13
|
+
new_documents: false,
|
14
|
+
new_folders: false,
|
15
|
+
classified_documents: false
|
16
16
|
}.merge(params)
|
17
17
|
@rules = []
|
18
18
|
params.each do |key, value|
|
19
19
|
@rules << Inforouter::RuleItem.new(
|
20
|
-
:
|
21
|
-
:
|
20
|
+
name: key.to_s.camelize,
|
21
|
+
value: value
|
22
22
|
)
|
23
23
|
end
|
24
24
|
end
|
@@ -39,13 +39,29 @@ module Inforouter
|
|
39
39
|
# <Rule Name="NewFolders" Value="disallows" />
|
40
40
|
# <Rule Name="ClassifiedDocuments" Value="allows" />
|
41
41
|
# </Rules>
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
42
|
+
#
|
43
|
+
# Example
|
44
|
+
#
|
45
|
+
# { :rules =>
|
46
|
+
# { :rule =>
|
47
|
+
# [
|
48
|
+
# { :@Name => "AllowableFileTypes", :@Value => "BMP,DOC,JPG,XLS" },
|
49
|
+
# { :@Name => "Checkins", :@Value => "disallows" },
|
50
|
+
# { :@Name => "Checkouts", :@Value => "disallows" },
|
51
|
+
# { :@Name => "DocumentDeletes", :@Value => "disallows" },
|
52
|
+
# { :@Name => "FolderDeletes", :@Value => "disallows" },
|
53
|
+
# { :@Name => "NewDocuments", :@Value => "disallows" },
|
54
|
+
# { :@Name => "NewFolders", :@Value => "disallows" },
|
55
|
+
# { :@Name => "ClassifiedDocuments", :@Value => "allows" }
|
56
|
+
# ]
|
57
|
+
# }
|
58
|
+
# }
|
59
|
+
#
|
60
|
+
# @return [Hash]
|
61
|
+
def to_hash
|
62
|
+
rules_hash = { rule: [] }
|
63
|
+
rules.each { |rule| rules_hash[:rule] << rule.to_hash }
|
64
|
+
{ rules: rules_hash }
|
49
65
|
end
|
50
66
|
end
|
51
67
|
end
|
data/lib/inforouter/user.rb
CHANGED
data/lib/inforouter/version.rb
CHANGED
data/test/test_configuration.rb
CHANGED
@@ -7,7 +7,7 @@ class TestConfiguration < TestSetup
|
|
7
7
|
|
8
8
|
def test_missing_configuration
|
9
9
|
assert_raise Inforouter::Errors::MissingConfig do
|
10
|
-
Inforouter.client.request :dummy, :
|
10
|
+
Inforouter.client.request :dummy, body: {}
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
@@ -16,7 +16,7 @@ class TestConfiguration < TestSetup
|
|
16
16
|
config.username = 'inforouter_username'
|
17
17
|
end
|
18
18
|
assert_raise Inforouter::Errors::MissingConfigOption do
|
19
|
-
Inforouter.client.request :dummy, :
|
19
|
+
Inforouter.client.request :dummy, body: {}
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -25,7 +25,7 @@ class TestConfiguration < TestSetup
|
|
25
25
|
config.host = 'inforouter_host'
|
26
26
|
end
|
27
27
|
assert_raise Inforouter::Errors::MissingConfigOption do
|
28
|
-
Inforouter.client.request :dummy, :
|
28
|
+
Inforouter.client.request :dummy, body: {}
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
data/test/test_setup.rb
CHANGED
@@ -5,7 +5,6 @@ class TestSetup < Test::Unit::TextCase
|
|
5
5
|
|
6
6
|
def setup
|
7
7
|
Inforouter.configure do |config|
|
8
|
-
config.wsdl = ENV['INFOROUTER_WSDL'] || 'inforouter.wsdl'
|
9
8
|
config.host = ENV['INFOROUTER_HOST'] || 'inforouter_host'
|
10
9
|
config.username = ENV['INFOROUTER_USERNAME'] || 'inforouter_username'
|
11
10
|
config.password = ENV['INFOROUTER_PASSWORD'] || 'inforouter_password'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inforouter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Fenton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -124,7 +124,7 @@ dependencies:
|
|
124
124
|
version: 0.16.0
|
125
125
|
description: A Ruby interface to the infoRouter SOAP API.
|
126
126
|
email:
|
127
|
-
- tom@
|
127
|
+
- tom.fenton@ncschameleon.co.nz
|
128
128
|
executables: []
|
129
129
|
extensions: []
|
130
130
|
extra_rdoc_files: []
|
@@ -155,15 +155,21 @@ files:
|
|
155
155
|
- lib/inforouter/errors/soap_error.rb
|
156
156
|
- lib/inforouter/errors/unexpected_soap_response_error.rb
|
157
157
|
- lib/inforouter/folder.rb
|
158
|
+
- lib/inforouter/property_row.rb
|
159
|
+
- lib/inforouter/property_set.rb
|
158
160
|
- lib/inforouter/record.rb
|
159
161
|
- lib/inforouter/responses.rb
|
162
|
+
- lib/inforouter/responses/access_list.rb
|
163
|
+
- lib/inforouter/responses/add_property_set_row.rb
|
160
164
|
- lib/inforouter/responses/base.rb
|
161
165
|
- lib/inforouter/responses/create_folder.rb
|
162
166
|
- lib/inforouter/responses/delete_folder.rb
|
163
167
|
- lib/inforouter/responses/document.rb
|
164
168
|
- lib/inforouter/responses/document_exists.rb
|
169
|
+
- lib/inforouter/responses/documents.rb
|
165
170
|
- lib/inforouter/responses/folder.rb
|
166
171
|
- lib/inforouter/responses/folder_exists.rb
|
172
|
+
- lib/inforouter/responses/folders.rb
|
167
173
|
- lib/inforouter/responses/generic.rb
|
168
174
|
- lib/inforouter/responses/set_access_list.rb
|
169
175
|
- lib/inforouter/responses/set_folder_rules.rb
|
@@ -181,7 +187,7 @@ files:
|
|
181
187
|
- test/test_client.rb
|
182
188
|
- test/test_configuration.rb
|
183
189
|
- test/test_setup.rb
|
184
|
-
homepage: https://github.com/
|
190
|
+
homepage: https://github.com/ncschameleon/inforouter
|
185
191
|
licenses:
|
186
192
|
- MIT
|
187
193
|
metadata: {}
|
@@ -201,7 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
201
207
|
version: '0'
|
202
208
|
requirements: []
|
203
209
|
rubyforge_project:
|
204
|
-
rubygems_version: 2.
|
210
|
+
rubygems_version: 2.4.5
|
205
211
|
signing_key:
|
206
212
|
specification_version: 4
|
207
213
|
summary: A Ruby interface to the infoRouter SOAP API.
|