Sha256: 769fb6f2f9d4b550bb2251eea220be6f41173735725bcaad79794841883ae9c1

Contents?: true

Size: 444 Bytes

Versions: 5

Compression:

Stored size: 444 Bytes

Contents

module Scrivito
  class CmsRestApi
    module BlobUploader
      class << self
        def upload_file(file)
          upload_permission = CmsRestApi.get('blobs/upload_permission')

          fields = upload_permission['fields'].to_a + [[:file, file]]

          # Net/HTTP does not support multipart forms
          RestClient.post(upload_permission['url'], fields)

          upload_permission['blob']
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
scrivito_sdk-0.16.0 lib/scrivito/cms_rest_api/blob_uploader.rb
scrivito_sdk-0.15.0 lib/scrivito/cms_rest_api/blob_uploader.rb
scrivito_sdk-0.14.0 lib/scrivito/cms_rest_api/blob_uploader.rb
scrivito_sdk-0.13.0 lib/scrivito/cms_rest_api/blob_uploader.rb
scrivito_sdk-0.12.0 lib/scrivito/cms_rest_api/blob_uploader.rb