ooze-parser 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/LICENSE +21 -0
- data/lib/ooz/base/evolution.rb +9 -0
- data/lib/ooz/base/field/checklist/item.rb +12 -0
- data/lib/ooz/base/field/checklist.rb +22 -0
- data/lib/ooz/base/field/cross_reference.rb +10 -0
- data/lib/ooz/base/field/date.rb +11 -0
- data/lib/ooz/base/field/file/file.rb +11 -0
- data/lib/ooz/base/field/file.rb +21 -0
- data/lib/ooz/base/field/gauge/stop.rb +12 -0
- data/lib/ooz/base/field/gauge.rb +22 -0
- data/lib/ooz/base/field/image_gallery/image.rb +14 -0
- data/lib/ooz/base/field/image_gallery.rb +22 -0
- data/lib/ooz/base/field/number.rb +9 -0
- data/lib/ooz/base/field/people.rb +11 -0
- data/lib/ooz/base/field/plain_text.rb +9 -0
- data/lib/ooz/base/field/rich_text.rb +9 -0
- data/lib/ooz/base/field/select/option.rb +12 -0
- data/lib/ooz/base/field/select.rb +22 -0
- data/lib/ooz/base/field/tag_field.rb +9 -0
- data/lib/ooz/base/field/undefined.rb +8 -0
- data/lib/ooz/base/field.rb +24 -0
- data/lib/ooz/base/field_factory.rb +9 -0
- data/lib/ooz/base/force/binding.rb +10 -0
- data/lib/ooz/base/force.rb +20 -0
- data/lib/ooz/base/model.rb +37 -0
- data/lib/ooz/base/model_factory.rb +49 -0
- data/lib/ooz/base/ooze.rb +30 -0
- data/lib/ooz/base/section.rb +10 -0
- data/lib/ooz/base/stage/task/action/escalate.rb +12 -0
- data/lib/ooz/base/stage/task/action/reminder.rb +12 -0
- data/lib/ooz/base/stage/task/action/tag.rb +13 -0
- data/lib/ooz/base/stage/task/action.rb +27 -0
- data/lib/ooz/base/stage/task/action_factory.rb +12 -0
- data/lib/ooz/base/stage/task/completion.rb +10 -0
- data/lib/ooz/base/stage/task/priority.rb +11 -0
- data/lib/ooz/base/stage/task/review.rb +11 -0
- data/lib/ooz/base/stage/task/scheduled_callback.rb +14 -0
- data/lib/ooz/base/stage/task/strategy/direct.rb +13 -0
- data/lib/ooz/base/stage/task/strategy/editable.rb +13 -0
- data/lib/ooz/base/stage/task/strategy/prior.rb +13 -0
- data/lib/ooz/base/stage/task/strategy/prior_supervisor.rb +13 -0
- data/lib/ooz/base/stage/task/strategy/scheduler.rb +14 -0
- data/lib/ooz/base/stage/task/strategy/supervisor.rb +12 -0
- data/lib/ooz/base/stage/task/strategy.rb +21 -0
- data/lib/ooz/base/stage/task/strategy_factory.rb +12 -0
- data/lib/ooz/base/stage/task.rb +33 -0
- data/lib/ooz/base/stage.rb +28 -0
- data/lib/ooz/base.rb +14 -0
- data/lib/ooz/common/base_class.rb +63 -0
- data/lib/ooz/common/base_factory.rb +9 -0
- data/lib/ooz/common/base_model.rb +59 -0
- data/lib/ooz/common/hash_diff.rb +36 -0
- data/lib/ooz/common.rb +9 -0
- data/lib/ooz/model/evolution.rb +12 -0
- data/lib/ooz/model/field/checklist/item.rb +13 -0
- data/lib/ooz/model/field/checklist.rb +21 -0
- data/lib/ooz/model/field/cross_reference.rb +9 -0
- data/lib/ooz/model/field/date.rb +9 -0
- data/lib/ooz/model/field/file/file.rb +13 -0
- data/lib/ooz/model/field/file.rb +21 -0
- data/lib/ooz/model/field/gauge/stop.rb +13 -0
- data/lib/ooz/model/field/gauge.rb +21 -0
- data/lib/ooz/model/field/image_gallery/image.rb +13 -0
- data/lib/ooz/model/field/image_gallery.rb +21 -0
- data/lib/ooz/model/field/number.rb +9 -0
- data/lib/ooz/model/field/people.rb +9 -0
- data/lib/ooz/model/field/plain_text.rb +9 -0
- data/lib/ooz/model/field/rich_text.rb +9 -0
- data/lib/ooz/model/field/select/option.rb +13 -0
- data/lib/ooz/model/field/select.rb +21 -0
- data/lib/ooz/model/field/tag_field.rb +9 -0
- data/lib/ooz/model/field/undefined.rb +9 -0
- data/lib/ooz/model/field.rb +42 -0
- data/lib/ooz/model/field_factory.rb +7 -0
- data/lib/ooz/model/force/binding.rb +16 -0
- data/lib/ooz/model/force.rb +16 -0
- data/lib/ooz/model/ooze.rb +72 -0
- data/lib/ooz/model/section.rb +31 -0
- data/lib/ooz/model/stage.rb +18 -0
- data/lib/ooz/model.rb +12 -0
- data/lib/ooz/version.rb +3 -0
- data/lib/ooze-parser.rb +8 -0
- data/ooze-parser.gemspec +26 -0
- metadata +148 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f3d6d9f5b2a81fc071bed9f32d21c65d07554beb
|
4
|
+
data.tar.gz: 1ca9904ce21f3396a00ac70f290218ef9171d1c1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1ee713e3cf2718b338ca141c5f400f1931ea97c06914fd23f0d376131fdb32300b1f54e049bbf53a7697c7fe111b70b946f98e74e3fae250c3f046c0d5085258
|
7
|
+
data.tar.gz: dab2f8146b6a16a3096e1423b907aac2d863a18f8671e03ba6869681b9fe3e8bc2333a686e4a6f2b0ad9754a4112a3335a846e82112ed9ee4442e1df51e23563
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*.gem
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2018 Oscar Segura
|
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.
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Ooz
|
2
|
+
module Base
|
3
|
+
class Field
|
4
|
+
class Checklist < Field
|
5
|
+
end
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
require_relative "checklist/item"
|
11
|
+
|
12
|
+
module Ooz
|
13
|
+
module Base
|
14
|
+
class Field
|
15
|
+
class Checklist
|
16
|
+
overridable_const :checklist_item_class, Base::Field::Checklist::Item
|
17
|
+
passthrough :complete, to: :doc
|
18
|
+
passthrough_arr :items, to: :doc, klass: :checklist_item_class
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Ooz
|
2
|
+
module Base
|
3
|
+
class Field
|
4
|
+
class File < Field
|
5
|
+
end
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
require_relative "file/file"
|
11
|
+
|
12
|
+
module Ooz
|
13
|
+
module Base
|
14
|
+
class Field
|
15
|
+
class File
|
16
|
+
overridable_const :file_class, Base::Field::File::File
|
17
|
+
passthrough_arr :items, to: :doc, klass: :file_class
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Ooz
|
2
|
+
module Base
|
3
|
+
class Field
|
4
|
+
class Gauge < Field
|
5
|
+
end
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
require_relative "gauge/stop"
|
11
|
+
|
12
|
+
module Ooz
|
13
|
+
module Base
|
14
|
+
class Field
|
15
|
+
class Gauge
|
16
|
+
overridable_const :gauge_stop_class, Base::Field::Gauge::Stop
|
17
|
+
passthrough :value, :max, to: :doc
|
18
|
+
passthrough_arr :stops, to: :doc, klass: :gauge_stop_class
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Ooz
|
2
|
+
module Base
|
3
|
+
class Field
|
4
|
+
class ImageGallery
|
5
|
+
class Image < Base::Model
|
6
|
+
passthrough :_id, :_type, :type_string, :weight, :patch_ver, to: :doc
|
7
|
+
passthrough :file_file_name, :file_file_size, :file_content_type, :file_fingerprint, to: :doc
|
8
|
+
passthrough :file_updated_at, :upload_id, :paperclip_assoc, to: :doc
|
9
|
+
passthrough :height, :width, to: :doc
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Ooz
|
2
|
+
module Base
|
3
|
+
class Field
|
4
|
+
class ImageGallery < Field
|
5
|
+
end
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
require_relative "image_gallery/image"
|
11
|
+
|
12
|
+
module Ooz
|
13
|
+
module Base
|
14
|
+
class Field
|
15
|
+
class ImageGallery
|
16
|
+
overridable_const :image_class, Base::Field::ImageGallery::Image
|
17
|
+
passthrough :stretch, :no_popup, :hide_options, :layout, to: :doc
|
18
|
+
passthrough_arr :images, to: :doc, klass: :image_class
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Ooz
|
2
|
+
module Base
|
3
|
+
class Field
|
4
|
+
class People < Field
|
5
|
+
passthrough :people_ids, :singular, :attach_mode, :is_me_button, :person_schema_id, :viewable_fields,
|
6
|
+
:attached_people_permissions_enabled, :attached_people_permissions_editable,
|
7
|
+
to: :doc
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Ooz
|
2
|
+
module Base
|
3
|
+
class Field
|
4
|
+
class Select < Field
|
5
|
+
end
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
require_relative "select/option"
|
11
|
+
|
12
|
+
module Ooz
|
13
|
+
module Base
|
14
|
+
class Field
|
15
|
+
class Select
|
16
|
+
overridable_const :select_option, Base::Field::Select::Option
|
17
|
+
passthrough :multiple, :flat, :data_type, :other, :other_desc, to: :doc
|
18
|
+
passthrough_arr :options, to: :doc, klass: :select_option
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Ooz
|
2
|
+
module Base
|
3
|
+
class Field < Base::Model
|
4
|
+
passthrough :_id, :_type, :label, :tooltip, :patch_ver, to: :doc
|
5
|
+
passthrough :global_binding, to: :doc
|
6
|
+
passthrough :hidden, :deindex, :accent, to: :doc
|
7
|
+
passthrough :required, :hide_view, :hidden_on_reports, to: :doc
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
require_relative "field/undefined"
|
13
|
+
require_relative "field/select"
|
14
|
+
require_relative "field/date"
|
15
|
+
require_relative "field/plain_text"
|
16
|
+
require_relative "field/rich_text"
|
17
|
+
require_relative "field/number"
|
18
|
+
require_relative "field/gauge"
|
19
|
+
require_relative "field/people"
|
20
|
+
require_relative "field/tag_field"
|
21
|
+
require_relative "field/cross_reference"
|
22
|
+
require_relative "field/file"
|
23
|
+
require_relative "field/image_gallery"
|
24
|
+
require_relative "field/checklist"
|
@@ -0,0 +1,9 @@
|
|
1
|
+
module Ooz
|
2
|
+
module Base
|
3
|
+
class FieldFactory < ModelFactory
|
4
|
+
def_parent_class Base::Field
|
5
|
+
def_white_classes "Select", "TagField", "Date", "PlainText", "RichText",
|
6
|
+
"Number", "Gauge", "People", "CrossReference", "File", "ImageGallery", "Checklist"
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Ooz
|
2
|
+
module Base
|
3
|
+
class Force < Base::Model
|
4
|
+
end
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
require_relative "force/binding"
|
9
|
+
|
10
|
+
module Ooz
|
11
|
+
module Base
|
12
|
+
class Force
|
13
|
+
overridable_const :binding_class, Base::Force::Binding
|
14
|
+
passthrough :_id, :name, :weight, :patch_ver, to: :doc
|
15
|
+
passthrough :script, to: :doc
|
16
|
+
passthrough_arr :binings, to: :doc, klass: :binding_class
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Ooz
|
2
|
+
module Base
|
3
|
+
class Model < Common::BaseModel
|
4
|
+
|
5
|
+
attr_reader :root
|
6
|
+
|
7
|
+
def initialize(*args, root: nil)
|
8
|
+
super(*args)
|
9
|
+
@root = root
|
10
|
+
end
|
11
|
+
|
12
|
+
def ooze
|
13
|
+
self.is_a?(Ooze)? self : root && root.ooze
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def to_hash(arr)
|
19
|
+
raise "Sorry, expected Array, given: #{arr.class.name}" if !arr.is_a?(Array)
|
20
|
+
arr.map do |e|
|
21
|
+
[e._id, e]
|
22
|
+
end.to_h
|
23
|
+
end
|
24
|
+
|
25
|
+
def collect_from(ids, elements_hash)
|
26
|
+
raise "Sorry, 'ids' expected to be Array, given: #{arr.class.name}" if !ids.is_a?(Array)
|
27
|
+
raise "Expected hash, given: #{elements_hash.class.name}" if !elements_hash.is_a?(Hash)
|
28
|
+
ids.map do |id|
|
29
|
+
elements_hash[id].tap do |e|
|
30
|
+
puts "Warning: there is no element with id '#{id}'" if !e
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Ooz
|
2
|
+
module Base
|
3
|
+
class ModelFactory < Common::BaseFactory
|
4
|
+
class << self
|
5
|
+
def def_white_classes (*str_classes)
|
6
|
+
str_classes = str_classes.map do |cls|
|
7
|
+
case cls
|
8
|
+
when cls.respond_to?(:name)
|
9
|
+
cls.name
|
10
|
+
when Symbol
|
11
|
+
cls.to_s
|
12
|
+
when String
|
13
|
+
cls
|
14
|
+
end
|
15
|
+
end.compact
|
16
|
+
overridable_const :white_classes, str_classes
|
17
|
+
end
|
18
|
+
|
19
|
+
def def_parent_class (parent_class)
|
20
|
+
msg = "Expected a valid parent class for you factory, from which the other classes inherit. Given #{parent_class}"
|
21
|
+
valid_class = parent_class && parent_class.is_a?(Class)
|
22
|
+
raise msg unless valid_class
|
23
|
+
|
24
|
+
overridable_const :parent_class, parent_class
|
25
|
+
overridable_const :base_namespace, parent_class.name
|
26
|
+
end
|
27
|
+
|
28
|
+
def new(*args)
|
29
|
+
raise "You must use 'def_parent_class' to initialize your Factory class" if !defined?(parent_class)
|
30
|
+
|
31
|
+
type = args.first&.dig("_type")&.split("::")&.last
|
32
|
+
raise "Your object should have field '_type' defined" if !type
|
33
|
+
|
34
|
+
if white_classes.include?(type)
|
35
|
+
str_class = "#{base_namespace}::#{type}"
|
36
|
+
raise "This class does not exist: #{str_class}" if !Object.const_defined?(str_class)
|
37
|
+
klass = Object.const_get(str_class)
|
38
|
+
else
|
39
|
+
str_class = "#{base_namespace}::Undefined"
|
40
|
+
klass = Object.const_defined?(str_class)? Object.const_get(str_class) : parent_class
|
41
|
+
end
|
42
|
+
|
43
|
+
klass.new(*args)
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Ooz
|
2
|
+
module Base
|
3
|
+
class Ooze < Base::Model
|
4
|
+
overridable_const :evolution_class, Base::Evolution
|
5
|
+
overridable_const :section_class, Base::Section
|
6
|
+
overridable_const :field_factory_class, Base::FieldFactory
|
7
|
+
overridable_const :force_class, Base::Force
|
8
|
+
|
9
|
+
passthrough :_id, :template_id, :name, :organization_id, :patch_ver, to: :doc
|
10
|
+
passthrough :created_at, :updated_at, :time_zone, to: :doc
|
11
|
+
passthrough :state, :status, to: :doc
|
12
|
+
passthrough :votes_enabled, :upvotes, :downvotes, to: :doc
|
13
|
+
passthrough :tags, :compiled_tags, :base_tags, to: :doc
|
14
|
+
passthrough :theme_id, :icon, :ss_error, to: :doc
|
15
|
+
passthrough :disable_direct_permissions, :task_priority, to: :doc
|
16
|
+
|
17
|
+
passthrough_cls :evolution, to: :doc, klass: :evolution_class
|
18
|
+
passthrough_arr :flow_nodes, to: :doc, klass: :section_class
|
19
|
+
passthrough_arr :membranes, to: :doc, klass: :field_factory_class
|
20
|
+
passthrough_arr :forces, to: :doc, klass: :force_class
|
21
|
+
|
22
|
+
def initialize(*args)
|
23
|
+
super(*args)
|
24
|
+
|
25
|
+
#pp evolution_class
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module Ooz
|
2
|
+
module Base
|
3
|
+
class Section < Base::Model
|
4
|
+
passthrough :_id, :weight, :_type, :patch_ver, to: :doc
|
5
|
+
passthrough :heading, :left_heading, :right_heading, to: :doc
|
6
|
+
passthrough :minimized, :hidden, to: :doc
|
7
|
+
passthrough :membrane_ids, :left_membrane_ids, :right_membrane_ids, to: :doc
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Ooz
|
2
|
+
module Base
|
3
|
+
class Stage
|
4
|
+
class Task
|
5
|
+
class Action < Base::Model
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
require_relative "action/reminder"
|
13
|
+
require_relative "action/escalate"
|
14
|
+
require_relative "action/tag"
|
15
|
+
|
16
|
+
|
17
|
+
module Ooz
|
18
|
+
module Base
|
19
|
+
class Stage
|
20
|
+
class Task
|
21
|
+
class Action
|
22
|
+
passthrough :_id, :patch_ver, :_type, to: :doc
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Ooz
|
2
|
+
module Base
|
3
|
+
class Stage
|
4
|
+
class Task
|
5
|
+
class ScheduledCallback < Base::Model
|
6
|
+
overridable_const :action_factory_class, Base::Stage::Task::ActionFactory
|
7
|
+
passthrough :_id, :patch_ver, to: :doc
|
8
|
+
passthrough :due_ctr, :due_unit, :recurs, :recurs_unit, :recurs_ctr, to: :doc
|
9
|
+
passthrough_arr :actions, to: :doc, klass: action_factory_class
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|