<commit_before>
require 'rest-core'

module RestCore
  module YahooBuy
    autoload :Signature, 'rest-core/client/yahoo_buy/signature'
    Client = Builder.client(:api_key) do
      use Timeout       , 10

      use Signature, nil

      use DefaultSite   , 'http://tw.partner.buy.yahoo.com/api/v1/'
      use DefaultHeaders, {'Accept' => 'application/xml'}

      use CommonLogger  , nil
      use Cache         , nil, 600 do
        use ErrorHandler, lambda{ |env|
          RuntimeError.new(env[RESPONSE_BODY]['message'])}
        use ErrorDetectorHttp
      end
    end

    def self.new *args, &block
      Client.new *args, &block
    end
  end
end<commit_msg>Add default query (api key and timestamp) to yahoo buy<commit_after>
require 'rest-core'

module RestCore
  module YahooBuy
    autoload :Signature, 'rest-core/client/yahoo_buy/signature'
    Client = Builder.client(:api_key) do
      use Timeout       , 10

      use DefaultQuery
      use Signature, nil

      use DefaultSite   , 'http://tw.partner.buy.yahoo.com/api/v1/'
      use DefaultHeaders, {'Accept' => 'application/xml'}

      use CommonLogger  , nil
      use Cache         , nil, 600 do
        use ErrorHandler, lambda{ |env|
          RuntimeError.new(env[RESPONSE_BODY]['message'])}
        use ErrorDetectorHttp
      end
    end

    class Client
      def default_query
        {:pkey => api_key, :ts => Time.now.to_i}
      end
    end

    def self.new *args, &block
      Client.new *args, &block
    end
  end
end
{'fraction_non_alphanumeric': 0.10033222591362126, 'fraction_numerical': 0.007973421926910298, 'mean_word_length': 2.3098901098901097, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '648590', 'n_tokens_mistral': 501, 'n_tokens_neox': 465, 'n_words': 126}