Class: Riveter::Resources::Extractions

Inherits:
Object
  • Object
show all
Defined in:
lib/riveter/resources.rb

Overview

Reusable site scrape/extract recipes and their runs.

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Extractions

Returns a new instance of Extractions.



119
120
121
# File 'lib/riveter/resources.rb', line 119

def initialize(client)
  @client = client
end

Instance Method Details

#create(**params) ⇒ Object

Create an extraction and start its agent discovery. (operationId: createExtraction)



124
125
126
# File 'lib/riveter/resources.rb', line 124

def create(**params)
  Extraction.new(@client.request(:post, "/extractions", body: params))
end

#get(extraction_id) ⇒ Object

The extraction's status and definition. (operationId: getExtraction)



129
130
131
# File 'lib/riveter/resources.rb', line 129

def get(extraction_id)
  Extraction.new(@client.request(:get, "/extractions/#{extraction_id}"))
end

#run(extraction_id, **params) ⇒ Object

Execute a ready extraction. (operationId: runExtraction)



134
135
136
# File 'lib/riveter/resources.rb', line 134

def run(extraction_id, **params)
  Run.new(@client.request(:post, "/extractions/#{extraction_id}/runs", body: params))
end