Class: PassiveTotal::Client::Artifact
- Defined in:
- lib/passivetotal/clients/artifact.rb
Constant Summary
Constants inherited from Base
Base::BASE_URL, Base::HOST, Base::VERSION
Instance Method Summary collapse
-
#bulk_create(artifacts) ⇒ Hash
Create artifacts in bulk.
-
#bulk_delete(artifacts) ⇒ Hash
Delete artifacts in bulk.
-
#bulk_update(artifacts) ⇒ Hash
Perform artifact updates in bulk.
-
#create(project:, query:, type: nil, tags: nil) ⇒ Hash
Create an artifact.
-
#delete(artifact) ⇒ Hash
Delete an artifact with a UUID.
-
#find(artifact: nil, project: nil, owner: nil, creator: nil, organization: nil, query: nil, type: nil) ⇒ Hash
Read existing artifacts.
-
#update(artifact, monitor: nil, tags: nil) ⇒ Hash
Update artifact, or toggle monitoring status.
Methods inherited from Base
Constructor Details
This class inherits a constructor from PassiveTotal::Client::Base
Instance Method Details
#bulk_create(artifacts) ⇒ Hash
Create artifacts in bulk. api.passivetotal.org/api/docs/#api-Artifact-PutV2ArtifactBulk
14 15 16 17 18 19 20 |
# File 'lib/passivetotal/clients/artifact.rb', line 14 def bulk_create(artifacts) params = { artifacts: artifacts, }.compact _put("/artifact/bulk", params) { |json| json } end |
#bulk_delete(artifacts) ⇒ Hash
Delete artifacts in bulk. api.passivetotal.org/api/docs/#api-Artifact-DeleteV2ArtifactBulk
30 31 32 33 34 35 36 |
# File 'lib/passivetotal/clients/artifact.rb', line 30 def bulk_delete(artifacts) params = { artifacts: artifacts, }.compact _delete("/artifact/bulk", params) { |json| json } end |
#bulk_update(artifacts) ⇒ Hash
Perform artifact updates in bulk. api.passivetotal.org/api/docs/#api-Artifact-PostV2ArtifactBulk
46 47 48 49 50 51 52 |
# File 'lib/passivetotal/clients/artifact.rb', line 46 def bulk_update(artifacts) params = { artifacts: artifacts, }.compact _post("/artifact/bulk", params) { |json| json } end |
#create(project:, query:, type: nil, tags: nil) ⇒ Hash
Create an artifact. api.passivetotal.org/api/docs/#api-Artifact-PutV2Artifact
65 66 67 68 69 70 71 72 73 74 |
# File 'lib/passivetotal/clients/artifact.rb', line 65 def create(project:, query:, type: nil, tags: nil) params = { project: project, query: query, type: type, tags: , }.compact _put("/artifact", params) { |json| json } end |
#delete(artifact) ⇒ Hash
Delete an artifact with a UUID. api.passivetotal.org/api/docs/#api-Artifact-DeleteV2Artifact
84 85 86 87 88 89 90 |
# File 'lib/passivetotal/clients/artifact.rb', line 84 def delete(artifact) params = { artifact: artifact, }.compact _delete("/artifact", params) { |json| json } end |
#find(artifact: nil, project: nil, owner: nil, creator: nil, organization: nil, query: nil, type: nil) ⇒ Hash
Read existing artifacts. If no filters are passed, this returns all your personal artifacts created by you or your organization. api.passivetotal.org/api/docs/#api-Artifact-GetV2Artifact
106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/passivetotal/clients/artifact.rb', line 106 def find(artifact: nil, project: nil, owner: nil, creator: nil, organization: nil, query: nil, type: nil) params = { artifact: artifact, project: project, owner: owner, creator: creator, organization: organization, query: query, type: type, }.compact _get("/artifact", params) { |json| json } end |
#update(artifact, monitor: nil, tags: nil) ⇒ Hash
Update artifact, or toggle monitoring status. If you want to change the query or artifact type, simply delete it and create a new one. Use /v2/artifact/tag to add or delete tags without setting everything at once. api.passivetotal.org/api/docs/#api-Artifact-PostV2Artifact
130 131 132 133 134 135 136 137 138 |
# File 'lib/passivetotal/clients/artifact.rb', line 130 def update(artifact, monitor: nil, tags: nil) params = { artifact: artifact, monitor: monitor, tags: , }.compact _post("/artifact", params) { |json| json } end |