keytechkit 0.3.17 → 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 +4 -4
- data/Gemfile.lock +79 -75
- data/LICENSE +1 -1
- data/keytechKit.gemspec +2 -2
- data/lib/keytechKit.rb +2 -1
- data/lib/keytechKit/elements/element_files/element_file_handler.rb +11 -15
- data/lib/keytechKit/elements/notes/note.rb +16 -11
- data/lib/keytechKit/elements/notes/note_handler.rb +60 -7
- data/lib/keytechKit/elements/notes/note_type.rb +23 -0
- data/lib/keytechKit/response_helper.rb +26 -0
- data/lib/keytechKit/serverinfo.rb +9 -5
- data/lib/keytechKit/serverinfo_handler.rb +2 -0
- data/lib/keytechKit/tools.rb +5 -3
- data/lib/keytechKit/version.rb +5 -3
- metadata +6 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fa0f95a22d9077b343cc7cab75cfb545d85e4aefd29a9c51a2f3b4ebfb3e18d8
|
|
4
|
+
data.tar.gz: 9c90b180a99c22b35259faba4be648e319180a96478573682e4fca1ac416e102
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: aacd94ae0d3f3d37b8757e22e13ba7565a6187e81130f0c39fc4df9a47df54e32589451a50cde99eccbd51f42937b8fc75debd3aab6ffa3b3bd56798f5c81c73
|
|
7
|
+
data.tar.gz: 3494a40d30960d7f00ff1cd61a19ae9d1569171d85276e7ee9f11da72c6c0153ea937ad8ddbb1c4967a7d9a22d2919e4e5d82699472760106ad9d618de0f6155
|
data/Gemfile.lock
CHANGED
|
@@ -1,136 +1,140 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
keytechkit (
|
|
4
|
+
keytechkit (1.2.0)
|
|
5
5
|
httparty (~> 0.16)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
-
actioncable (5.2.
|
|
11
|
-
actionpack (= 5.2.
|
|
10
|
+
actioncable (5.2.4.3)
|
|
11
|
+
actionpack (= 5.2.4.3)
|
|
12
12
|
nio4r (~> 2.0)
|
|
13
13
|
websocket-driver (>= 0.6.1)
|
|
14
|
-
actionmailer (5.2.
|
|
15
|
-
actionpack (= 5.2.
|
|
16
|
-
actionview (= 5.2.
|
|
17
|
-
activejob (= 5.2.
|
|
14
|
+
actionmailer (5.2.4.3)
|
|
15
|
+
actionpack (= 5.2.4.3)
|
|
16
|
+
actionview (= 5.2.4.3)
|
|
17
|
+
activejob (= 5.2.4.3)
|
|
18
18
|
mail (~> 2.5, >= 2.5.4)
|
|
19
19
|
rails-dom-testing (~> 2.0)
|
|
20
|
-
actionpack (5.2.
|
|
21
|
-
actionview (= 5.2.
|
|
22
|
-
activesupport (= 5.2.
|
|
23
|
-
rack (~> 2.0)
|
|
20
|
+
actionpack (5.2.4.3)
|
|
21
|
+
actionview (= 5.2.4.3)
|
|
22
|
+
activesupport (= 5.2.4.3)
|
|
23
|
+
rack (~> 2.0, >= 2.0.8)
|
|
24
24
|
rack-test (>= 0.6.3)
|
|
25
25
|
rails-dom-testing (~> 2.0)
|
|
26
26
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
|
27
|
-
actionview (5.2.
|
|
28
|
-
activesupport (= 5.2.
|
|
27
|
+
actionview (5.2.4.3)
|
|
28
|
+
activesupport (= 5.2.4.3)
|
|
29
29
|
builder (~> 3.1)
|
|
30
30
|
erubi (~> 1.4)
|
|
31
31
|
rails-dom-testing (~> 2.0)
|
|
32
32
|
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
|
33
|
-
activejob (5.2.
|
|
34
|
-
activesupport (= 5.2.
|
|
33
|
+
activejob (5.2.4.3)
|
|
34
|
+
activesupport (= 5.2.4.3)
|
|
35
35
|
globalid (>= 0.3.6)
|
|
36
|
-
activemodel (5.2.
|
|
37
|
-
activesupport (= 5.2.
|
|
38
|
-
activerecord (5.2.
|
|
39
|
-
activemodel (= 5.2.
|
|
40
|
-
activesupport (= 5.2.
|
|
36
|
+
activemodel (5.2.4.3)
|
|
37
|
+
activesupport (= 5.2.4.3)
|
|
38
|
+
activerecord (5.2.4.3)
|
|
39
|
+
activemodel (= 5.2.4.3)
|
|
40
|
+
activesupport (= 5.2.4.3)
|
|
41
41
|
arel (>= 9.0)
|
|
42
|
-
activestorage (5.2.
|
|
43
|
-
actionpack (= 5.2.
|
|
44
|
-
activerecord (= 5.2.
|
|
42
|
+
activestorage (5.2.4.3)
|
|
43
|
+
actionpack (= 5.2.4.3)
|
|
44
|
+
activerecord (= 5.2.4.3)
|
|
45
45
|
marcel (~> 0.3.1)
|
|
46
|
-
activesupport (5.2.
|
|
46
|
+
activesupport (5.2.4.3)
|
|
47
47
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
48
48
|
i18n (>= 0.7, < 2)
|
|
49
49
|
minitest (~> 5.1)
|
|
50
50
|
tzinfo (~> 1.1)
|
|
51
51
|
arel (9.0.0)
|
|
52
|
-
builder (3.2.
|
|
53
|
-
concurrent-ruby (1.1.
|
|
54
|
-
crass (1.0.
|
|
55
|
-
diff-lcs (1.3)
|
|
56
|
-
erubi (1.
|
|
57
|
-
globalid (0.4.
|
|
52
|
+
builder (3.2.4)
|
|
53
|
+
concurrent-ruby (1.1.6)
|
|
54
|
+
crass (1.0.6)
|
|
55
|
+
diff-lcs (1.4.3)
|
|
56
|
+
erubi (1.9.0)
|
|
57
|
+
globalid (0.4.2)
|
|
58
58
|
activesupport (>= 4.2.0)
|
|
59
|
-
httparty (0.
|
|
59
|
+
httparty (0.18.1)
|
|
60
|
+
mime-types (~> 3.0)
|
|
60
61
|
multi_xml (>= 0.5.2)
|
|
61
|
-
i18n (1.
|
|
62
|
+
i18n (1.8.3)
|
|
62
63
|
concurrent-ruby (~> 1.0)
|
|
63
|
-
loofah (2.
|
|
64
|
+
loofah (2.6.0)
|
|
64
65
|
crass (~> 1.0.2)
|
|
65
66
|
nokogiri (>= 1.5.9)
|
|
66
67
|
mail (2.7.1)
|
|
67
68
|
mini_mime (>= 0.1.1)
|
|
68
69
|
marcel (0.3.3)
|
|
69
70
|
mimemagic (~> 0.3.2)
|
|
70
|
-
method_source (0.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
method_source (1.0.0)
|
|
72
|
+
mime-types (3.3.1)
|
|
73
|
+
mime-types-data (~> 3.2015)
|
|
74
|
+
mime-types-data (3.2020.0512)
|
|
75
|
+
mimemagic (0.3.5)
|
|
76
|
+
mini_mime (1.0.2)
|
|
77
|
+
mini_portile2 (2.4.0)
|
|
78
|
+
minitest (5.14.1)
|
|
75
79
|
multi_xml (0.6.0)
|
|
76
|
-
nio4r (2.
|
|
77
|
-
nokogiri (1.
|
|
78
|
-
mini_portile2 (~> 2.
|
|
79
|
-
rack (2.
|
|
80
|
+
nio4r (2.5.2)
|
|
81
|
+
nokogiri (1.10.9)
|
|
82
|
+
mini_portile2 (~> 2.4.0)
|
|
83
|
+
rack (2.2.3)
|
|
80
84
|
rack-test (1.1.0)
|
|
81
85
|
rack (>= 1.0, < 3)
|
|
82
|
-
rails (5.2.
|
|
83
|
-
actioncable (= 5.2.
|
|
84
|
-
actionmailer (= 5.2.
|
|
85
|
-
actionpack (= 5.2.
|
|
86
|
-
actionview (= 5.2.
|
|
87
|
-
activejob (= 5.2.
|
|
88
|
-
activemodel (= 5.2.
|
|
89
|
-
activerecord (= 5.2.
|
|
90
|
-
activestorage (= 5.2.
|
|
91
|
-
activesupport (= 5.2.
|
|
86
|
+
rails (5.2.4.3)
|
|
87
|
+
actioncable (= 5.2.4.3)
|
|
88
|
+
actionmailer (= 5.2.4.3)
|
|
89
|
+
actionpack (= 5.2.4.3)
|
|
90
|
+
actionview (= 5.2.4.3)
|
|
91
|
+
activejob (= 5.2.4.3)
|
|
92
|
+
activemodel (= 5.2.4.3)
|
|
93
|
+
activerecord (= 5.2.4.3)
|
|
94
|
+
activestorage (= 5.2.4.3)
|
|
95
|
+
activesupport (= 5.2.4.3)
|
|
92
96
|
bundler (>= 1.3.0)
|
|
93
|
-
railties (= 5.2.
|
|
97
|
+
railties (= 5.2.4.3)
|
|
94
98
|
sprockets-rails (>= 2.0.0)
|
|
95
99
|
rails-dom-testing (2.0.3)
|
|
96
100
|
activesupport (>= 4.2.0)
|
|
97
101
|
nokogiri (>= 1.6)
|
|
98
|
-
rails-html-sanitizer (1.0
|
|
99
|
-
loofah (~> 2.
|
|
100
|
-
railties (5.2.
|
|
101
|
-
actionpack (= 5.2.
|
|
102
|
-
activesupport (= 5.2.
|
|
102
|
+
rails-html-sanitizer (1.3.0)
|
|
103
|
+
loofah (~> 2.3)
|
|
104
|
+
railties (5.2.4.3)
|
|
105
|
+
actionpack (= 5.2.4.3)
|
|
106
|
+
activesupport (= 5.2.4.3)
|
|
103
107
|
method_source
|
|
104
108
|
rake (>= 0.8.7)
|
|
105
109
|
thor (>= 0.19.0, < 2.0)
|
|
106
110
|
rake (10.5.0)
|
|
107
|
-
rspec (3.
|
|
108
|
-
rspec-core (~> 3.
|
|
109
|
-
rspec-expectations (~> 3.
|
|
110
|
-
rspec-mocks (~> 3.
|
|
111
|
-
rspec-core (3.
|
|
112
|
-
rspec-support (~> 3.
|
|
113
|
-
rspec-expectations (3.
|
|
111
|
+
rspec (3.9.0)
|
|
112
|
+
rspec-core (~> 3.9.0)
|
|
113
|
+
rspec-expectations (~> 3.9.0)
|
|
114
|
+
rspec-mocks (~> 3.9.0)
|
|
115
|
+
rspec-core (3.9.2)
|
|
116
|
+
rspec-support (~> 3.9.3)
|
|
117
|
+
rspec-expectations (3.9.2)
|
|
114
118
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
115
|
-
rspec-support (~> 3.
|
|
116
|
-
rspec-mocks (3.
|
|
119
|
+
rspec-support (~> 3.9.0)
|
|
120
|
+
rspec-mocks (3.9.1)
|
|
117
121
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
118
|
-
rspec-support (~> 3.
|
|
119
|
-
rspec-support (3.
|
|
120
|
-
sprockets (
|
|
122
|
+
rspec-support (~> 3.9.0)
|
|
123
|
+
rspec-support (3.9.3)
|
|
124
|
+
sprockets (4.0.2)
|
|
121
125
|
concurrent-ruby (~> 1.0)
|
|
122
126
|
rack (> 1, < 3)
|
|
123
127
|
sprockets-rails (3.2.1)
|
|
124
128
|
actionpack (>= 4.0)
|
|
125
129
|
activesupport (>= 4.0)
|
|
126
130
|
sprockets (>= 3.0.0)
|
|
127
|
-
thor (0.
|
|
131
|
+
thor (1.0.1)
|
|
128
132
|
thread_safe (0.3.6)
|
|
129
|
-
tzinfo (1.2.
|
|
133
|
+
tzinfo (1.2.7)
|
|
130
134
|
thread_safe (~> 0.1)
|
|
131
|
-
websocket-driver (0.7.
|
|
135
|
+
websocket-driver (0.7.2)
|
|
132
136
|
websocket-extensions (>= 0.1.0)
|
|
133
|
-
websocket-extensions (0.1.
|
|
137
|
+
websocket-extensions (0.1.5)
|
|
134
138
|
|
|
135
139
|
PLATFORMS
|
|
136
140
|
ruby
|
|
@@ -143,4 +147,4 @@ DEPENDENCIES
|
|
|
143
147
|
rspec (~> 3.0)
|
|
144
148
|
|
|
145
149
|
BUNDLED WITH
|
|
146
|
-
1.
|
|
150
|
+
1.17.3
|
data/LICENSE
CHANGED
data/keytechKit.gemspec
CHANGED
|
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
|
8
8
|
spec.version = KeytechKit::VERSION
|
|
9
9
|
spec.author = "Thorsten Claus"
|
|
10
10
|
spec.email = ["thorstenclaus@web.de"]
|
|
11
|
-
spec.summary = "keytechkit is a ruby gem to connect to the keytech
|
|
11
|
+
spec.summary = "keytechkit is a ruby gem to connect to the keytech API"
|
|
12
12
|
spec.homepage = "https://claus-software.de"
|
|
13
13
|
spec.license = "MIT"
|
|
14
14
|
spec.metadata = { "source_code_uri" => "https://github.com/tclaus/keytechkit.gem" }
|
|
@@ -25,6 +25,6 @@ Gem::Specification.new do |spec|
|
|
|
25
25
|
spec.add_development_dependency "rake", "~> 10.0"
|
|
26
26
|
spec.add_development_dependency "rspec", "~> 3.0"
|
|
27
27
|
spec.add_development_dependency "rails", "~> 5.2"
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
spec.add_dependency "httparty", "~> 0.16"
|
|
30
30
|
end
|
data/lib/keytechKit.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require 'httparty'
|
|
2
|
+
require 'keytechKit/response_helper'
|
|
2
3
|
require 'keytechKit/version'
|
|
3
4
|
require 'keytechKit/serverinfo_handler'
|
|
4
5
|
require 'keytechKit/search'
|
|
@@ -20,7 +21,7 @@ module KeytechKit
|
|
|
20
21
|
attr_reader :base_url
|
|
21
22
|
attr_reader :username
|
|
22
23
|
attr_reader :password
|
|
23
|
-
|
|
24
|
+
|
|
24
25
|
|
|
25
26
|
# Initializes this class
|
|
26
27
|
# user +baseurl+, +username+ and +password+ to start accessing all other
|
|
@@ -116,46 +116,42 @@ module KeytechKit
|
|
|
116
116
|
upload_file element_key, parameter
|
|
117
117
|
end
|
|
118
118
|
|
|
119
|
-
def
|
|
119
|
+
def delete_masterfile(element_key)
|
|
120
120
|
file_list = load(element_key)
|
|
121
121
|
if !file_list.nil?
|
|
122
122
|
file_list.each do |file|
|
|
123
|
-
return
|
|
123
|
+
return delete_file(element_key, file.fileId) if file.fileStorageType.casecmp('master').zero?
|
|
124
124
|
end
|
|
125
125
|
end
|
|
126
|
-
{ success: true, message:
|
|
126
|
+
{ success: true, message: 'No file found' }
|
|
127
127
|
end
|
|
128
128
|
|
|
129
|
-
def
|
|
129
|
+
def delete_preview(element_key)
|
|
130
130
|
file_list = load(element_key)
|
|
131
131
|
if !file_list.nil?
|
|
132
132
|
file_list.each do |file|
|
|
133
|
-
return
|
|
133
|
+
return delete_file(element_key, file.fileId) if file.fileStorageType.casecmp('preview').zero?
|
|
134
134
|
end
|
|
135
135
|
end
|
|
136
|
-
{ success: true, message:
|
|
136
|
+
{ success: true, message: 'No file found' }
|
|
137
137
|
end
|
|
138
138
|
|
|
139
|
-
def
|
|
139
|
+
def delete_quickpreview(element_key)
|
|
140
140
|
file_list = load(element_key)
|
|
141
141
|
if !file_list.nil?
|
|
142
142
|
file_list.each do |file|
|
|
143
|
-
return
|
|
143
|
+
return delete_file(element_key, file.fileId) if file.fileStorageType.casecmp('quickpreview').zero?
|
|
144
144
|
end
|
|
145
145
|
end
|
|
146
|
-
{ success: true, message:
|
|
146
|
+
{ success: true, message: 'No file found' }
|
|
147
147
|
end
|
|
148
148
|
|
|
149
149
|
private
|
|
150
150
|
|
|
151
|
-
def
|
|
151
|
+
def delete_file(element_key, file_id)
|
|
152
152
|
parameter = { basic_auth: @auth }
|
|
153
153
|
response = self.class.delete("/elements/#{element_key}/files/#{file_id}", parameter)
|
|
154
|
-
|
|
155
|
-
{ success: true }
|
|
156
|
-
else
|
|
157
|
-
{ success: false, error: response.headers['x-errordescription'].to_s }
|
|
158
|
-
end
|
|
154
|
+
ResponseHelper.success(response)
|
|
159
155
|
end
|
|
160
156
|
|
|
161
157
|
def upload_file(element_key, parameter)
|
|
@@ -9,23 +9,28 @@ module KeytechKit
|
|
|
9
9
|
attr_accessor :createdBy
|
|
10
10
|
attr_accessor :createdByLong
|
|
11
11
|
attr_accessor :id
|
|
12
|
-
attr_accessor :
|
|
12
|
+
attr_accessor :note_type
|
|
13
13
|
attr_accessor :subject
|
|
14
14
|
attr_accessor :text
|
|
15
|
+
attr_accessor :element_key
|
|
15
16
|
|
|
16
17
|
def initialize(data)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
@changedAt = data['ChangedAt']
|
|
19
|
+
@changedBy = data['ChangedBy']
|
|
20
|
+
@changedByLong = data['ChangedByLong']
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
@createdAt = data['CreatedAt']
|
|
23
|
+
@createdBy = data['CreatedBy']
|
|
24
|
+
@createdByLong = data['CreatedByLong']
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
@id = data['ID'] || 0
|
|
27
|
+
@note_type = data['NoteType']
|
|
28
|
+
@subject = data['Subject']
|
|
29
|
+
@text = data['Text']
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def to_hash
|
|
33
|
+
{ NoteType: @note_type, Subject: @subject, Text: @text }
|
|
29
34
|
end
|
|
30
35
|
end
|
|
31
36
|
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
require 'keytechKit/elements/notes/note'
|
|
2
|
-
|
|
2
|
+
require 'keytechKit/elements/notes/note_type'
|
|
3
3
|
module KeytechKit
|
|
4
4
|
##
|
|
5
5
|
# Notes
|
|
@@ -12,23 +12,76 @@ module KeytechKit
|
|
|
12
12
|
@auth = { username: username, password: password }
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
def load(
|
|
15
|
+
def load(element_key)
|
|
16
16
|
parameter = { basic_auth: @auth }
|
|
17
17
|
|
|
18
|
-
response = self.class.get("/elements/#{
|
|
18
|
+
response = self.class.get("/elements/#{element_key}/notes", parameter)
|
|
19
|
+
if response.success?
|
|
20
|
+
parse_notes(response['NotesList'], element_key)
|
|
21
|
+
else
|
|
22
|
+
# TODO: return an error object, dont raise exception
|
|
23
|
+
raise response.response
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def load_note_types
|
|
28
|
+
parameter = { basic_auth: @auth }
|
|
29
|
+
response = self.class.get('/notetypes', parameter)
|
|
19
30
|
if response.success?
|
|
20
|
-
|
|
31
|
+
parse_note_types(response['Notetypes'])
|
|
21
32
|
else
|
|
33
|
+
# TODO: return an error object, dont raise exception
|
|
22
34
|
raise response.response
|
|
23
35
|
end
|
|
24
36
|
end
|
|
25
37
|
|
|
38
|
+
def create(note_type, element_key)
|
|
39
|
+
note = Note.new(NoteType: note_type)
|
|
40
|
+
note.note_type = note_type
|
|
41
|
+
note.element_key = element_key
|
|
42
|
+
note
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def save(note)
|
|
46
|
+
element_key = note.element_key
|
|
47
|
+
note_hash = note.to_hash
|
|
48
|
+
parameter = { basic_auth: @auth,
|
|
49
|
+
body: note_hash.to_json,
|
|
50
|
+
headers: { 'Content-Type': 'application/json; charset=utf-8
' } }
|
|
51
|
+
|
|
52
|
+
response = if note.id.zero?
|
|
53
|
+
self.class.post("/elements/#{element_key}/notes", parameter)
|
|
54
|
+
else
|
|
55
|
+
self.class.put("/elements/#{element_key}/notes", parameter)
|
|
56
|
+
end
|
|
57
|
+
ResponseHelper.created_with_location(response)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def remove(note)
|
|
61
|
+
parameter = { basic_auth: @auth }
|
|
62
|
+
element_key = note.element_key
|
|
63
|
+
note_id = note.id
|
|
64
|
+
response = self.class.delete("/elements/#{element_key}/notes/#{note_id}", parameter)
|
|
65
|
+
ResponseHelper.success(response)
|
|
66
|
+
end
|
|
67
|
+
|
|
26
68
|
private
|
|
27
69
|
|
|
28
|
-
def
|
|
70
|
+
def parse_note_types(note_types_data)
|
|
71
|
+
note_types = []
|
|
72
|
+
note_types_data.each do |note_type_data|
|
|
73
|
+
note_type = NoteType.new(note_type_data)
|
|
74
|
+
note_types.push note_type
|
|
75
|
+
end
|
|
76
|
+
note_types
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def parse_notes(notes_result, element_key)
|
|
29
80
|
notes = []
|
|
30
|
-
|
|
31
|
-
|
|
81
|
+
notes_result.each do |note_data|
|
|
82
|
+
note = Note.new(note_data)
|
|
83
|
+
note.element_key = element_key
|
|
84
|
+
notes.push note
|
|
32
85
|
end
|
|
33
86
|
notes
|
|
34
87
|
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module KeytechKit
|
|
2
|
+
##
|
|
3
|
+
# A single note
|
|
4
|
+
class NoteType
|
|
5
|
+
attr_accessor :allow_modify
|
|
6
|
+
attr_accessor :displaytext
|
|
7
|
+
attr_accessor :id
|
|
8
|
+
attr_accessor :is_document_info
|
|
9
|
+
attr_accessor :is_folder_info
|
|
10
|
+
attr_accessor :is_masteritem_info
|
|
11
|
+
attr_accessor :is_system_info
|
|
12
|
+
|
|
13
|
+
def initialize(data)
|
|
14
|
+
@allow_modify = data['AllowModify']
|
|
15
|
+
@displaytext = data['Displaytext']
|
|
16
|
+
@id = data['ID']
|
|
17
|
+
@is_document_info = data['IsDocumentInfo']
|
|
18
|
+
@is_folder_info = data['IsFolderInfo']
|
|
19
|
+
@is_document_info = data['IsMasterItemInfo']
|
|
20
|
+
@is_system_info = data['IsSystemInfo']
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module KeytechKit
|
|
2
|
+
# Helps with common responses
|
|
3
|
+
class ResponseHelper
|
|
4
|
+
# Returns a success object with success:true / false. If false
|
|
5
|
+
# it also adds the x-errordescription object from keytech API
|
|
6
|
+
def self.success(response)
|
|
7
|
+
if response.success?
|
|
8
|
+
{ success: true }
|
|
9
|
+
else
|
|
10
|
+
{ success: false, error: response.headers['x-errordescription'].to_s }
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# Returns a success object with success:true/false. If true
|
|
15
|
+
# it adds a ID parameter extracted from the location header.
|
|
16
|
+
# If false it adds a error response text
|
|
17
|
+
def self.created_with_location(response)
|
|
18
|
+
if response.success?
|
|
19
|
+
{ success: true,
|
|
20
|
+
id: response.headers['location'] }
|
|
21
|
+
else
|
|
22
|
+
{ success: false, error: response.headers['x-errordescription'].to_s }
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
module KeytechKit
|
|
3
2
|
##
|
|
4
3
|
# Provides information about current keytech server
|
|
@@ -6,28 +5,33 @@ module KeytechKit
|
|
|
6
5
|
class Serverinfo
|
|
7
6
|
attr_accessor :response
|
|
8
7
|
|
|
8
|
+
attr_accessor :description
|
|
9
9
|
attr_accessor :database_version
|
|
10
10
|
attr_accessor :api_version
|
|
11
|
-
attr_accessor :server_description
|
|
12
11
|
# Unique ServerID this ID is unique for every installation
|
|
13
12
|
attr_accessor :server_id
|
|
13
|
+
attr_accessor :allow_status_change
|
|
14
14
|
|
|
15
15
|
def initialize(result_data)
|
|
16
16
|
parse_response(result_data)
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def parse_response(result_data)
|
|
20
|
+
|
|
21
|
+
self.response = result_data
|
|
22
|
+
|
|
20
23
|
result = result_data
|
|
21
24
|
result.each do |kv|
|
|
22
|
-
puts "Key: #{kv['Key']}, #{kv['Value']}"
|
|
23
|
-
|
|
24
25
|
case kv['Key']
|
|
26
|
+
when 'Server Description' then self.description = kv['Value']
|
|
25
27
|
when 'keytech database version' then self.database_version = kv['Value']
|
|
26
28
|
when 'API version' then self.api_version = kv['Value']
|
|
29
|
+
when 'ServerID' then self.server_id = kv['Value']
|
|
30
|
+
when 'AllowStatusChange' then self.allow_status_change = kv['Value']
|
|
31
|
+
|
|
27
32
|
# More fields
|
|
28
33
|
end
|
|
29
34
|
end
|
|
30
35
|
end
|
|
31
|
-
|
|
32
36
|
end
|
|
33
37
|
end
|
data/lib/keytechKit/tools.rb
CHANGED
|
@@ -7,9 +7,11 @@ class Tools
|
|
|
7
7
|
|
|
8
8
|
# Return a classkey (MI, FD, DO) from a elementkey (MISC_FILE:!234)
|
|
9
9
|
def self.class_type(element_key)
|
|
10
|
-
|
|
11
|
-
return 'MI' if
|
|
12
|
-
|
|
10
|
+
class_key = class_key(element_key)
|
|
11
|
+
return 'MI' if class_key.upcase.end_with?('_MI')
|
|
12
|
+
|
|
13
|
+
return 'FD' if class_key.end_with?('_FD', '_WF')
|
|
14
|
+
|
|
13
15
|
'DO'
|
|
14
16
|
end
|
|
15
17
|
end
|
data/lib/keytechKit/version.rb
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module KeytechKit
|
|
2
|
-
VERSION = '
|
|
4
|
+
VERSION = '1.2.0'
|
|
3
5
|
|
|
4
6
|
# Public available Demo URL for testing and dsevelopment
|
|
5
|
-
DEMO_URL =
|
|
7
|
+
# DEMO_URL = "https://explorer.keytech.de:8080/keytech"
|
|
8
|
+
DEMO_URL = 'https://keytech-13.free.beeceptor.com'
|
|
6
9
|
|
|
7
10
|
# username to access public web API
|
|
8
11
|
DEMO_USER = 'jgrant'
|
|
@@ -11,5 +14,4 @@ module KeytechKit
|
|
|
11
14
|
DEMO_PASSWORD = ''
|
|
12
15
|
|
|
13
16
|
DEMO_ARTICLE = 'DEFAULT_MI:500228' # Dampfwalze / Steamroller
|
|
14
|
-
|
|
15
17
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: keytechkit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Thorsten Claus
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2020-06-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -117,7 +117,9 @@ files:
|
|
|
117
117
|
- lib/keytechKit/elements/group_by.rb
|
|
118
118
|
- lib/keytechKit/elements/notes/note.rb
|
|
119
119
|
- lib/keytechKit/elements/notes/note_handler.rb
|
|
120
|
+
- lib/keytechKit/elements/notes/note_type.rb
|
|
120
121
|
- lib/keytechKit/elements/search_response_header.rb
|
|
122
|
+
- lib/keytechKit/response_helper.rb
|
|
121
123
|
- lib/keytechKit/search.rb
|
|
122
124
|
- lib/keytechKit/serverinfo.rb
|
|
123
125
|
- lib/keytechKit/serverinfo_handler.rb
|
|
@@ -145,9 +147,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
145
147
|
- !ruby/object:Gem::Version
|
|
146
148
|
version: '0'
|
|
147
149
|
requirements: []
|
|
148
|
-
|
|
149
|
-
rubygems_version: 2.7.7
|
|
150
|
+
rubygems_version: 3.0.4
|
|
150
151
|
signing_key:
|
|
151
152
|
specification_version: 4
|
|
152
|
-
summary: keytechkit is a ruby gem to connect to the keytech
|
|
153
|
+
summary: keytechkit is a ruby gem to connect to the keytech API
|
|
153
154
|
test_files: []
|