Sha256: 705d7e8956b6d93b4f830300acba6d187876f6fd684d4f81a28e36d0c6976b91

Contents?: true

Size: 715 Bytes

Versions: 18

Compression:

Stored size: 715 Bytes

Contents

module Script
  module Layers
    module Infrastructure
      class ScriptUploader
        def initialize(script_service)
          @script_service = script_service
        end

        def upload(script_content)
          @script_service.generate_module_upload_url.tap do |url|
            url = URI(url)

            https = Net::HTTP.new(url.host, url.port)
            https.use_ssl = true

            request = Net::HTTP::Put.new(url)
            request["Content-Type"] = "application/wasm"
            request.body = script_content

            response = https.request(request)
            raise Errors::ScriptUploadError unless response.code == "200"
          end
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
shopify-cli-2.10.1 lib/project_types/script/layers/infrastructure/script_uploader.rb
shopify-cli-2.10.0 lib/project_types/script/layers/infrastructure/script_uploader.rb
shopify-cli-2.9.0 lib/project_types/script/layers/infrastructure/script_uploader.rb
shopify-cli-2.8.0 lib/project_types/script/layers/infrastructure/script_uploader.rb
shopify-cli-2.7.4 lib/project_types/script/layers/infrastructure/script_uploader.rb
shopify-cli-2.7.3 lib/project_types/script/layers/infrastructure/script_uploader.rb
shopify-cli-2.7.2 lib/project_types/script/layers/infrastructure/script_uploader.rb
shopify-cli-2.7.1 lib/project_types/script/layers/infrastructure/script_uploader.rb
shopify-cli-2.7.0 lib/project_types/script/layers/infrastructure/script_uploader.rb
shopify-cli-2.6.6 lib/project_types/script/layers/infrastructure/script_uploader.rb
shopify-cli-2.6.5 lib/project_types/script/layers/infrastructure/script_uploader.rb
shopify-cli-2.6.4 lib/project_types/script/layers/infrastructure/script_uploader.rb
shopify-cli-2.6.3 lib/project_types/script/layers/infrastructure/script_uploader.rb
shopify-cli-2.6.2 lib/project_types/script/layers/infrastructure/script_uploader.rb
shopify-cli-2.6.1 lib/project_types/script/layers/infrastructure/script_uploader.rb
shopify-cli-2.6.0 lib/project_types/script/layers/infrastructure/script_uploader.rb
shopify-cli-2.5.0 lib/project_types/script/layers/infrastructure/script_uploader.rb
shopify-cli-2.4.0 lib/project_types/script/layers/infrastructure/script_uploader.rb