urbit-api 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,11 +2,15 @@ module Urbit
2
2
  class SubscribeMessage < Message
3
3
  attr_reader :path
4
4
 
5
- def initialize(channel, app, path)
6
- super(channel, 'subscribe', app)
5
+ def initialize(channel:, app:, path:)
6
+ super(channel: channel, app: app)
7
7
  @path = path
8
8
  end
9
9
 
10
+ def action
11
+ "subscribe"
12
+ end
13
+
10
14
  def to_h
11
15
  {action: self.action, app: self.app, id: self.id, path: self.path, ship: self.ship.untilded_name}
12
16
  end
@@ -0,0 +1,51 @@
1
+ {
2
+ :status => 200,
3
+ :code => "ok",
4
+ :body =>" {
5
+ "graph-update": {
6
+ "add-graph": {
7
+ "graph":{},
8
+ "resource" : {
9
+ "name": "dec74689ad",
10
+ "ship": "zod"
11
+ },
12
+ "mark" : "graph-validator-chat",
13
+ "overwrite":true
14
+ }
15
+ }
16
+ }
17
+ }
18
+
19
+
20
+ {
21
+ "status": 200,
22
+ "code": "ok",
23
+ "body": {
24
+ "graph-update": {
25
+ "add-graph": {
26
+ "graph": {
27
+ "170141184505196673936784618510385938432": {
28
+ "post" : {
29
+ "index": "/170141184505196673936784618510385938432",
30
+ "author": "zod",
31
+ "time-sent": 1628715932642,
32
+ "signatures": [
33
+ {"signature": "0x2.7d8e.58d0.ee70.c720.e0c7.0fbe.40be.f68c.0401.950e.1bb8.9eda.cb66.3726.8995.3ca2.2d51.aa34.fcc8.ea00.1193.9145.38c9.7fea.8285.bd4e.d390.a195.f7e6.0870.5f7c.c73b.67a7.d19c.375b.fc29.aac7.6879.04fa.6a0f.cb7f.9001", "life": 1 ,"ship": "zod\}
34
+ ],
35
+ "contents": [
36
+ {"text" : "test?"}
37
+ ],
38
+ "hash": "0x9f63.9634.3b9c.31c8.3831.c3ef.902f.bda3"},
39
+ "children":null
40
+ }
41
+ },
42
+ "resource" : {
43
+ "name": "dec74689ad",
44
+ "ship": "zod"
45
+ },
46
+ "mark": "graph-validator-chat",
47
+ "overwrite": true
48
+ }
49
+ }
50
+ }
51
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ :status => 200,
3
+ :code => "ok",
4
+ :body => {
5
+ "graph-update": {
6
+ "keys": [
7
+ {"name": "announce", "ship": "darlur"},
8
+ {"name": "test0-996", "ship": "barsyr-latreb"},
9
+ {"name": "test1-4287", "ship": "barsyr-latreb"},
10
+ {"name": "welcome-to-urbit-community", "ship": "darrux-landes"},
11
+ {"name": "help-desk-4556", "ship": "darlur"}
12
+ ]
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,34 @@
1
+ [1] pry(main)> ship = Urbit.connect(config_file: '_config-barsyr-latreb.yml')
2
+ => a Ship(name: '~barsyr-latreb', host: 'http://localhost', port: '8080')
3
+
4
+ [2] pry(main)> ship.scry('graph-store', "/graph/~darlur/announce/node/siblings/newest/lone/1")
5
+ =>
6
+ :status => 200,
7
+ :code => "ok",
8
+ :body => {
9
+ "graph-update": {
10
+ "add-nodes": {
11
+ "resource": {
12
+ "name": "announce",
13
+ "ship": "darlur"
14
+ },
15
+ "nodes" : {
16
+ "/170141184505036957608427254348286787584": {
17
+ "post" : {
18
+ "index": "/170141184505036957608427254348286787584",
19
+ "author": "darlur",
20
+ "time-sent": 1620057693019,
21
+ "signatures": [
22
+ {"signature": "0x5468.e5ec.1955.3e10.14a6.5fc0.054e.0e1b.fe01.1272.0a2c.e3c8.37a5.6717.ed7d.4b0c.3102.3966.4caa.edeb.e89e.3194.be17.f6a7.0622.4775.5e8f.7e92.16d2.c552.5ecd.d28b.17a6.aad5.089b.3623.eb8b.1b62.1525.0571.2d9f.9001", "life ": 3, "ship": "darlur"}
23
+ ],
24
+ "contents": [
25
+ {\"text\":\"We are now running urbit v1.5."}
26
+ ],
27
+ "hash": "0x5468.e5ec.1955.3e10.14a6.5fc0.054e.0e1b"
28
+ },
29
+ "children":null
30
+ }
31
+ }
32
+ }
33
+ }
34
+ }
@@ -0,0 +1,76 @@
1
+ [8] pry(main)> channel.receiver.facts.each {|f| puts f};nil
2
+ {:message => {
3
+ "ok" => "ok",
4
+ "id" => 1,
5
+ "response" => "subscribe"}
6
+ }
7
+ {:message => {
8
+ "json" => {
9
+ "graph-update" => {
10
+ "add-nodes" => {
11
+ "resource" => {
12
+ "name" => "top-shelf-6391",
13
+ "ship" => "winter-paches"
14
+ },
15
+ "nodes" => {
16
+ "/170141184505207442993270453156437819392" => {
17
+ "post" => {
18
+ "index"=>"/170141184505207442993270453156437819392",
19
+ "author"=>"winter-paches",
20
+ "time-sent"=>1629299723410,
21
+ "signatures"=>[{"signature"=>"0x1.5003.94a6.2a10.7baf.ba44.a4d9.0353.e61a.0200.fdb2.fccf.f760.e1a0.bd20.dafa.f17e.e759.c8ab.f3b2.bb03.ccfa.1f10.c060.b063.cf32.48f6.ce27.4cae.462a.a228.47e9.5642.6476.5664.a918.839b.4053.91fe.b08c.f18c.525f.7001", "life"=>3, "ship"=>"winter-paches"}],
22
+ "contents"=>[{"text"=>"i will be really sad if hockey goes even more the way of the other sports."}],
23
+ "hash"=>"0xa801.ca53.1508.3dd7.dd22.526c.81a9.f30d"},
24
+ "children"=>nil
25
+ }
26
+ }
27
+ }
28
+ }
29
+ }, "id"=>1, "response"=>"diff"}}
30
+ {:message => {
31
+ "json" => {
32
+ "graph-update"=>{"add-nodes"=>{"resource"=>{"name"=>"top-shelf-6391", "ship"=>"winter-paches"}, "nodes"=>{"/170141184505207446323799471187231244288"=>{"post"=>{"index"=>"/170141184505207446323799471187231244288", "author"=>"rivlyt-dotnet", "time-sent"=>1629299904766, "signatures"=>[{"signature"=>"0x668d.5edb.31d1.18ee.fb3a.7bd0.e6e6.6582.fe01.d7c0.61a7.aadf.c1b0.7e9c.26ad.8412.c3a5.6221.eff0.d25f.f505.18d9.693c.a888.debd.635d.c692.b138.9f5e.d52d.513d.291f.326b.2261.4a08.7680.58d0.e654.3556.bbd5.d43f.9001", "life"=>1, "ship"=>"rivlyt-dotnet"}], "contents"=>[{"url"=>"http://www.hockeyworldblog.com/wp-content/uploads/2009/07/SamiKapanenKalPa.jpg"}, {"text"=>""}], "hash"=>"0x668d.5edb.31d1.18ee.fb3a.7bd0.e6e6.6582"}, "children"=>nil}}}}}, "id"=>1, "response"=>"diff"}}
33
+ {:message => {
34
+ "json" => {
35
+ "graph-update" => {
36
+ "add-nodes" => {
37
+ "resource" => {
38
+ "name" => "dm-inbox",
39
+ "ship" => "barsyr-latreb"
40
+ },
41
+ "nodes" => {
42
+ "/3830645248/170141184505207462626569476439992696832" => {
43
+ "post" => {
44
+ "index" => "/3830645248/170141184505207462626569476439992696832",
45
+ "author" => "winter-paches",
46
+ "time-sent" => 1629300788090,
47
+ "signatures" => [
48
+ {"signature" => "0x8b2.4b04.d55d.38fb.3561.6840.7312.2c5d.3e80.6494.9c69.0c8c.5480.21d8.87e1.93d4.79ca.e299.8482.17d6.b1d5.075f.837e.e1c9.9776.1a10.1710.f62a.6f68.8415.e85f.62c9.ff0f.b5b7.e605.bb8f.ee6e.d856.8505.08eb.901f.5001",
49
+ "life"=>3,
50
+ "ship"=>"winter-paches"}
51
+ ],
52
+ "contents"=>[
53
+ {"text"=>"still there?"}
54
+ ],
55
+ "hash" => "0x22c9.2c13.5574.e3ec.d585.a101.cc48.b174"
56
+ },
57
+ "children" => {
58
+ "170141184505210800341365283904498434048" :{
59
+ "post" : {
60
+ "index": "/3830645248/170141184505210800341365283904498434048",
61
+ "author": "winter-paches",
62
+ "time-sent\":1629481725905,
63
+ "signatures\":[{\"signature\":\"0x2cbc.3fa5.5e05.1851.0bc0.c139.7356.86dc.fa01.24bf.82c7.078d.59b7.7365.de54.87de.6043.7cca.1bcc.5746.cb4e.6585.f81e.ab97.edf4.9b5e.e499.1df3.486f.965b.0247.6cdd.8ed8.2a70.37f1.f9ec.97dd.6d55.19f5.0b0d.e17f.9001\",\"life\":3,\"ship\":\"winter-paches\"}],
64
+ "contents\":[{\"text\":\"two\"}],
65
+ "hash\":\"0x2cbc.3fa5.5e05.1851.0bc0.c139.7356.86dc\"
66
+ },
67
+ "children": null
68
+ }
69
+ }
70
+ }
71
+ }
72
+ }
73
+ }
74
+ },
75
+ "id"=>1,
76
+ "response"=>"diff"}}
@@ -0,0 +1,20 @@
1
+ {
2
+ :message=> {
3
+ "json"=> {
4
+ "graph-update"=> {
5
+ "add-graph"=> {
6
+ "graph" => {
7
+ },
8
+ "resource" => {
9
+ "name" => "test1-4287",
10
+ "ship" => "barsyr-latreb"
11
+ },
12
+ "mark" => "graph-validator-publish",
13
+ "overwrite" => true
14
+ }
15
+ }
16
+ },
17
+ "id" => 2,
18
+ "response" => "diff"
19
+ }
20
+ }
@@ -0,0 +1,75 @@
1
+ {
2
+ :message => {
3
+ "json" => {
4
+ "graph-update" => {
5
+ "add-nodes" => {
6
+ "resource" => {
7
+ "name" => "test1-4287",
8
+ "ship" => "barsyr-latreb"
9
+ },
10
+ "nodes" => {
11
+ "/170141184505020984719232265951207489536/2" => {
12
+ "post" => {
13
+ "index" => "/170141184505020984719232265951207489536/2",
14
+ "author" => "barsyr-latreb",
15
+ "time-sent" => 1619191801085,
16
+ "signatures"=> [
17
+ {
18
+ "signature" => "0x1.284d.9ddd.b0ca.3b77.ce22.bea4.4fad.1018.0200.fb46.de9e.541a.7c0d.c680.20a3.986c.ce0f.944b.4f48.cdb1.64aa.bc8a.ce34.c7ee.bcc4.47ce.7dd2.8b98.12b8.c69b.98ae.73e3.3a40.592e.11b2.1445.6cbf.bfbc.6e60.6815.e1bf.7001",
19
+ "life"=>3,
20
+ "ship"=>"barsyr-latreb"
21
+ }
22
+ ],
23
+ "contents" => [],
24
+ "hash" =>"0x9426.ceee.d865.1dbb.e711.5f52.27d6.880c"
25
+ },
26
+ "children" => nil
27
+ },
28
+ "/170141184505020984719232265951207489536/1/1" => {
29
+ "post" => {
30
+ "index" => "/170141184505020984719232265951207489536/1/1",
31
+ "author" => "barsyr-latreb",
32
+ "time-sent" =>1619191801085,
33
+ "signatures" => [
34
+ {
35
+ "signature" => "0x4abf.c85f.4db6.bda6.a5ca.155c.f479.c1ee.0080.36c0.7fc4.fc07.5492.fba6.0eac.bcd1.6cde.3f05.46cb.7654.cb78.8baa.f398.37d6.5098.a7ce.6a07.6cfe.5f99.6ee2.b3a1.6717.ac2d.c396.6a86.5495.d88e.fc55.cbbf.0e1e.70ff.3001",
36
+ "life" =>3,
37
+ "ship" => "barsyr-latreb"
38
+ }
39
+ ],
40
+ "contents" => [
41
+ {"text" => "Post 1"},
42
+ {"text" => "First post of the graph store portion of the airlock implementation."}
43
+ ],
44
+ "hash" => "0x957f.90be.9b6d.7b4d.4b94.2ab9.e8f3.83dc"
45
+ },
46
+ "children" => nil
47
+ },
48
+ "/170141184505020984719232265951207489536"=>
49
+ {"post"=>
50
+ {"index"=>"/170141184505020984719232265951207489536",
51
+ "author"=>"barsyr-latreb",
52
+ "time-sent"=>1619191801085,
53
+ "signatures"=>
54
+ [{"signature"=>
55
+ "0x6401.1904.eca5.c18c.d9a4.cf52.d00d.6bc5.8080.247c.6a06.3709.44ce.ad7e.fd14.bccb.c982.3df6.dba3.c727.cccd.f433.47b5.2342.780c.0b27.4fd8.85eb.4c67.5466.565c.3fc6.66c5.1832.72da.2557.940b.3549.14a7.66ab.e1df.3001",
56
+ "life"=>3,
57
+ "ship"=>"barsyr-latreb"}],
58
+ "contents"=>[],
59
+ "hash"=>"0xc802.3209.d94b.8319.b349.9ea5.a01a.d78b"},
60
+ "children"=>nil},
61
+ "/170141184505020984719232265951207489536/1"=>
62
+ {"post"=>
63
+ {"index"=>"/170141184505020984719232265951207489536/1",
64
+ "author"=>"barsyr-latreb",
65
+ "time-sent"=>1619191801085,
66
+ "signatures"=>
67
+ [{"signature"=>
68
+ "0x1.284d.9ddd.b0ca.3b77.ce22.bea4.4fad.1018.0200.fb46.de9e.541a.7c0d.c680.20a3.986c.ce0f.944b.4f48.cdb1.64aa.bc8a.ce34.c7ee.bcc4.47ce.7dd2.8b98.12b8.c69b.98ae.73e3.3a40.592e.11b2.1445.6cbf.bfbc.6e60.6815.e1bf.7001",
69
+ "life"=>3,
70
+ "ship"=>"barsyr-latreb"}],
71
+ "contents"=>[],
72
+ "hash"=>"0x9426.ceee.d865.1dbb.e711.5f52.27d6.880c"},
73
+ "children"=>nil}}}}},
74
+ "id"=>2,
75
+ "response"=>"diff"}}
data/misc/post ADDED
@@ -0,0 +1,12 @@
1
+ "post" => {
2
+ "index" => "/170141184504863525594513045663867817951",
3
+ "author" => "barsyr-latreb",
4
+ "time-sent" => 1610655924876,
5
+ "signatures" => [],
6
+ "contents" => [
7
+ {"text" => "~all : another new planet has coalesced..."},
8
+ {"mention"=> "barsyr-latreb"},
9
+ {"text" => "."}
10
+ ],
11
+ "hash" => nil
12
+ },
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: urbit-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daryl Richter
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-04-29 00:00:00.000000000 Z
11
+ date: 2021-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -90,14 +90,26 @@ files:
90
90
  - lib/urbit/api.rb
91
91
  - lib/urbit/api/version.rb
92
92
  - lib/urbit/channel.rb
93
+ - lib/urbit/chat_channel.rb
93
94
  - lib/urbit/close_message.rb
94
95
  - lib/urbit/config.rb
96
+ - lib/urbit/fact.rb
97
+ - lib/urbit/graph.rb
95
98
  - lib/urbit/message.rb
99
+ - lib/urbit/node.rb
100
+ - lib/urbit/parser.rb
96
101
  - lib/urbit/poke_message.rb
97
102
  - lib/urbit/receiver.rb
98
103
  - lib/urbit/ship.rb
99
104
  - lib/urbit/subscribe_message.rb
100
105
  - lib/urbit/urbit.rb
106
+ - misc/graph-store_graph
107
+ - misc/graph-store_keys
108
+ - misc/graph-store_node
109
+ - misc/graph-store_update
110
+ - misc/graph-update_add-graph
111
+ - misc/graph-update_add-nodes
112
+ - misc/post
101
113
  - urbit-api.gemspec
102
114
  homepage: https://www.ngzax.com
103
115
  licenses: