<commit_before>require 'httparty'
require 'active_support/core_ext/hash'

require 'lazada/api/product'
require 'lazada/api/category'
require 'lazada/api/feed'

OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE

module Lazada
  class Client
    include HTTParty
    include Lazada::API::Product
    include Lazada::API::Category
    include Lazada::API::Feed

    base_uri 'sellercenter-api.lazada.com.my'

    def initialize(api_key)
      @api_key = '3cbada57d0d3d41d5823b892efd53b60e8425b27'
    end

    protected

    def request_url(action, options = {})
      current_time_zone = 'Kuala Lumpur'
      timestamp = Time.now.in_time_zone(current_time_zone).iso8601

      parameters = {
        'Action' => action,
        'Filter' => 'all',
        'Format' => 'JSON',
        'Timestamp' => timestamp,
        'UserID' => '<EMAIL>',
        'Version' => '1.0'
      }
      parameters = parameters.merge(options) if options.present?

      parameters = Hash[parameters.sort{ |a, b| a[0] <=> b[0] }]<commit_msg>user_id parameter<commit_after>require 'httparty'
require 'active_support/core_ext/hash'

require 'lazada/api/product'
require 'lazada/api/category'
require 'lazada/api/feed'

## Development mode only
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE

module Lazada
  class Client
    include HTTParty
    include Lazada::API::Product
    include Lazada::API::Category
    include Lazada::API::Feed

    base_uri 'sellercenter-api.lazada.com.my'

    def initialize(api_key, user_id)
      @api_key = api_key
      @user_id = user_id
    end

    protected

    def request_url(action, options = {})
      current_time_zone = 'Kuala Lumpur'
      timestamp = Time.now.in_time_zone(current_time_zone).iso8601

      parameters = {
        'Action' => action,
        'Filter' => 'all',
        'Format' => 'JSON',
        'Timestamp' => timestamp,
        'UserID' => @user_id,
        'Version' => '1.0'
      }
      parameters = parameters.merge(options) if options.present?

      parameters = Hash[parameters.sort{ |a, b| a[0] <=> b[0] }]
{'fraction_non_alphanumeric': 0.1297820823244552, 'fraction_numerical': 0.01937046004842615, 'mean_word_length': 3.216326530612245, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1960425', 'n_tokens_mistral': 734, 'n_tokens_neox': 709, 'n_words': 133}