Sha256: 99fbac8519d965e055196a099f9cad68817cea427d9c4d9422473c6ba8fd0ce4

Contents?: true

Size: 846 Bytes

Versions: 16

Compression:

Stored size: 846 Bytes

Contents

# frozen_string_literal: true

require 'base64'

module Lcms
  module Engine
    class SketchCompiler
      def initialize(user_id, user_ip, version)
        @user_id = user_id
        @user_ip = user_ip
        @version = version
      end

      #
      # Returns HTTParty::Response object
      #
      def compile(core_url, foundational_url)
        api_url = ENV.fetch('UB_COMPONENTS_API_URL')
        url = [api_url, @version, 'compile'].join('/')
        post_params = {
          body: {
            uid: Base64.encode64("#{@user_id}@#{@user_ip}"),
            url: core_url,
            foundational_url: foundational_url
          },
          headers: { 'Authorization' => %(Token token="#{ENV.fetch 'UB_COMPONENTS_API_TOKEN'}") },
          timeout: 5 * 60
        }
        HTTParty.post url, post_params
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
lcms-engine-0.5.5 app/services/lcms/engine/sketch_compiler.rb
lcms-engine-0.5.4 app/services/lcms/engine/sketch_compiler.rb
lcms-engine-0.5.3 app/services/lcms/engine/sketch_compiler.rb
lcms-engine-0.5.2 app/services/lcms/engine/sketch_compiler.rb
lcms-engine-0.5.1 app/services/lcms/engine/sketch_compiler.rb
lcms-engine-0.5.0 app/services/lcms/engine/sketch_compiler.rb
lcms-engine-0.4.2 app/services/lcms/engine/sketch_compiler.rb
lcms-engine-0.4.1 app/services/lcms/engine/sketch_compiler.rb
lcms-engine-0.4.0 app/services/lcms/engine/sketch_compiler.rb
lcms-engine-0.3.1 app/services/lcms/engine/sketch_compiler.rb
lcms-engine-0.1.4 app/services/lcms/engine/sketch_compiler.rb
lcms-engine-0.3.0 app/services/lcms/engine/sketch_compiler.rb
lcms-engine-0.1.3 app/services/lcms/engine/sketch_compiler.rb
lcms-engine-0.2.0 app/services/lcms/engine/sketch_compiler.rb
lcms-engine-0.1.2 app/services/lcms/engine/sketch_compiler.rb
lcms-engine-0.1.0 app/services/lcms/engine/sketch_compiler.rb