@@ -67,38 +67,42 @@ Universal ID introduces a paradigm shift and enables straightforward simple [**s
67
67
68
68
## URI::UID
69
69
70
- Universal ID introduces a new URI defintion that can represent any Ruby object, yet its API is simple.
71
- UID strings are URL-safe and can be reliably transported over the wire using HTTP.
72
- The payload is optimized to be as small as possible... _ especially notable with large objects._
70
+ Universal ID introduces a new URI defintion that can recursively marshal any Ruby object into an URL-safe string
71
+ that can be safely transported over the wire with HTTP.
72
+
73
+ > [ !NOTE]
74
+ > The payload is optimized to be as small as possible, _ which is especially notable with large objects._
75
+
76
+ The best part: ** The API is simple.**
73
77
74
78
``` ruby
75
- data = { name: " Universal ID Demo " , data: { message: " This is cool. " } }
79
+ data = :ANY_OBJECT_YOU_CAN_IMAGINE
76
80
77
81
uid = URI ::UID .build(data)
78
- # <URI::UID payload=ixuAgtYAbmFtZbFVbml2ZXJzYWwgSUQgRGVtb ..., fingerprint=CwSAkccFf6RIYXNoAw >
82
+ # <URI::UID payload=Cw6AxxoAQU5ZX09CSkVDVF9ZT1VfQ0FOX0lNQ ..., fingerprint=CwWAkccHf6ZTeW1ib2wD >
79
83
80
84
uid.payload
81
- " ixuAgtYAbmFtZbFVbml2ZXJzYWwgSUQgRGVtb9YAZGF0YYHHBwBtZXNzYWdlrVRoaXMgaXMgY29vbC4D "
85
+ " Cw6AxxoAQU5ZX09CSkVDVF9ZT1VfQ0FOX0lNQUdJTkUD "
82
86
83
87
uid.fingerprint
84
- " CwSAkccFf6RIYXNoAw "
88
+ " CwWAkccHf6ZTeW1ib2wD "
85
89
86
90
uri = uid.to_s
87
- " uid://universalid/ixuAgtYAbmFtZbFVbml2ZXJzYWwgSUQgRGVtb9YAZGF0YYHHBwBtZXNzYWdlrVRoaXMgaXMgY29vbC4D#CwSAkccFf6RIYXNoAw "
91
+ " uid://universalid/Cw6AxxoAQU5ZX09CSkVDVF9ZT1VfQ0FOX0lNQUdJTkUD#CwWAkccHf6ZTeW1ib2wD "
88
92
89
93
parsed = URI ::UID .parse(uri)
90
- # <URI::UID payload=ixuAgtYAbmFtZbFVbml2ZXJzYWwgSUQgRGVtb ..., fingerprint=CwSAkccFf6RIYXNoAw >
94
+ # <URI::UID payload=Cw6AxxoAQU5ZX09CSkVDVF9ZT1VfQ0FOX0lNQ ..., fingerprint=CwWAkccHf6ZTeW1ib2wD >
91
95
92
96
parsed.decode
93
- { :name => " Universal ID Demo " , :data =>{ :message => " This is cool. " }}
97
+ :ANY_OBJECT_YOU_CAN_IMAGINE
94
98
95
99
# it's also possible to parse the payload by itself
96
100
97
101
parsed = URI ::UID .from_payload(uid.payload)
98
- # <URI::UID payload=ixuAgtYAbmFtZbFVbml2ZXJzYWwgSUQgRGVtb ..., fingerprint=CwSAkccFf6RIYXNoAw >
102
+ # <URI::UID payload=Cw6AxxoAQU5ZX09CSkVDVF9ZT1VfQ0FOX0lNQ ..., fingerprint=CwWAkccHf6ZTeW1ib2wD >
99
103
100
104
parsed.decode
101
- { :name => " Universal ID Demo " , :data =>{ :message => " This is cool. " }}
105
+ :ANY_OBJECT_YOU_CAN_IMAGINE
102
106
```
103
107
104
108
## Supported Data Types
0 commit comments