Class: DataSift::Task
- Inherits:
-
ApiResource
- Object
- ApiResource
- DataSift::Task
- Defined in:
- lib/tasks.rb
Overview
Class for accessing DataSift’s Tasks API
Constant Summary
Constants inherited from ApiResource
ApiResource::TLSv1, ApiResource::TLSv1_2
Constants included from DataSift
APPLICATION_JSON, DELETE, DETECT_DEAD_SOCKETS, GET, HEAD, IS_WINDOWS, KNOWN_SOCKETS, SOCKET_DETECTOR_TIMEOUT, VERSION, X_ANALYSIS_TASKS_QUEUED, X_ANALYSIS_TASKS_QUEUE_LIMIT, X_INSIGHT_TASKS_QUEUED, X_INSIGHT_TASKS_QUEUE_LIMIT, X_RATELIMIT_COST, X_RATELIMIT_LIMIT, X_RATELIMIT_REMAINING, X_TASKS_QUEUED, X_TASKS_QUEUE_LIMIT
Instance Method Summary collapse
-
#create(service:, type:, subscription_id:, name:, parameters:) ⇒ Object
Creates a Task; this call requires use of an identity API key.
-
#get(service:, type: 'analysis', id:) ⇒ Object
Gets a single task by ID; this call requires use of the identity API key associated with the Task requested.
-
#list(service:, type: 'analysis', **opts) ⇒ Object
Gets a list of all current Tasks on the service.
Methods inherited from ApiResource
Methods included from DataSift
Constructor Details
This class inherits a constructor from DataSift::ApiResource
Instance Method Details
#create(service:, type:, subscription_id:, name:, parameters:) ⇒ Object
Creates a Task; this call requires use of an identity API key
13 14 15 16 17 18 19 20 |
# File 'lib/tasks.rb', line 13 def create(service:, type:, subscription_id:, name:, parameters:) DataSift.request(:POST, "pylon/#{service}/task", @config, { type: type, subscription_id: subscription_id, name: name, parameters: parameters }) end |
#get(service:, type: 'analysis', id:) ⇒ Object
Gets a single task by ID; this call requires use of the identity API key associated with the
Task requested
29 30 31 |
# File 'lib/tasks.rb', line 29 def get(service:, type: 'analysis', id:) DataSift.request(:GET, "pylon/#{service}/task/#{type}/#{id}", @config) end |
#list(service:, type: 'analysis', **opts) ⇒ Object
Gets a list of all current Tasks on the service. This call may be accessed using either a
main or identity-level API key.
42 43 44 45 46 47 48 49 |
# File 'lib/tasks.rb', line 42 def list(service:, type: 'analysis', **opts) params = {} params[:per_page] = opts[:per_page] if opts.key?(:per_page) params[:page] = opts[:page] if opts.key?(:page) params[:status] = opts[:status] if opts.key?(:status) DataSift.request(:GET, "pylon/#{service}/task/#{type}", @config, params) end |