Class: Lcms::Engine::SketchCompiler
- Inherits:
-
Object
- Object
- Lcms::Engine::SketchCompiler
- Defined in:
- app/services/lcms/engine/sketch_compiler.rb
Instance Method Summary collapse
-
#compile(core_url, foundational_url) ⇒ Object
Returns HTTParty::Response object.
-
#initialize(user_id, user_ip, version) ⇒ SketchCompiler
constructor
A new instance of SketchCompiler.
Constructor Details
#initialize(user_id, user_ip, version) ⇒ SketchCompiler
Returns a new instance of SketchCompiler.
8 9 10 11 12 |
# File 'app/services/lcms/engine/sketch_compiler.rb', line 8 def initialize(user_id, user_ip, version) @user_id = user_id @user_ip = user_ip @version = version end |
Instance Method Details
#compile(core_url, foundational_url) ⇒ Object
Returns HTTParty::Response object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/services/lcms/engine/sketch_compiler.rb', line 17 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 |