Sha256: 188c2392a8d8ceed6c324eb051846daf5685363b753eb04d6cc726c73bf73f74

Contents?: true

Size: 987 Bytes

Versions: 4

Compression:

Stored size: 987 Bytes

Contents

# frozen_string_literal: true

module Peddler
  module Helpers
    module Feeds20210630
      # Uploads feed_content to a signed upload_url previously provided by
      # create_feed_document. The upload_url is signed, the Host and content-type
      # headers must match the signing.
      # @param upload_url [String] The signed url from the `create_feed_document` response.
      # @param feed_content [String] The body of the content to upload.
      # @param content_type [String] The content type of the upload,
      # this must match the content-type requested in `create_feed_document`
      # @return [HTTP::Response] The API response
      def upload_feed_document(upload_url, feed_content, content_type)
        response = HTTP.headers("content-type" => content_type).put(upload_url, body: feed_content)

        if response.status.client_error?
          error = Error.build(response)
          raise error if error
        end

        response
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
peddler-4.1.1 lib/peddler/helpers/feeds_2021_06_30.rb
peddler-4.1.0 lib/peddler/helpers/feeds_2021_06_30.rb
peddler-4.0.1 lib/peddler/helpers/feeds_2021_06_30.rb
peddler-4.0.0 lib/peddler/helpers/feeds_2021_06_30.rb