<commit_before>module Gestpay
  class Digest
    include Coders

    URL = {
      :test       => 'https://testecomm.sella.it/gestpay/gestpayws/WSCryptDecrypt.asmx?WSDL',
      :production => 'https://ecomms2s.sella.it/gestpay/gestpayws/WSCryptDecrypt.asmx?WSDL'
    }

    def config
      Gestpay.config
    end

    attr_accessor :client

    def initialize(args={})
      # SOAP Client operations:
      # => [:encrypt, :decrypt]
      @client = Savon.client(
        { :wsdl => URL[Gestpay.config.environment] }.merge(args))
    end

    def soap_options(data)
      {
        :message => {
          :shop_login => config.account
        }.merge(data)
      }
    end

    def encrypt(data)
      data[:custom_info] = encode(data[:custom_info]) if data[:custom_info]

      response = @client.call(:encrypt, soap_options(data))
      response_content = response.body[:encrypt_response][:encrypt_result][:gest_pay_crypt_decrypt]
      Result::Digest.new(response_content)
    end

    def decrypt(string)
      response = @client.call(:decrypt, soap_options({'CryptedString' => string}))
      response_content = response.body[:decrypt_response][:decrypt_result][:gest_pay_crypt_decrypt]
      response_content[:custom_info] = decode(response_content[:custom_info]) if response_content[:custom_info]
      Result::Digest.new(response_content)
    end

  end
end<commit_msg>digest: make some methods private<commit_after>module Gestpay
  class Digest
    include Coders

    URL = {
      :test       => 'https://testecomm.sella.it/gestpay/gestpayws/WSCryptDecrypt.asmx?WSDL',
      :production => 'https://ecomms2s.sella.it/gestpay/gestpayws/WSCryptDecrypt.asmx?WSDL'
    }

    def initialize(args={})
      # SOAP Client operations:
      # => [:encrypt, :decrypt]
      @client = Savon.client(
        { :wsdl => URL[Gestpay.config.environment] }.merge(args))
    end

    def encrypt(data)
      data[:custom_info] = encode(data[:custom_info]) if data[:custom_info]

      response = @client.call(:encrypt, soap_options(data))
      response_content = response.body[:encrypt_response][:encrypt_result][:gest_pay_crypt_decrypt]
      Result::Digest.new(response_content)
    end

    def decrypt(string)
      response = @client.call(:decrypt, soap_options({'CryptedString' => string}))
      response_content = response.body[:decrypt_response][:decrypt_result][:gest_pay_crypt_decrypt]
      response_content[:custom_info] = decode(response_content[:custom_info]) if response_content[:custom_info]
      Result::Digest.new(response_content)
    end

    private
    def config
      Gestpay.config
    end

    def soap_options(data)
      {
        :message => {
          :shop_login => config.account
        }.merge(data)
      }
    end

  end
end
{'fraction_non_alphanumeric': 0.12386816370880116, 'fraction_numerical': 0.0007243752263672582, 'mean_word_length': 3.2689335394126737, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 4, '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': '3368364', 'n_tokens_mistral': 917, 'n_tokens_neox': 880, 'n_words': 134}