class VirusTotal::Client::Graph

Public Instance Methods

add_editor(id, **params) click to toggle source

Add a user or group as a graph editor.

@see developers.virustotal.com/v3.0/reference#graphs-add-editor

@param [String] id A 65 char length id which uniquely identify the graph. @param [Hash] **params

@return [Hash]

# File lib/virustotal/clients/graph.rb, line 149
def add_editor(id, **params)
  _post("/graphs/#{id}/relationships/editors", params) { |json| json }
end
add_viewer(id, **params) click to toggle source

Add a user or group as a graph viewer.

@see developers.virustotal.com/v3.0/reference#graphs-add-viewer

@param [String] id A 65 char length id which uniquely identify the graph. @param [Hash] **params

@return [Hash]

# File lib/virustotal/clients/graph.rb, line 88
def add_viewer(id, **params)
  _post("/graphs/#{id}/relationships/viewers", params) { |json| json }
end
check_editor(id, user_or_group_id) click to toggle source

Check if a user or group is a graph editor.

@see developers.virustotal.com/v3.0/reference#graphs-check-editor

@param [String] id A 65 char length id which uniquely identify the graph. @param [String] user_or_group_id user or group ID

@return [Hash]

# File lib/virustotal/clients/graph.rb, line 163
def check_editor(id, user_or_group_id)
  _get("/graphs/#{id}/relationships/editors/#{user_or_group_id}") { |json| json }
end
check_viewer(id, user_or_group_id) click to toggle source

Check if a user or group is a graph viewer

@see developers.virustotal.com/v3.0/reference#graphs-check-viewer

@param [String] id A 65 char length id which uniquely identify the graph. @param [String] user_or_group_id user or group ID

@return [<Type>] <description>

# File lib/virustotal/clients/graph.rb, line 102
def check_viewer(id, user_or_group_id)
  _get("/graphs/#{id}/relationships/viewers/#{user_or_group_id}") { |json| json }
end
create(**params) click to toggle source

Create a graph with the given nodes and links.

@see developers.virustotal.com/v3.0/reference#create-graphs

@param [Hash] **params

@return [Hash]

# File lib/virustotal/clients/graph.rb, line 41
def create(**params)
  _post("/graphs", params) { |json| json }
end
delete_editor(id, user_or_group_id) click to toggle source

Remove a user or group as editor of a graph.

@see developers.virustotal.com/v3.0/reference#graphs-delete-editor

@param [String] id A 65 char length id which uniquely identify the graph. @param [String] user_or_group_id user or group ID

@return [Hash]

# File lib/virustotal/clients/graph.rb, line 177
def delete_editor(id, user_or_group_id)
  _delete("/graphs/#{id}/relationships/editors/#{user_or_group_id}") { |json| json }
end
delete_viewer(id, user_or_group_id) click to toggle source

Remove a user or group as viewer of a graph.

@see developers.virustotal.com/v3.0/reference#graphs-delete-viewer

@param [String] id A 65 char length id which uniquely identify the graph. @param [String] user_or_group_id user or group ID

@return [<Type>] <description>

# File lib/virustotal/clients/graph.rb, line 116
def delete_viewer(id, user_or_group_id)
  _delete("/graphs/#{id}/relationships/viewers/#{user_or_group_id}") { |json| json }
end
editors(id, limit: nil, cursor: nil) click to toggle source

Retrieve graph editors.

@see developers.virustotal.com/v3.0/reference#graphs-editors

@param [String] id A 65 char length id which uniquely identify the graph. @param [String, nil] limit Maximum number of related objects to retrieve @param [Integer, nil] cursor Continuation cursor

@return [Hash]

# File lib/virustotal/clients/graph.rb, line 131
def editors(id, limit: nil, cursor: nil)
  params = {
    limit: limit,
    cursor: cursor
  }.compact
  _get("/graphs/#{id}/relationships/editors", params) { |json| json }
end
update(id, **params) click to toggle source

Update a graph.

@see developers.virustotal.com/v3.0/reference#graphs-update

@param [String] id A 65 char length id which uniquely identify the graph. @param [Hash] **params

@return [Hash]

# File lib/virustotal/clients/graph.rb, line 55
def update(id, **params)
  _patch("/graphs/#{id}", params) { |json| json }
end
viewers(id, limit: nil, cursor: nil) click to toggle source

Retrieve graph viewers.

@see developers.virustotal.com/v3.0/reference#graphs-viewers

@param [String] id A 65 char length id which uniquely identify the graph. @param [String, nil] limit Maximum number of related objects to retrieve @param [Integer, nil] cursor Continuation cursor

@return [Hash]

# File lib/virustotal/clients/graph.rb, line 70
def viewers(id, limit: nil, cursor: nil)
  params = {
    limit: limit,
    cursor: cursor
  }.compact
  _get("/graphs/#{id}/relationships/viewers", params) { |json| json }
end

Private Instance Methods

relationships() click to toggle source
# File lib/virustotal/clients/graph.rb, line 183
def relationships
  @relationships ||= %w(
    comments
    items
    viewers
    editors
    owner
    group
  ).map(&:to_sym)
end