Class: Urbit::PublishGraph

Inherits:
Graph
  • Object
show all
Defined in:
lib/urbit/graph.rb

Instance Attribute Summary collapse

Attributes inherited from Graph

#host_ship_name, #name, #ship

Instance Method Summary collapse

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

#descriptionObject

Returns the value of attribute description.



208
209
210
# File 'lib/urbit/graph.rb', line 208

def description
  @description
end

#titleObject

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(author, 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

#persistObject



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

Returns:

  • (Boolean)


229
230
231
# File 'lib/urbit/graph.rb', line 229

def persistent?
  @persistent
end