Class: Graphcommons::Endpoint

Inherits:
API
  • Object
show all
Defined in:
lib/graphcommons.rb

Overview

Wrapper for general methods in the API.

Class Method Summary collapse

Methods inherited from API

check_key, delete, get, post, put, set_key

Class Method Details

.delete_graph(id) ⇒ Object



210
211
212
# File 'lib/graphcommons.rb', line 210

def self.delete_graph id
  self.delete :graphs, :id => id
end

.get_graph(id) ⇒ Object



173
174
175
# File 'lib/graphcommons.rb', line 173

def self.get_graph id
  self.get :graphs, :id => id
end

.get_graph_edges(id, options) ⇒ Object

Get edges inside graph with :id.

graphcommons.github.io/api-v1/#get-graphs-id-edges



187
188
189
190
# File 'lib/graphcommons.rb', line 187

def self.get_graph_edges id, options
  options[:id] = id
  self.get "graphs/edges", options
end

.get_graph_paths(id, options) ⇒ Object

Query for paths inside graph with :id.

graphcommons.github.io/api-v1/#get-graphs-id-paths



195
196
197
198
# File 'lib/graphcommons.rb', line 195

def self.get_graph_paths id, options
  options[:id] = id
  self.get "graphs/paths", options
end

.get_graph_types(id) ⇒ Object

Get node and edge types inside graph with :id.

graphcommons.github.io/api-v1/#get-graphs-id-types



180
181
182
# File 'lib/graphcommons.rb', line 180

def self.get_graph_types id
  self.get "graphs/types", :id => id
end

.get_hub(id) ⇒ Object



224
225
226
# File 'lib/graphcommons.rb', line 224

def self.get_hub id
  self.get :hubs, :id => id
end

.get_hub_graphs(id, options) ⇒ Object

Search for graphs inside hub with :id.

graphcommons.github.io/api-v1/#get-hubs-id-graphs



246
247
248
249
# File 'lib/graphcommons.rb', line 246

def self.get_hub_graphs id, options
  options[:id] = id
  self.get "graphs/search", options
end

.get_hub_nodes(id, options) ⇒ Object

Search for nodes inside hub with :id.

graphcommons.github.io/api-v1/#get-hubs-id-nodes



254
255
256
257
# File 'lib/graphcommons.rb', line 254

def self.get_hub_nodes id, options
  options[:id] = id
  self.get "nodes/search", options
end

.get_hub_paths(id, options) ⇒ Object

Query for paths inside hub with :id.

graphcommons.github.io/api-v1/#get-hubs-id-paths



238
239
240
241
# File 'lib/graphcommons.rb', line 238

def self.get_hub_paths id, options
  options[:id] = id
  self.get "hubs/paths", options
end

.get_hub_types(id) ⇒ Object

Get node and edge types in hub with :id.

graphcommons.github.io/api-v1/#get-hubs-id-types



231
232
233
# File 'lib/graphcommons.rb', line 231

def self.get_hub_types id
  self.get "hubs/types", :id => id
end

.get_node(id) ⇒ Object



217
218
219
# File 'lib/graphcommons.rb', line 217

def self.get_node id
  self.get :nodes, :id => id
end

.new_graph(options) ⇒ Object

Create new graph. Required options: :name

graphcommons.github.io/api-v1/#post-graphs



166
167
168
# File 'lib/graphcommons.rb', line 166

def self.new_graph options
  self.post :graphs, options
end

.statusObject



158
159
160
# File 'lib/graphcommons.rb', line 158

def self.status
  self.get :status
end

.update_graph(id, options) ⇒ Object

Modify attributes of graph with :id.

graphcommons.github.io/api-v1/#put-graphs-id



203
204
205
# File 'lib/graphcommons.rb', line 203

def self.update_graph id, options
  self.put :graphs, :id => id, :graph=> options
end