Class: Api::V1::QuickEstimatorsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/api/v1/quick_estimators_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#catalog_for_request, #error!, #locale_for_request, #logger, #render_bad_request_response, #render_internal_server_error, #render_not_found_response, #render_result, #render_unprocessable_entity_response, #set_locale, #store_for_request, #underscore_params

Instance Method Details

#displayObject



7
8
9
# File 'app/controllers/api/v1/quick_estimators_controller.rb', line 7

def display
  response.headers['X-Frame-Options'] = '*'
end

#get_display_parametersObject



21
22
23
24
25
26
27
28
29
30
31
# File 'app/controllers/api/v1/quick_estimators_controller.rb', line 21

def get_display_parameters
  qe_parameters = { starting_application: (@quick_estimator.starting_application || "FW"),
                    catalog_id: @quick_estimator.catalog_id || 1,
                    store: @quick_estimator.store_name || "USA",
                    title: (@quick_estimator.title.try(:squish) || "WarmlyYours Calculator"),
                    hide_pricing: (@quick_estimator.pricing_formula.blank?),
                    main_ui_color: @quick_estimator.main_ui_color,
                    logo_url: @quick_estimator.logo_url,
                    domain_name: @quick_estimator.domain_name }
  render xml: qe_parameters
end

Generates a javascript dynamically to popup the estimator
https://api.warmlyyours.me:3000/v1/quick_estimators/e7e85aef0eff29dc/link_popup.js



13
14
15
16
17
# File 'app/controllers/api/v1/quick_estimators_controller.rb', line 13

def link_popup
  @api_key = @quick_estimator.api_key
  @iq_base_url = "https://#{API_HOSTNAME}"
  @base_features = "location=no,toolbar=no,menubar=no,resizeable=yes,scrollbars=yes,height=#{QuickEstimator::QE_HEIGHT[@quick_estimator.swf_asset]+30},width=#{QuickEstimator::QE_WIDTH[@quick_estimator.swf_asset]+40}"
end

#log_print_estimateObject



35
36
37
38
# File 'app/controllers/api/v1/quick_estimators_controller.rb', line 35

def log_print_estimate
  @quick_estimator.log_data("log_print_estimate", params)
  render xml: { result: :ok }
end