<commit_before>module NetforumEnterprise
  class MapProducts
    attr_reader :authentication_token, :last_request, :last_response
    attr_accessor :read_timeout, :open_timeout

    def initialize(authentication_token, configuration)
      @authentication_token = authentication_token
      @configuration = configuration
      @read_timeout = nil
      @open_timeout = nil
    end

    def get_event_list
      get_array('web_centralized_shopping_cart_get_event_list', {}, Event)
    end

    def get_full_event_list(months_limit = nil, exclude_prc_columns = true)
      where_clause = if months_limit
                       "evt_start_date > \'#{months_limit.to_i.months.ago.strftime('%Y-%m-01')}\'"
                     else
                       ''
                     end

      column_list = 'evt_key,evt_title,evt_code,evt_start_date'
      column_list << ',prc_key,prc_price' unless exclude_prc_columns

      get_array('get_query', {
        'szObjectName' => 'Events @TOP -1',
        'szColumnList' => column_list,
        'szWhereClause' => where_clause,
        'szOrderBy' => 'evt_title'
      }, Event, { output_subname: 'events_object' })
    end

    def get_full_product_list(months_limit = nil)
      where_clause = if months_limit
                       "prd_start_date > \'#{months_limit.to_i.months.ago.strftime('%Y-%m-01')}\'"
                     else
                       ''
                     end

      get_array('get_query', {
        'szObjectName' => 'Price_Merchandise @TOP -1',
        'szColumnList' => 'prc_price,prc_key,prd_key,prd_name,prd_code,prd_start_date',
        'szWhereClause' => where_clause,
        'szOrderBy' => 'prd_name'
      }, Product, { output_subname: 'price_merchandise_object' })
    end

    def get_invoice_by_invoice_details_key(ivd_key:)
      get_object('get_query', {
        'szObjectName' => 'Invoice',
        'szColumnList' => 'inv_cst_key,ivd_key,ivd_add_date,ivd_prc_key,ivd_prc_prd_key',
        'szWhereClause' => "ivd_key='#{ivd_key}'",
        'szOrderBy' => ''
      }, Invoice, { output_subname: 'invoice_object' })
    end

    def get_invoice_array_by_invoice_details_keys(products_with_ivd_key:)
      get_array('get_query', {
        'szObjectName' => 'Invoice',
        'szColumnList' => 'inv_cst_key,ivd_key,ivd_add_date,ivd_prc_key,ivd_prc_prd_key',
        'szWhereClause' => "ivd_key IN (#{ivd_key_list(products_with_ivd_key)})",
        'szOrderBy' => ''
      }, Invoice, { output_subname: 'invoice_object' })
    end

    def get_invoice_details_by_cst_key(months_limit = nil, cst_key:, ivd_prc_prd_keys:)
      if @configuration.use_execute_method?
        get_array('execute_method', {
          'serviceName' => "#{@configuration.service_name}",
          'methodName' => "#{@configuration.product_sync_method_name}",
          'parameters' => {
            'Parameter' => [
              { 'Name' => 'cst_key', 'Value' => cst_key },
              { 'Name' => 'prd_key_list', 'Value' => ivd_prc_prd_keys.join(',') }
            ]
          },
        }, InvoiceDetail, { output_subname: 'invoice_detail_object' })
      else
        where_clause = "cst_key='#{cst_key}'"
        where_clause << " and evt_start_date > \'#{months_limit.to_i.months.ago.strftime('%Y-%m-01')}\'" if months_limit
        where_clause << " and ivd_prc_prd_key IN (#{key_list(ivd_prc_prd_keys)})" if ivd_prc_prd_keys
        get_array('get_query', {
          'szObjectName' => 'InvoiceDetail',
          'szColumnList' => 'cst_key,ivd_key,ivd_add_date,ivd_prc_key,ivd_prc_prd_key,ivd_price,ivd_delete_flag,ivd_void_date',
          'szWhereClause' => where_clause,
          'szOrderBy' => 'ivd_add_date DESC'
        }, InvoiceDetail, { output_subname: 'invoice_detail_object' })
      end
    end

    def get_product_list
      get_array('web_centralized_shopping_cart_get_product_list', {}, Product)
    end

    def get_purchased_events_by_customer(cst_key:)
      get_array('web_activity_get_purchased_events_by_customer', { 'CustomerKey' => cst_key }, Event)
    end

    def get_purchased_products_by_customer(cst_key:)
      get_array('web_activity_get_purchased_products_by_customer', { 'CustomerKey' => cst_key }, Product)
    end

    def get_registrant_events_by_reg_key(reg_key:)
      get_object('web_activity_get_registrant_events', { 'RegKey' => reg_key }, RegistrantEvent)
    end

    def get_events_registrant_by_event_key(evt_key:, cst_id: nil, cst_key: nil, return_list: nil, search_for_actual_events: false)
      if @configuration.use_execute_method? && cst_id.nil? && return_list.nil?
        get_array('execute_method', {
          'serviceName' => "#{@configuration.service_name}",
          'methodName' => "#{@configuration.event_sync_method_name}",
          'parameters' => {
            'Parameter' => [
              { 'Name' => 'cst_key', 'Value' => cst_key },
              { 'Name' => 'evt_key_list', 'Value' => evt_key }
            ]
          },
        }, Registrant, { output_subname: 'events_registrant_object' })
      else
        where_clause = "reg_evt_key='#{evt_key}'"
        where_clause << if cst_key
                          " and reg_cst_key='#{cst_key}'"
                        elsif cst_id
                          " and cst_id='#{cst_id}'"
                        else
                          ''
                        end
        where_clause << " and reg_cancel_date is null and reg_delete_flag='0'" if search_for_actual_events
        get_array('get_query', {
          'szObjectName' => 'EventsRegistrant',
          'szColumnList' => return_list || "ivd_key,cst_id,Registrant.reg_cancel_date AS Registrant_reg_cancel_date,Registrant.reg_cst_key AS Registrant_reg_cst_key,Registrant.reg_evt_key AS Registrant_reg_evt_key,Registrant.reg_registration_date AS Registrant_reg_registration_date,Registrant.reg_add_date AS Registrant_reg_add_date",
          'szWhereClause' => "#{where_clause}",
          'szOrderBy' => 'Registrant.reg_add_date DESC'
        }, Registrant, { output_subname: 'events_registrant_object' })
      end
    end

    def get_events_by_customer_key(months_limit = nil, cst_key:, registrant_reg_evt_keys:)
      if @configuration.use_execute_method?
        get_array('execute_method', {
          'serviceName' => "#{@configuration.service_name}",
          'methodName' => "#{@configuration.event_sync_method_name}",
          'parameters' => {
            'Parameter' => [
              { 'Name' => 'cst_key', 'Value' => cst_key },
              { 'Name' => 'evt_key_list', 'Value' => registrant_reg_evt_keys.join(',') }
            ]
          },
        }, Registrant, { output_subname: 'events_registrant_object' })
      else
        where_clause = "reg_cst_key='#{cst_key}'"
        where_clause << " and evt_start_date > \'#{months_limit.to_i.months.ago.strftime('%Y-%m-01')}\'" if months_limit
        where_clause << " and Registrant.reg_evt_key IN (#{key_list(registrant_reg_evt_keys)})" if registrant_reg_evt_keys
        get_array('get_query', {
          'szObjectName' => 'EventsRegistrant',
          'szColumnList' => 'ivd_key,Registrant.reg_cancel_date AS Registrant_reg_cancel_date,Registrant.reg_key AS Registrant_reg_key,Registrant.reg_cst_key AS Registrant_reg_cst_key,Registrant.reg_evt_key AS Registrant_reg_evt_key,Registrant.reg_registration_date AS Registrant_reg_registration_date,Registrant.reg_add_date AS Registrant_reg_add_date',
          'szWhereClause' => "#{where_clause}",
          'szOrderBy' => 'Registrant.reg_add_date DESC'
        }, Registrant, { output_subname: 'events_registrant_object' })
      end
    end<commit_msg>Issue #10150 - change date key in requests<commit_after>module NetforumEnterprise
  class MapProducts
    attr_reader :authentication_token, :last_request, :last_response
    attr_accessor :read_timeout, :open_timeout

    def initialize(authentication_token, configuration)
      @authentication_token = authentication_token
      @configuration = configuration
      @read_timeout = nil
      @open_timeout = nil
    end

    def get_event_list
      get_array('web_centralized_shopping_cart_get_event_list', {}, Event)
    end

    def get_full_event_list(months_limit = nil, exclude_prc_columns = true)
      where_clause = if months_limit
                       "evt_start_date > \'#{months_limit.to_i.months.ago.strftime('%Y-%m-01')}\'"
                     else
                       ''
                     end

      column_list = 'evt_key,evt_title,evt_code,evt_start_date'
      column_list << ',prc_key,prc_price' unless exclude_prc_columns

      get_array('get_query', {
        'szObjectName' => 'Events @TOP -1',
        'szColumnList' => column_list,
        'szWhereClause' => where_clause,
        'szOrderBy' => 'evt_title'
      }, Event, { output_subname: 'events_object' })
    end

    def get_full_product_list(months_limit = nil)
      where_clause = if months_limit
                       "prd_start_date > \'#{months_limit.to_i.months.ago.strftime('%Y-%m-01')}\'"
                     else
                       ''
                     end

      get_array('get_query', {
        'szObjectName' => 'Price_Merchandise @TOP -1',
        'szColumnList' => 'prc_price,prc_key,prd_key,prd_name,prd_code,prd_start_date',
        'szWhereClause' => where_clause,
        'szOrderBy' => 'prd_name'
      }, Product, { output_subname: 'price_merchandise_object' })
    end

    def get_invoice_by_invoice_details_key(ivd_key:)
      get_object('get_query', {
        'szObjectName' => 'Invoice',
        'szColumnList' => 'inv_cst_key,ivd_key,ivd_add_date,ivd_prc_key,ivd_prc_prd_key',
        'szWhereClause' => "ivd_key='#{ivd_key}'",
        'szOrderBy' => ''
      }, Invoice, { output_subname: 'invoice_object' })
    end

    def get_invoice_array_by_invoice_details_keys(products_with_ivd_key:)
      get_array('get_query', {
        'szObjectName' => 'Invoice',
        'szColumnList' => 'inv_cst_key,ivd_key,ivd_add_date,ivd_prc_key,ivd_prc_prd_key',
        'szWhereClause' => "ivd_key IN (#{ivd_key_list(products_with_ivd_key)})",
        'szOrderBy' => ''
      }, Invoice, { output_subname: 'invoice_object' })
    end

    def get_invoice_details_by_cst_key(months_limit = nil, cst_key:, ivd_prc_prd_keys:)
      if @configuration.use_execute_method?
        get_array('execute_method', {
          'serviceName' => "#{@configuration.service_name}",
          'methodName' => "#{@configuration.product_sync_method_name}",
          'parameters' => {
            'Parameter' => [
              { 'Name' => 'cst_key', 'Value' => cst_key },
              { 'Name' => 'prd_key_list', 'Value' => ivd_prc_prd_keys.join(',') }
            ]
          },
        }, InvoiceDetail, { output_subname: 'invoice_detail_object' })
      else
        where_clause = "cst_key='#{cst_key}'"
        where_clause << " and ivd_add_date > \'#{months_limit.to_i.months.ago.strftime('%Y-%m-01')}\'" if months_limit
        where_clause << " and ivd_prc_prd_key IN (#{key_list(ivd_prc_prd_keys)})" if ivd_prc_prd_keys
        get_array('get_query', {
          'szObjectName' => 'InvoiceDetail',
          'szColumnList' => 'cst_key,ivd_key,ivd_add_date,ivd_prc_key,ivd_prc_prd_key,ivd_price,ivd_delete_flag,ivd_void_date',
          'szWhereClause' => where_clause,
          'szOrderBy' => 'ivd_add_date DESC'
        }, InvoiceDetail, { output_subname: 'invoice_detail_object' })
      end
    end

    def get_product_list
      get_array('web_centralized_shopping_cart_get_product_list', {}, Product)
    end

    def get_purchased_events_by_customer(cst_key:)
      get_array('web_activity_get_purchased_events_by_customer', { 'CustomerKey' => cst_key }, Event)
    end

    def get_purchased_products_by_customer(cst_key:)
      get_array('web_activity_get_purchased_products_by_customer', { 'CustomerKey' => cst_key }, Product)
    end

    def get_registrant_events_by_reg_key(reg_key:)
      get_object('web_activity_get_registrant_events', { 'RegKey' => reg_key }, RegistrantEvent)
    end

    def get_events_registrant_by_event_key(evt_key:, cst_id: nil, cst_key: nil, return_list: nil, search_for_actual_events: false)
      if @configuration.use_execute_method? && cst_id.nil? && return_list.nil?
        get_array('execute_method', {
          'serviceName' => "#{@configuration.service_name}",
          'methodName' => "#{@configuration.event_sync_method_name}",
          'parameters' => {
            'Parameter' => [
              { 'Name' => 'cst_key', 'Value' => cst_key },
              { 'Name' => 'evt_key_list', 'Value' => evt_key }
            ]
          },
        }, Registrant, { output_subname: 'events_registrant_object' })
      else
        where_clause = "reg_evt_key='#{evt_key}'"
        where_clause << if cst_key
                          " and reg_cst_key='#{cst_key}'"
                        elsif cst_id
                          " and cst_id='#{cst_id}'"
                        else
                          ''
                        end
        where_clause << " and reg_cancel_date is null and reg_delete_flag='0'" if search_for_actual_events
        get_array('get_query', {
          'szObjectName' => 'EventsRegistrant',
          'szColumnList' => return_list || "ivd_key,cst_id,Registrant.reg_cancel_date AS Registrant_reg_cancel_date,Registrant.reg_cst_key AS Registrant_reg_cst_key,Registrant.reg_evt_key AS Registrant_reg_evt_key,Registrant.reg_registration_date AS Registrant_reg_registration_date,Registrant.reg_add_date AS Registrant_reg_add_date",
          'szWhereClause' => "#{where_clause}",
          'szOrderBy' => 'Registrant.reg_add_date DESC'
        }, Registrant, { output_subname: 'events_registrant_object' })
      end
    end

    def get_events_by_customer_key(months_limit = nil, cst_key:, registrant_reg_evt_keys:)
      if @configuration.use_execute_method?
        get_array('execute_method', {
          'serviceName' => "#{@configuration.service_name}",
          'methodName' => "#{@configuration.event_sync_method_name}",
          'parameters' => {
            'Parameter' => [
              { 'Name' => 'cst_key', 'Value' => cst_key },
              { 'Name' => 'evt_key_list', 'Value' => registrant_reg_evt_keys.join(',') }
            ]
          },
        }, Registrant, { output_subname: 'events_registrant_object' })
      else
        where_clause = "reg_cst_key='#{cst_key}'"
        where_clause << " and reg_add_date > \'#{months_limit.to_i.months.ago.strftime('%Y-%m-01')}\'" if months_limit
        where_clause << " and Registrant.reg_evt_key IN (#{key_list(registrant_reg_evt_keys)})" if registrant_reg_evt_keys
        get_array('get_query', {
          'szObjectName' => 'EventsRegistrant',
          'szColumnList' => 'ivd_key,Registrant.reg_cancel_date AS Registrant_reg_cancel_date,Registrant.reg_key AS Registrant_reg_key,Registrant.reg_cst_key AS Registrant_reg_cst_key,Registrant.reg_evt_key AS Registrant_reg_evt_key,Registrant.reg_registration_date AS Registrant_reg_registration_date,Registrant.reg_add_date AS Registrant_reg_add_date',
          'szWhereClause' => "#{where_clause}",
          'szOrderBy' => 'Registrant.reg_add_date DESC'
        }, Registrant, { output_subname: 'events_registrant_object' })
      end
    end
{'fraction_non_alphanumeric': 0.12062536795970433, 'fraction_numerical': 0.0017662065807548897, 'mean_word_length': 3.007339449541284, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 121, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2219748', 'n_tokens_mistral': 5357, 'n_tokens_neox': 5288, 'n_words': 699}