Class: VirusTotal::Client::Graph

Inherits:
Base
  • Object
show all
Includes:
Action::Get, Action::Relationships
Defined in:
lib/virustotal/clients/graph.rb

Constant Summary

Constants inherited from Base

Base::BASE_URL, Base::CONVERT_TABLE, Base::HOST, Base::VERSION

Instance Attribute Summary

Attributes inherited from Base

#key

Instance Method Summary collapse

Methods included from Action::Relationships

#method_missing, #respond_to_missing?

Methods included from Action::Get

#get

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from VirusTotal::Client::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class VirusTotal::Client::Action::Relationships

Instance Method Details

#add_editor(id, **params) ⇒ Hash

Add a user or group as a graph editor.

Parameters:

  • id (String)

    A 65 char length id which uniquely identify the graph.

  • **params (Hash)

Returns:

  • (Hash)

See Also:



150
151
152
# File 'lib/virustotal/clients/graph.rb', line 150

def add_editor(id, **params)
  _post("/graphs/#{id}/relationships/editors", params) { |json| json }
end

#add_viewer(id, **params) ⇒ Hash

Add a user or group as a graph viewer.

Parameters:

  • id (String)

    A 65 char length id which uniquely identify the graph.

  • **params (Hash)

Returns:

  • (Hash)

See Also:



89
90
91
# File 'lib/virustotal/clients/graph.rb', line 89

def add_viewer(id, **params)
  _post("/graphs/#{id}/relationships/viewers", params) { |json| json }
end

#check_editor(id, user_or_group_id) ⇒ Hash

Check if a user or group is a graph editor.

Parameters:

  • id (String)

    A 65 char length id which uniquely identify the graph.

  • user_or_group_id (String)

    user or group ID

Returns:

  • (Hash)

See Also:



164
165
166
# File 'lib/virustotal/clients/graph.rb', line 164

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) ⇒ <Type>

Check if a user or group is a graph viewer

Parameters:

  • id (String)

    A 65 char length id which uniquely identify the graph.

  • user_or_group_id (String)

    user or group ID

Returns:

  • (<Type>)

    <description>

See Also:



103
104
105
# File 'lib/virustotal/clients/graph.rb', line 103

def check_viewer(id, user_or_group_id)
  _get("/graphs/#{id}/relationships/viewers/#{user_or_group_id}") { |json| json }
end

#create(**params) ⇒ Hash

Create a graph with the given nodes and links.

Parameters:

  • **params (Hash)

Returns:

  • (Hash)

See Also:



42
43
44
# File 'lib/virustotal/clients/graph.rb', line 42

def create(**params)
  _post("/graphs", params) { |json| json }
end

#delete_editor(id, user_or_group_id) ⇒ Hash

Remove a user or group as editor of a graph.

Parameters:

  • id (String)

    A 65 char length id which uniquely identify the graph.

  • user_or_group_id (String)

    user or group ID

Returns:

  • (Hash)

See Also:



178
179
180
# File 'lib/virustotal/clients/graph.rb', line 178

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) ⇒ <Type>

Remove a user or group as viewer of a graph.

Parameters:

  • id (String)

    A 65 char length id which uniquely identify the graph.

  • user_or_group_id (String)

    user or group ID

Returns:

  • (<Type>)

    <description>

See Also:



117
118
119
# File 'lib/virustotal/clients/graph.rb', line 117

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) ⇒ Hash

Retrieve graph editors.

Parameters:

  • id (String)

    A 65 char length id which uniquely identify the graph.

  • limit (String, nil) (defaults to: nil)

    Maximum number of related objects to retrieve

  • cursor (Integer, nil) (defaults to: nil)

    Continuation cursor

Returns:

  • (Hash)

See Also:



132
133
134
135
136
137
138
# File 'lib/virustotal/clients/graph.rb', line 132

def editors(id, limit: nil, cursor: nil)
  params = {
    limit: limit,
    cursor: cursor
  }.compact
  _get("/graphs/#{id}/relationships/editors", params) { |json| json }
end

#search(filter: nil, limit: nil, cursor: nil, order: nil, attributes: nil) ⇒ Hash

Return graphs.

Parameters:

  • filter (String, nil) (defaults to: nil)

    Return the graphs matching the given criteria only

  • limit (Integer, nil) (defaults to: nil)

    Maximum number graphs to retrieve

  • cursor (String, nil) (defaults to: nil)

    Continuation cursor

  • order (String, nil) (defaults to: nil)

    Sort order

  • attributes (String, nil) (defaults to: nil)

    Specific fields to retrieve

Returns:

  • (Hash)

See Also:



22
23
24
25
26
27
28
29
30
31
# File 'lib/virustotal/clients/graph.rb', line 22

def search(filter: nil, limit: nil, cursor: nil, order: nil, attributes: nil)
  params = {
    filter: filter,
    limit: limit,
    cursor: cursor,
    order: order,
    attributes: attributes
  }.compact
  _get("/graphs", params) { |json| json }
end

#update(id, **params) ⇒ Hash

Update a graph.

Parameters:

  • id (String)

    A 65 char length id which uniquely identify the graph.

  • **params (Hash)

Returns:

  • (Hash)

See Also:



56
57
58
# File 'lib/virustotal/clients/graph.rb', line 56

def update(id, **params)
  _patch("/graphs/#{id}", params) { |json| json }
end

#viewers(id, limit: nil, cursor: nil) ⇒ Hash

Retrieve graph viewers.

Parameters:

  • id (String)

    A 65 char length id which uniquely identify the graph.

  • limit (String, nil) (defaults to: nil)

    Maximum number of related objects to retrieve

  • cursor (Integer, nil) (defaults to: nil)

    Continuation cursor

Returns:

  • (Hash)

See Also:



71
72
73
74
75
76
77
# File 'lib/virustotal/clients/graph.rb', line 71

def viewers(id, limit: nil, cursor: nil)
  params = {
    limit: limit,
    cursor: cursor
  }.compact
  _get("/graphs/#{id}/relationships/viewers", params) { |json| json }
end