Sha256: 097cc5c9b828569e25a2d2b45eb3de4e874b19809994aa71487a48d6fb57ebfe
Contents?: true
Size: 1.06 KB
Versions: 4
Compression:
Stored size: 1.06 KB
Contents
# Copyright 2024 DeepL SE (https://www.deepl.com) # Use of this source code is governed by an MIT # license that can be found in the LICENSE file. # frozen_string_literal: true module DeepL module Requests module Document class Download < Base attr_reader :document_id, :document_key def initialize(api, document_id, document_key, output_file) super(api, {}) @document_id = document_id @document_key = document_key @output_file = output_file end def request payload = { document_key: document_key } extract_file(*execute_request_with_retries(post_request(payload))) end def details "HTTP Headers: #{headers}\nPayload #{{ document_key: document_key }}" end def to_s "POST #{uri.request_uri}" end private def extract_file(_request, response) File.write(@output_file, response.body) end def path "document/#{document_id}/result" end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems