Class: PassiveTotal::Client::Project

Inherits:
Base
  • Object
show all
Defined in:
lib/passivetotal/clients/project.rb

Constant Summary

Constants inherited from Base

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

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

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

Instance Method Details

#add_tags(project, tags) ⇒ Hash

Parameters:

  • project (String)

    the project id to update

  • tags (String)

    the tags or tag to add (list or str)

Returns:

  • (Hash)


15
16
17
18
19
20
21
22
# File 'lib/passivetotal/clients/project.rb', line 15

def add_tags(project, tags)
  params = {
    project: project,
    tags: tags,
  }.compact

  _get("/project/tag", params) { |json| json }
end

#create(name, visibility:, description: nil, featured: nil, tags: nil) ⇒ Hash

Parameters:

  • name (String)

    name of the project

  • visibility (String)

    the visibility

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

    the description

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

    whether to feature the project

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

    sets the project’s tags to this list

Returns:

  • (Hash)


36
37
38
39
40
41
42
43
44
45
46
# File 'lib/passivetotal/clients/project.rb', line 36

def create(name, visibility:, description: nil, featured: nil, tags: nil)
  params = {
    name: name,
    visibility: visibility,
    description: description,
    featured: featured,
    tags: tags,
  }.compact

  _put("/project", params) { |json| json }
end

#delete(project) ⇒ Hash

Parameters:

  • project (String)

    the project id to delete

Returns:

  • (Hash)


56
57
58
59
60
61
62
# File 'lib/passivetotal/clients/project.rb', line 56

def delete(project)
  params = {
    project: project,
  }.compact

  _delete("/project", params) { |json| json }
end

#get(project: nil, owner: nil, creator: nil, organization: nil, visibility: nil, featured: nil) ⇒ Hash

Retrieves a project or projects by search filter api.passivetotal.org/api/docs/#api-Project-GetV2Project

Parameters:

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

    filter by project id

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

    filter by owner (an email or organization id)

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

    filter by creator email

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

    filter by organization

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

    filter by visibility

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

    filter by featured status

Returns:

  • (Hash)


77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/passivetotal/clients/project.rb', line 77

def get(project: nil, owner: nil, creator: nil, organization: nil, visibility: nil, featured: nil)
  params = {
    project: project,
    owner: owner,
    creator: creator,
    organization: organization,
    visibility: visibility,
    featured: featured,
  }.compact

  _get("/project", params) { |json| json }
end

#remove_tags(project, tags) ⇒ Hash

Parameters:

  • project (String)

    the project id to update

  • tags (Array<String>)

    the tags or tag to remove (list or str)

Returns:

  • (Hash)


99
100
101
102
103
104
105
106
# File 'lib/passivetotal/clients/project.rb', line 99

def remove_tags(project, tags)
  params = {
    project: project,
    tags: tags,
  }.compact

  _delete("/project/tag", params) { |json| json }
end

#set_tags(project, tags) ⇒ Hash

Parameters:

  • project (String)

    the project id to update

  • tags (Array<String>)

    the tags or tag to set to (list or str)

Returns:

  • (Hash)


117
118
119
120
121
122
123
124
# File 'lib/passivetotal/clients/project.rb', line 117

def set_tags(project, tags)
  params = {
    project: project,
    tags: tags,
  }.compact

  _put("/project/tag", params) { |json| json }
end

#update(project, name: nil, description: nil, visibility: nil, featured: nil, tags: nil) ⇒ Hash

Updates a project denoted by project ID api.passivetotal.org/api/docs/#api-Project-PostV2Project

Parameters:

  • project (String)

    the project id to update

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

    the new name

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

    the new description

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

    ,“private”,“analyst”] the new visibility

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

    whether to feature the project

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

    sets the project’s tags to this list

Returns:

  • (Hash)


139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/passivetotal/clients/project.rb', line 139

def update(project, name: nil, description: nil, visibility: nil, featured: nil, tags: nil)
  params = {
    project: project,
    name: name,
    description: description,
    visibility: visibility,
    featured: featured,
    tags: tags,
  }.compact

  _post("/project", params) { |json| json }
end