plate_id 0.0.2 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/plate_id.rb +6 -1
- data/lib/uri/plate_id.rb +11 -1
- data/plate_id.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a739c97b4695a5e4215733bf61da11d9a062f4efad404f6457f3af84297076d
|
4
|
+
data.tar.gz: 554eb95e24f95a830446d45c404677d47f86986d2d593aae9caa7f38be932e2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a74bde97760d74f9bb9ac4a172423eaec845a8c55cbe528154b6a130c968b02cb8e14124cfdff70f4d71cc259152450489c2290b7f57c8192634371891c8fac
|
7
|
+
data.tar.gz: 6a0022c025bd6916448f2bee27c9a372ab49e9e737d8a5c55fa0009359dcd35599d7743bc6d95f8acc5856264efa8f406d72146bfbe2372d46e01b43f3090004
|
data/lib/plate_id.rb
CHANGED
@@ -4,7 +4,8 @@ class PlateID
|
|
4
4
|
class << self
|
5
5
|
|
6
6
|
def create(model)
|
7
|
-
|
7
|
+
uri = URI::PlateID.create(model)
|
8
|
+
new(uri) if uri
|
8
9
|
end
|
9
10
|
|
10
11
|
def parse(plate_id)
|
@@ -33,6 +34,10 @@ class PlateID
|
|
33
34
|
uri.id
|
34
35
|
end
|
35
36
|
|
37
|
+
def id=(id)
|
38
|
+
uri.id = id
|
39
|
+
end
|
40
|
+
|
36
41
|
def to_s
|
37
42
|
uri.to_s
|
38
43
|
end
|
data/lib/uri/plate_id.rb
CHANGED
@@ -9,11 +9,14 @@ module URI
|
|
9
9
|
#
|
10
10
|
# The URI format looks like "plateid://group_name/base_class/id".
|
11
11
|
|
12
|
+
attr_writer :id
|
13
|
+
|
12
14
|
MAPPING = {
|
13
15
|
"Site" => { host: "Base", base_class: "Site" },
|
14
16
|
"Ngn::Attachment" => { host: "Base", base_class: "Attachment" },
|
15
17
|
"Ngn::Domain" => { host: "Base", base_class: "Domain" },
|
16
18
|
"Ngn::ClipboardItem" => { host: "Base", base_class: "ClipboardItem" },
|
19
|
+
"Ngn::VersionControl::Actions::Action" => { host: "Base", base_class: "VersionControl" },
|
17
20
|
|
18
21
|
"Ngn::Content::Post" => { host: "Content", base_class: "Post" },
|
19
22
|
"Ngn::Content::Section" => { host: "Content", base_class: "Section" },
|
@@ -22,6 +25,7 @@ module URI
|
|
22
25
|
"Ngn::Content::Element" => { host: "Content", base_class: "Element" },
|
23
26
|
"Ngn::Content::ContentObject" => { host: "Content", base_class: "ContentObject" },
|
24
27
|
"Ngn::Content::SiteTranslation" => { host: "Content", base_class: "SiteTranslation" },
|
28
|
+
"Ngn::Content::AuthenticationObject" => { host: "Content", base_class: "AuthenticationObject" },
|
25
29
|
|
26
30
|
"Ngn::ContentModel::ContentField" => { host: "ContentModel", base_class: "ContentField" },
|
27
31
|
"Ngn::ContentModel::ContentFieldTab" => { host: "ContentModel", base_class: "ContentFieldGroup" },
|
@@ -44,7 +48,9 @@ module URI
|
|
44
48
|
"Org::FormMessage" => { host: "Organization", base_class: "FormMessage" },
|
45
49
|
|
46
50
|
# Access control
|
47
|
-
"AccessControl::Policy" => { host: "AccessControl", base_class: "Policy" }
|
51
|
+
"AccessControl::Policy" => { host: "AccessControl", base_class: "Policy" },
|
52
|
+
"AccessControl::Role" => { host: "AccessControl", base_class: "Role" },
|
53
|
+
"AccessControl::Group" => { host: "AccessControl", base_class: "Group" }
|
48
54
|
}
|
49
55
|
|
50
56
|
attr_reader :base_class, :id
|
@@ -81,7 +87,11 @@ module URI
|
|
81
87
|
# )
|
82
88
|
def build(args)
|
83
89
|
comps = Util.make_components_hash(self, args)
|
90
|
+
return unless comps
|
91
|
+
|
84
92
|
parts = MAPPING[comps[:model_name]].dup
|
93
|
+
return unless parts
|
94
|
+
|
85
95
|
parts[:scheme] = comps[:scheme]
|
86
96
|
parts[:id] = comps[:model_id]
|
87
97
|
parts[:path] = "/#{parts[:base_class]}/#{CGI.escape(parts[:id].to_s)}"
|
data/plate_id.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plate_id
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kobus Post
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Identify any Plate record or class with URIs. Somewhat based on Rails's
|
14
14
|
GlobalID gem.
|