Class: Urbit::PublishGraph
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#title ⇒ Object
Returns the value of attribute title.
Attributes inherited from Graph
Instance Method Summary collapse
- #add_post(author:, title:, body:) ⇒ Object
-
#initialize(ship:, graph_name:, title:, description:, persistent: false) ⇒ PublishGraph
constructor
A new instance of PublishGraph.
- #persist ⇒ Object
- #persistent? ⇒ Boolean
Methods inherited from Graph
#add_node, #creator, #delete, #group, #group=, #host_ship, #molt, #newer_sibling_nodes, #newest_nodes, #node, #nodes, #older_sibling_nodes, #oldest_nodes, #resource, #to_s, #type
Constructor Details
#initialize(ship:, graph_name:, title:, description:, persistent: false) ⇒ PublishGraph
Returns a new instance of PublishGraph.
210 211 212 213 214 215 |
# File 'lib/urbit/graph.rb', line 210 def initialize(ship:, graph_name:, title:, description:, persistent: false) super ship: ship, graph_name: graph_name, host_ship_name: ship.untilded_name @persistent = persistent @title = title @description = description end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
208 209 210 |
# File 'lib/urbit/graph.rb', line 208 def description @description end |
#title ⇒ Object
Returns the value of attribute title.
208 209 210 |
# File 'lib/urbit/graph.rb', line 208 def title @title end |
Instance Method Details
#add_post(author:, title:, body:) ⇒ Object
217 218 219 220 221 |
# File 'lib/urbit/graph.rb', line 217 def add_post(author:, title:, body:) j = self.create_post_json(, title, body) resp = self.ship.spider(mark_in: 'graph-update-3', mark_out: 'graph-view-action', thread: 'graph-add-nodes', data: j) (200 == resp[:status]) end |
#persist ⇒ Object
223 224 225 226 227 |
# File 'lib/urbit/graph.rb', line 223 def persist # PublishGraph, persist thyself in urbit... resp = self.ship.spider(mark_in: 'graph-view-action', mark_out: 'json', thread: 'graph-create', data: self.create_graph_json) @persistent = (200 == resp[:status]) end |
#persistent? ⇒ Boolean
229 230 231 |
# File 'lib/urbit/graph.rb', line 229 def persistent? @persistent end |