keytechkit 0.3.16
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 +7 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/.rubocop.yml +9 -0
- data/.travis.yml +7 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +146 -0
- data/LICENSE +21 -0
- data/README.md +60 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/keytechKit.gemspec +30 -0
- data/lib/keytechKit/classes/classdefinition.rb +38 -0
- data/lib/keytechKit/classes/classes.rb +47 -0
- data/lib/keytechKit/classes/layout/control.rb +35 -0
- data/lib/keytechKit/classes/layout/layout.rb +22 -0
- data/lib/keytechKit/classes/layouts.rb +78 -0
- data/lib/keytechKit/classes/subarea.rb +12 -0
- data/lib/keytechKit/elements/bom/bom_element.rb +42 -0
- data/lib/keytechKit/elements/bom/bom_element_list.rb +29 -0
- data/lib/keytechKit/elements/data_dictionary/data_dictionary_definition.rb +23 -0
- data/lib/keytechKit/elements/data_dictionary/data_dictionary_handler.rb +50 -0
- data/lib/keytechKit/elements/element.rb +81 -0
- data/lib/keytechKit/elements/element_files/element_file.rb +19 -0
- data/lib/keytechKit/elements/element_files/element_file_handler.rb +181 -0
- data/lib/keytechKit/elements/element_handler.rb +183 -0
- data/lib/keytechKit/elements/group_by.rb +16 -0
- data/lib/keytechKit/elements/notes/note.rb +31 -0
- data/lib/keytechKit/elements/notes/note_handler.rb +35 -0
- data/lib/keytechKit/elements/search_response_header.rb +47 -0
- data/lib/keytechKit/search.rb +46 -0
- data/lib/keytechKit/serverinfo.rb +33 -0
- data/lib/keytechKit/serverinfo_handler.rb +23 -0
- data/lib/keytechKit/targetlink.rb +26 -0
- data/lib/keytechKit/tools.rb +14 -0
- data/lib/keytechKit/user.rb +79 -0
- data/lib/keytechKit/version.rb +15 -0
- data/lib/keytechKit.rb +98 -0
- metadata +153 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 57f8b73f659fce78a663b2a6ce59c8e622a6a7044e9dd1cdbb322b9c5240788b
|
4
|
+
data.tar.gz: 96beee9a69d2aaa78730bf5a261ae2a6ef51902a4e2c90b7d79f791490626d86
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 135869814f45a8cde8609cea21fa625896419e8815babce9e007e2193ad678bc3aa5d8683dd7fd2b721a8a4b169428c0da510be6f3c240d5718f4782709a8598
|
7
|
+
data.tar.gz: ce9812073272c2be48c19b0ea757ae91229ca9800c9263a58676d727013b1c0b5e81b5d67f9b5452cd95b83b19b12cdc2c45ff503a04ac7e4512884c129cc03b
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
keytechkit (0.3.15)
|
5
|
+
httparty (~> 0.16)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actioncable (5.2.1)
|
11
|
+
actionpack (= 5.2.1)
|
12
|
+
nio4r (~> 2.0)
|
13
|
+
websocket-driver (>= 0.6.1)
|
14
|
+
actionmailer (5.2.1)
|
15
|
+
actionpack (= 5.2.1)
|
16
|
+
actionview (= 5.2.1)
|
17
|
+
activejob (= 5.2.1)
|
18
|
+
mail (~> 2.5, >= 2.5.4)
|
19
|
+
rails-dom-testing (~> 2.0)
|
20
|
+
actionpack (5.2.1)
|
21
|
+
actionview (= 5.2.1)
|
22
|
+
activesupport (= 5.2.1)
|
23
|
+
rack (~> 2.0)
|
24
|
+
rack-test (>= 0.6.3)
|
25
|
+
rails-dom-testing (~> 2.0)
|
26
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
27
|
+
actionview (5.2.1)
|
28
|
+
activesupport (= 5.2.1)
|
29
|
+
builder (~> 3.1)
|
30
|
+
erubi (~> 1.4)
|
31
|
+
rails-dom-testing (~> 2.0)
|
32
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
33
|
+
activejob (5.2.1)
|
34
|
+
activesupport (= 5.2.1)
|
35
|
+
globalid (>= 0.3.6)
|
36
|
+
activemodel (5.2.1)
|
37
|
+
activesupport (= 5.2.1)
|
38
|
+
activerecord (5.2.1)
|
39
|
+
activemodel (= 5.2.1)
|
40
|
+
activesupport (= 5.2.1)
|
41
|
+
arel (>= 9.0)
|
42
|
+
activestorage (5.2.1)
|
43
|
+
actionpack (= 5.2.1)
|
44
|
+
activerecord (= 5.2.1)
|
45
|
+
marcel (~> 0.3.1)
|
46
|
+
activesupport (5.2.1)
|
47
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
48
|
+
i18n (>= 0.7, < 2)
|
49
|
+
minitest (~> 5.1)
|
50
|
+
tzinfo (~> 1.1)
|
51
|
+
arel (9.0.0)
|
52
|
+
builder (3.2.3)
|
53
|
+
concurrent-ruby (1.1.2)
|
54
|
+
crass (1.0.4)
|
55
|
+
diff-lcs (1.3)
|
56
|
+
erubi (1.7.1)
|
57
|
+
globalid (0.4.1)
|
58
|
+
activesupport (>= 4.2.0)
|
59
|
+
httparty (0.16.2)
|
60
|
+
multi_xml (>= 0.5.2)
|
61
|
+
i18n (1.1.1)
|
62
|
+
concurrent-ruby (~> 1.0)
|
63
|
+
loofah (2.2.3)
|
64
|
+
crass (~> 1.0.2)
|
65
|
+
nokogiri (>= 1.5.9)
|
66
|
+
mail (2.7.1)
|
67
|
+
mini_mime (>= 0.1.1)
|
68
|
+
marcel (0.3.3)
|
69
|
+
mimemagic (~> 0.3.2)
|
70
|
+
method_source (0.9.1)
|
71
|
+
mimemagic (0.3.2)
|
72
|
+
mini_mime (1.0.1)
|
73
|
+
mini_portile2 (2.3.0)
|
74
|
+
minitest (5.11.3)
|
75
|
+
multi_xml (0.6.0)
|
76
|
+
nio4r (2.3.1)
|
77
|
+
nokogiri (1.8.5)
|
78
|
+
mini_portile2 (~> 2.3.0)
|
79
|
+
rack (2.0.6)
|
80
|
+
rack-test (1.1.0)
|
81
|
+
rack (>= 1.0, < 3)
|
82
|
+
rails (5.2.1)
|
83
|
+
actioncable (= 5.2.1)
|
84
|
+
actionmailer (= 5.2.1)
|
85
|
+
actionpack (= 5.2.1)
|
86
|
+
actionview (= 5.2.1)
|
87
|
+
activejob (= 5.2.1)
|
88
|
+
activemodel (= 5.2.1)
|
89
|
+
activerecord (= 5.2.1)
|
90
|
+
activestorage (= 5.2.1)
|
91
|
+
activesupport (= 5.2.1)
|
92
|
+
bundler (>= 1.3.0)
|
93
|
+
railties (= 5.2.1)
|
94
|
+
sprockets-rails (>= 2.0.0)
|
95
|
+
rails-dom-testing (2.0.3)
|
96
|
+
activesupport (>= 4.2.0)
|
97
|
+
nokogiri (>= 1.6)
|
98
|
+
rails-html-sanitizer (1.0.4)
|
99
|
+
loofah (~> 2.2, >= 2.2.2)
|
100
|
+
railties (5.2.1)
|
101
|
+
actionpack (= 5.2.1)
|
102
|
+
activesupport (= 5.2.1)
|
103
|
+
method_source
|
104
|
+
rake (>= 0.8.7)
|
105
|
+
thor (>= 0.19.0, < 2.0)
|
106
|
+
rake (10.5.0)
|
107
|
+
rspec (3.8.0)
|
108
|
+
rspec-core (~> 3.8.0)
|
109
|
+
rspec-expectations (~> 3.8.0)
|
110
|
+
rspec-mocks (~> 3.8.0)
|
111
|
+
rspec-core (3.8.0)
|
112
|
+
rspec-support (~> 3.8.0)
|
113
|
+
rspec-expectations (3.8.2)
|
114
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
115
|
+
rspec-support (~> 3.8.0)
|
116
|
+
rspec-mocks (3.8.0)
|
117
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
118
|
+
rspec-support (~> 3.8.0)
|
119
|
+
rspec-support (3.8.0)
|
120
|
+
sprockets (3.7.2)
|
121
|
+
concurrent-ruby (~> 1.0)
|
122
|
+
rack (> 1, < 3)
|
123
|
+
sprockets-rails (3.2.1)
|
124
|
+
actionpack (>= 4.0)
|
125
|
+
activesupport (>= 4.0)
|
126
|
+
sprockets (>= 3.0.0)
|
127
|
+
thor (0.20.0)
|
128
|
+
thread_safe (0.3.6)
|
129
|
+
tzinfo (1.2.5)
|
130
|
+
thread_safe (~> 0.1)
|
131
|
+
websocket-driver (0.7.0)
|
132
|
+
websocket-extensions (>= 0.1.0)
|
133
|
+
websocket-extensions (0.1.3)
|
134
|
+
|
135
|
+
PLATFORMS
|
136
|
+
ruby
|
137
|
+
|
138
|
+
DEPENDENCIES
|
139
|
+
bundler (~> 1.16)
|
140
|
+
keytechkit!
|
141
|
+
rails (~> 5.2)
|
142
|
+
rake (~> 10.0)
|
143
|
+
rspec (~> 3.0)
|
144
|
+
|
145
|
+
BUNDLED WITH
|
146
|
+
1.16.5
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2018 Thorsten Claus
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
|
2
|
+
[](https://travis-ci.com/tclaus/keytechkit.gem)
|
3
|
+
|
4
|
+
|
5
|
+
# KeytechKit.gem
|
6
|
+
|
7
|
+
This gem provides access to keytech Web API. keytech is the PLM / PDM Software from keytech Software GmbH. This gem is not supported by keytech Software GmbH.
|
8
|
+
Reference implementation can be found on https://plmweb.de
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem 'keytechKit'
|
16
|
+
```
|
17
|
+
|
18
|
+
And then execute:
|
19
|
+
|
20
|
+
$ bundle
|
21
|
+
|
22
|
+
Or install it yourself as:
|
23
|
+
|
24
|
+
$ gem install keytechKit
|
25
|
+
|
26
|
+
## Use
|
27
|
+
This gem is currently still under development. New functions will come up every week.
|
28
|
+
Refactors will be also made on any time even on minor version change.
|
29
|
+
To use this gem have a look in the /spec folder. Every function should be tested.
|
30
|
+
You can grab code here and add this to you own projects.
|
31
|
+
|
32
|
+
Documentation with code samples will come in the next days.
|
33
|
+
|
34
|
+
## Development
|
35
|
+
|
36
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
37
|
+
|
38
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
39
|
+
|
40
|
+
## Test
|
41
|
+
To start a test, run
|
42
|
+
$ bundle exec rspec spec
|
43
|
+
|
44
|
+
Test often, let tests fail fast.
|
45
|
+
|
46
|
+
## Contributing
|
47
|
+
|
48
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/tclaus/keytechkit.gem.
|
49
|
+
|
50
|
+
* Fork the project
|
51
|
+
* run 'bundle'
|
52
|
+
* run 'bundle exec rspec spec' for tests
|
53
|
+
* make your changes
|
54
|
+
* make tests
|
55
|
+
* make a pull request
|
56
|
+
|
57
|
+
|
58
|
+
## License
|
59
|
+
|
60
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "keytechKit"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/keytechKit.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "keytechKit/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "keytechkit"
|
8
|
+
spec.version = KeytechKit::VERSION
|
9
|
+
spec.author = "Thorsten Claus"
|
10
|
+
spec.email = ["thorstenclaus@web.de"]
|
11
|
+
spec.summary = "keytechkit is a ruby gem to connect to the keytech Web API"
|
12
|
+
spec.homepage = "https://claus-software.de"
|
13
|
+
spec.license = "MIT"
|
14
|
+
spec.metadata = { "source_code_uri" => "https://github.com/tclaus/keytechkit.gem" }
|
15
|
+
spec.required_ruby_version = ">= 2.4.0"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
27
|
+
spec.add_development_dependency "rails", "~> 5.2"
|
28
|
+
|
29
|
+
spec.add_dependency "httparty", "~> 0.16"
|
30
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'keytechKit/classes/subarea'
|
2
|
+
|
3
|
+
module KeytechKit
|
4
|
+
|
5
|
+
class ClassDefinition
|
6
|
+
attr_accessor :classKey
|
7
|
+
attr_accessor :attributesList
|
8
|
+
attr_accessor :displayname
|
9
|
+
attr_accessor :availableSubareas
|
10
|
+
attr_accessor :hasNumberGenerator
|
11
|
+
attr_accessor :isActive
|
12
|
+
attr_accessor :Listers
|
13
|
+
|
14
|
+
def initialize(classData)
|
15
|
+
self.classKey = classData["ClassKey"]
|
16
|
+
self.displayname = classData["Displayname"]
|
17
|
+
self.attributesList = classData["AttributesList"]
|
18
|
+
self.availableSubareas = loadSubAreas(classData["AvailableSubAreas"])
|
19
|
+
self.attributesList = classData["AttributesList"]
|
20
|
+
self.hasNumberGenerator = classData["HasNumberGenerator"]
|
21
|
+
self.isActive = classData["IsActive"]
|
22
|
+
|
23
|
+
# TODO: Attributeslist parsing
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
def loadSubAreas(subareasResult)
|
29
|
+
subAreas = Array.new
|
30
|
+
subareasResult.each do |subareaResult|
|
31
|
+
subArea = Subarea.new(subareaResult)
|
32
|
+
subAreas.push subArea
|
33
|
+
end
|
34
|
+
subAreas
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'keytechKit/classes/classdefinition'
|
2
|
+
|
3
|
+
module KeytechKit
|
4
|
+
class Classes
|
5
|
+
include HTTParty
|
6
|
+
|
7
|
+
def initialize(base_url, username, password)
|
8
|
+
self.class.base_uri(base_url)
|
9
|
+
@auth = { username: username, password: password }
|
10
|
+
end
|
11
|
+
|
12
|
+
def load(class_key, options = {})
|
13
|
+
# Returns a classclasses
|
14
|
+
parameter = { query: options }
|
15
|
+
parameter.merge!({ basic_auth: @auth })
|
16
|
+
|
17
|
+
response = self.class.get("/classes/#{class_key}", parameter)
|
18
|
+
|
19
|
+
if response.success?
|
20
|
+
# create a class
|
21
|
+
ClassDefinition.new(response)
|
22
|
+
else
|
23
|
+
raise response.response
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def loadAllClasses
|
28
|
+
# Returns a classclasses
|
29
|
+
parameter = { basic_auth: @auth }
|
30
|
+
|
31
|
+
response = self.class.get("/classes", parameter)
|
32
|
+
|
33
|
+
if response.success?
|
34
|
+
# create a class
|
35
|
+
classListData = response["ClassConfigurationList"]
|
36
|
+
classDefinitions = Array.new
|
37
|
+
classListData.each do |classData|
|
38
|
+
classDefinitions.push ClassDefinition.new(classData)
|
39
|
+
end
|
40
|
+
classDefinitions
|
41
|
+
else
|
42
|
+
puts "Could not load a classlist #{response.response}"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module KeytechKit
|
2
|
+
class Control
|
3
|
+
attr_accessor :attributeAlignment
|
4
|
+
attr_accessor :attributeName
|
5
|
+
attr_accessor :controlType
|
6
|
+
attr_accessor :dataDictionaryID
|
7
|
+
attr_accessor :dataDictionaryType
|
8
|
+
attr_accessor :defaultValue
|
9
|
+
attr_accessor :displayname
|
10
|
+
attr_accessor :font
|
11
|
+
attr_accessor :isEditable
|
12
|
+
attr_accessor :isNullable
|
13
|
+
attr_accessor :name
|
14
|
+
attr_accessor :position
|
15
|
+
attr_accessor :sequence
|
16
|
+
attr_accessor :size
|
17
|
+
|
18
|
+
def initialize(data)
|
19
|
+
self.attributeAlignment = data["AttributeAlignment"]
|
20
|
+
self.attributeName = data["AttributeName"]
|
21
|
+
self.controlType = data["ControlType"]
|
22
|
+
self.dataDictionaryID = data["DataDictionaryID"]
|
23
|
+
self.dataDictionaryType = data["DataDictionaryType"]
|
24
|
+
self.defaultValue = data["DefaultValue"]
|
25
|
+
self.displayname = data["Displayname"]
|
26
|
+
self.font = data["Font"]
|
27
|
+
self.isEditable = data["IsEditable"]
|
28
|
+
self.isNullable = data["IsNullable"]
|
29
|
+
self.name = data["Name"]
|
30
|
+
self.position = data["Position"]
|
31
|
+
self.sequence = data["Sequence"]
|
32
|
+
self.size = data["Size"]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
require 'keytechKit/classes/layout/control'
|
3
|
+
|
4
|
+
module KeytechKit
|
5
|
+
class Layout
|
6
|
+
attr_accessor :controls
|
7
|
+
|
8
|
+
def initialize(data)
|
9
|
+
parseControls(data["DesignerControls"])
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def parseControls(data)
|
15
|
+
self.controls = Array.new
|
16
|
+
data.each do |controlData|
|
17
|
+
control = Control.new(controlData)
|
18
|
+
self.controls.push control
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'keytechKit/classes/layout/layout'
|
2
|
+
|
3
|
+
|
4
|
+
module KeytechKit
|
5
|
+
class Layouts
|
6
|
+
include HTTParty
|
7
|
+
|
8
|
+
def initialize(base_url, username, password)
|
9
|
+
self.class.base_uri(base_url)
|
10
|
+
@auth = { username: username, password: password }
|
11
|
+
end
|
12
|
+
|
13
|
+
def header_layout(classkey)
|
14
|
+
# Ab keytedch 14!
|
15
|
+
load_layout(classkey, {"layoutType": "HeaderLayout"})
|
16
|
+
end
|
17
|
+
|
18
|
+
def main_layout(classkey)
|
19
|
+
load_layout(classkey, {"layoutType": "DefaultLayout"})
|
20
|
+
end
|
21
|
+
|
22
|
+
def explorer_layout(classkey)
|
23
|
+
load_layout(classkey, {"layoutType": "ExplorerLayout"})
|
24
|
+
end
|
25
|
+
|
26
|
+
def lister_layout(classkey)
|
27
|
+
load_lister_layout(classkey)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Loads the bom lister layout
|
31
|
+
def bom_lister_layout
|
32
|
+
# /bom/listerlayout
|
33
|
+
load_lister_layout("bom")
|
34
|
+
end
|
35
|
+
|
36
|
+
def global_lister_layout
|
37
|
+
# type, displaytext, name, status, created_at, created_by
|
38
|
+
Layout.new('DesignerControls' => [
|
39
|
+
{ 'AttributeName' => 'classname',
|
40
|
+
'Displayname' => 'Klasse' },
|
41
|
+
{ 'AttributeName' => 'displayname',
|
42
|
+
'Displayname' => 'Bezeichnung' },
|
43
|
+
{ 'AttributeName' => 'status',
|
44
|
+
'Displayname' => 'Status' },
|
45
|
+
{ 'AttributeName' => 'created_by',
|
46
|
+
'Displayname' => 'Angelegt von' },
|
47
|
+
{ 'AttributeName' => 'created_at',
|
48
|
+
'Displayname' => 'Angelegt am' }
|
49
|
+
])
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def load_lister_layout(classKey)
|
55
|
+
parameter = { basic_auth: @auth }
|
56
|
+
|
57
|
+
response = self.class.get("/classes/#{classKey}/listerlayout", parameter)
|
58
|
+
if response.success?
|
59
|
+
Layout.new(response)
|
60
|
+
else
|
61
|
+
raise response.response
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def load_layout(classKey, options = {})
|
66
|
+
parameter = {query: options}
|
67
|
+
parameter.merge!({ basic_auth: @auth })
|
68
|
+
|
69
|
+
response = self.class.get("/classes/#{classKey}/editorlayout", parameter)
|
70
|
+
if response.success?
|
71
|
+
# create a class
|
72
|
+
Layout.new(response)
|
73
|
+
else
|
74
|
+
raise response.response
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module KeytechKit
|
2
|
+
##
|
3
|
+
# A single article of a bill of material list
|
4
|
+
class BomElement
|
5
|
+
attr_accessor :key
|
6
|
+
attr_accessor :elementKey
|
7
|
+
attr_accessor :keyValueList
|
8
|
+
attr_accessor :cadCount
|
9
|
+
attr_accessor :cadDriven
|
10
|
+
attr_accessor :changedBy
|
11
|
+
attr_accessor :changedByLong
|
12
|
+
attr_accessor :count
|
13
|
+
attr_accessor :createdBy
|
14
|
+
attr_accessor :createdByLong
|
15
|
+
attr_accessor :displayName
|
16
|
+
attr_accessor :element
|
17
|
+
|
18
|
+
def initialize(data)
|
19
|
+
self.key = data['Key']
|
20
|
+
self.elementKey = data['Element']['Key']
|
21
|
+
self.cadCount = data['CadCount']
|
22
|
+
self.cadDriven = data['CadDriven']
|
23
|
+
self.changedBy = data['ChangedBy']
|
24
|
+
self.changedByLong = data['ChangedByLong']
|
25
|
+
self.count = data['Count']
|
26
|
+
self.createdBy = data['CreatedBy']
|
27
|
+
self.createdByLong = data['CreatedByLong']
|
28
|
+
self.displayName = data['DisplayName']
|
29
|
+
# self.element = data["Element"]
|
30
|
+
set_key_value_list(data['KeyValueList'])
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def set_key_value_list(kvData)
|
36
|
+
self.keyValueList = ({})
|
37
|
+
kvData.each do |kvPair|
|
38
|
+
keyValueList[kvPair['Key'].to_s] = kvPair['Value']
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'keytechKit/elements/bom/bom_element'
|
2
|
+
|
3
|
+
module KeytechKit
|
4
|
+
##
|
5
|
+
# List of bill of material articles
|
6
|
+
class BomElementList
|
7
|
+
attr_accessor :bomElementList
|
8
|
+
attr_accessor :pageNumber
|
9
|
+
attr_accessor :pageSize
|
10
|
+
attr_accessor :totalRecords
|
11
|
+
|
12
|
+
def initialize(data)
|
13
|
+
parseBomData(data)
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def parseBomData(data)
|
19
|
+
self.pageNumber = data['PageNumber']
|
20
|
+
self.pageSize = data['PageSize']
|
21
|
+
self.totalRecords = data['TotalRecords']
|
22
|
+
|
23
|
+
self.bomElementList = []
|
24
|
+
data['BomElementList'].each do |bom_data|
|
25
|
+
bomElementList.push BomElement.new(bom_data)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
|
2
|
+
module KeytechKit
|
3
|
+
##
|
4
|
+
# Represents a single attribute - target attribute relationship
|
5
|
+
#
|
6
|
+
class DataDictionaryDefinition
|
7
|
+
|
8
|
+
# Data dictionray attribute
|
9
|
+
attr_accessor :attribute
|
10
|
+
|
11
|
+
# target attribute to map to
|
12
|
+
attr_accessor :toTargetAttribute
|
13
|
+
|
14
|
+
# Localized displaytext
|
15
|
+
attr_accessor :displayText
|
16
|
+
|
17
|
+
def initialize(data)
|
18
|
+
self.attribute = data['Attribute']
|
19
|
+
self.toTargetAttribute = data['ToTargetAttribute']
|
20
|
+
self.displayText = data['Displaytext']
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|