Class: BulkImports::Common::Extractors::RestExtractor
- Inherits:
-
Object
- Object
- BulkImports::Common::Extractors::RestExtractor
- Defined in:
- lib/bulk_imports/common/extractors/rest_extractor.rb
Instance Method Summary collapse
- #extract(context) ⇒ Object
-
#initialize(options = {}) ⇒ RestExtractor
constructor
A new instance of RestExtractor.
Constructor Details
#initialize(options = {}) ⇒ RestExtractor
Returns a new instance of RestExtractor.
7 8 9 |
# File 'lib/bulk_imports/common/extractors/rest_extractor.rb', line 7 def initialize( = {}) @query = [:query] end |
Instance Method Details
#extract(context) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/bulk_imports/common/extractors/rest_extractor.rb', line 11 def extract(context) client = http_client(context.configuration) params = query.to_h(context) response = client.get(params[:resource], params[:query]) BulkImports::Pipeline::ExtractedData.new( data: response.parsed_response, page_info: page_info(response.headers) ) end |