lib/promoted/ruby/client.rb
def prepare_for_logging args, headers={}
          args = Promoted::Ruby::Client::Util.translate_hash(args)

          if !@enabled
            return {
              insertion: args[:full_insertion]
            }
          end

          log_request_builder = RequestBuilder.new

          # Note: This method expects as JSON (string keys) but internally, RequestBuilder
          # transforms and works with symbol keys.
          log_request_builder.set_request_params(args)
          shadow_traffic_err = false
          if @perform_checks
            perform_common_checks! args

            if @shadow_traffic_delivery_percent > 0 && args[:insertion_page_type] != Promoted::Ruby::Client::INSERTION_PAGING_TYPE['UNPAGED'] then
              shadow_traffic_err = true
              @logger.error(ShadowTrafficInsertionPageType.new) if @logger
            end
          end
          
          log_request_builder.ensure_client_timestamp

          if !shadow_traffic_err && should_send_as_shadow_traffic?
            deliver_shadow_traffic args, headers
          end

          log_request_builder.log_request_params(
            include_delivery_log: true, 
            exec_server: Promoted::Ruby::Client::EXECUTION_SERVER['SDK'])
        end
##
# Generate a log request for a subsequent call to send_log_request
# or for logging via alternative means.
Generate a log request for a subsequent call to send_log_request
or for logging via alternative means.
Generate a log request for a subsequent call to send_log_request or for logging via alternative means .
def prepare_for_logging args, headers={}
          args = Promoted::Ruby::Client::Util.translate_hash(args)
          if !@enabled
            return {
              insertion: args[:full_insertion]
            }
          end
          log_request_builder = RequestBuilder.new
          log_request_builder.set_request_params(args)
          shadow_traffic_err = false
          if @perform_checks
            perform_common_checks! args
            if @shadow_traffic_delivery_percent > 0 && args[:insertion_page_type] != Promoted::Ruby::Client::INSERTION_PAGING_TYPE['UNPAGED'] then
              shadow_traffic_err = true
              @logger.error(ShadowTrafficInsertionPageType.new) if @logger
            end
          end
          log_request_builder.ensure_client_timestamp
          if !shadow_traffic_err && should_send_as_shadow_traffic?
            deliver_shadow_traffic args, headers
          end
          log_request_builder.log_request_params(
            include_delivery_log: true, 
            exec_server: Promoted::Ruby::Client::EXECUTION_SERVER['SDK'])
        end
def prepare_for_logging args , headers = { } args = Promoted :: Ruby :: Client :: Util . translate_hash ( args ) if ! @enabled return { insertion : args [ :full_insertion ] } end log_request_builder = RequestBuilder . new log_request_builder . set_request_params ( args ) shadow_traffic_err = false if @perform_checks perform_common_checks! args if @shadow_traffic_delivery_percent > 0 && args [ :insertion_page_type ] != Promoted :: Ruby :: Client :: INSERTION_PAGING_TYPE [ 'UNPAGED' ] then shadow_traffic_err = true @logger . error ( ShadowTrafficInsertionPageType . new ) if @logger end end log_request_builder . ensure_client_timestamp if ! shadow_traffic_err && should_send_as_shadow_traffic? deliver_shadow_traffic args , headers end log_request_builder . log_request_params ( include_delivery_log : true , exec_server : Promoted :: Ruby :: Client :: EXECUTION_SERVER [ 'SDK' ] ) end
Generate a log request for a subsequent call to send_log_request
or for logging via alternative means.
Generate a log request for a subsequent call to send_log_request or for logging via alternative means .
# Note: This method expects as JSON (string keys) but internally, RequestBuilder # transforms and works with symbol keys.
args
headers