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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 181a22aff751916e466a2a130eba6962b573866c6af2ec27eda43133a1560f4d
4
- data.tar.gz: f2ebaa9a10793b74b30aa4b6add79513c76099a675f96cb736f960d319c3ed5f
3
+ metadata.gz: 4a739c97b4695a5e4215733bf61da11d9a062f4efad404f6457f3af84297076d
4
+ data.tar.gz: 554eb95e24f95a830446d45c404677d47f86986d2d593aae9caa7f38be932e2b
5
5
  SHA512:
6
- metadata.gz: 35e1344db5692a9ff86b5d53919bfcd79a574465518ab2d06245026b1e692a30d4675c02bec1d61b62df760501830d6554d1d6efa38fd58da516156950ba6eb7
7
- data.tar.gz: 01a1f5577e469b07722d64f44e61a3d12b33f8776fe0f31edf82d1c925c1d7c50c7b115e756c515e8a1a0d35b25446f383d6f92b474ae692352b4f95898cc7b6
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
- new(URI::PlateID.create(model))
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "plate_id"
5
- spec.version = "0.0.2"
5
+ spec.version = "0.0.7"
6
6
  spec.authors = ["Kobus Post"]
7
7
  spec.email = ["kobus@getplate.com"]
8
8
  spec.homepage = "https://www.getplate.com"
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.2
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-02-17 00:00:00.000000000 Z
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.