<commit_before>class MapQuest
  module Services
    class Geocoding < Core

      API_LOCATION = :geocoding

      class TooManyLocations < StandardError; end

      # Allows you to search for a single location and returns a response object of the found locations
      #
      #   Example: .decode :location => "London, UK"
      #
      # ==Required parameters
      # * :location [String] The location for which you wish to get data
      # ==Optional parameters
      # * :maxResults [Integer] The number of results to limit the response to. Defaults to -1 (-1 indicates no limit)
      # * :thumbMaps [Boolean] Return a URL to a static map thumbnail image for a location. Defaults to true
      def decode(params = {})
        raise Error unless params.has_key? :location
        remove_unavailable_params! params
        api_method = {
            :location => API_LOCATION,
            :version => '1',
            :call => 'address'
        }
        mapquest.request api_method, params, Response
      end

      # Allows you to search for a location using lat/lng values and returns a response object of the found locations
      #
      #   Example: .reverse :location => ['40.0755','-76.329999']
      #
      # ==Required parameters
      # * :location [Array] The lat, and lng to search for
      # ==Optional parameters
      # * :maxResults [Integer] The number of results to limit the response to. Defaults to -1 (-1 indicates no limit)
      # * :thumbMaps [Boolean] Return a URL to a static map thumbnail image for a location. Defaults to true
      def reverse(params = {})
        raise Error unless params.has_key?(:location) && params[:location].kind_of?(Array)
        params[:location] = params[:locations].join(',')
        remove_unavailable_params! params
        api_method = {
            :location => API_LOCATION,
            :version => '1',
            :call => 'reverse'
        }
        mapquest.request api_method, params, Response
      end

      private
      def remove_unavailable_params!(params)
        params.keys.each { |k| params.delete(k) unless [:location,:maxResults,:thumbMaps].include? k }
      end

      class Response < MapQuest::Response

        def initialize(response_string, params = {})
          super response_string, params
          valid_request?
        end<commit_msg>Fix geocoding reverse typo<commit_after>class MapQuest
  module Services
    class Geocoding < Core

      API_LOCATION = :geocoding

      class TooManyLocations < StandardError; end

      # Allows you to search for a single location and returns a response object of the found locations
      #
      #   Example: .decode :location => "London, UK"
      #
      # ==Required parameters
      # * :location [String] The location for which you wish to get data
      # ==Optional parameters
      # * :maxResults [Integer] The number of results to limit the response to. Defaults to -1 (-1 indicates no limit)
      # * :thumbMaps [Boolean] Return a URL to a static map thumbnail image for a location. Defaults to true
      def decode(params = {})
        raise Error unless params.has_key? :location
        remove_unavailable_params! params
        api_method = {
            :location => API_LOCATION,
            :version => '1',
            :call => 'address'
        }
        mapquest.request api_method, params, Response
      end

      # Allows you to search for a location using lat/lng values and returns a response object of the found locations
      #
      #   Example: .reverse :location => ['40.0755','-76.329999']
      #
      # ==Required parameters
      # * :location [Array] The lat, and lng to search for
      # ==Optional parameters
      # * :maxResults [Integer] The number of results to limit the response to. Defaults to -1 (-1 indicates no limit)
      # * :thumbMaps [Boolean] Return a URL to a static map thumbnail image for a location. Defaults to true
      def reverse(params = {})
        raise Error unless params.has_key?(:location) && params[:location].kind_of?(Array)
        params[:location] = params[:location].join(',')
        remove_unavailable_params! params
        api_method = {
            :location => API_LOCATION,
            :version => '1',
            :call => 'reverse'
        }
        mapquest.request api_method, params, Response
      end

      private
      def remove_unavailable_params!(params)
        params.keys.each { |k| params.delete(k) unless [:location,:maxResults,:thumbMaps].include? k }
      end

      class Response < MapQuest::Response

        def initialize(response_string, params = {})
          super response_string, params
          valid_request?
        end
{'fraction_non_alphanumeric': 0.09001706484641639, 'fraction_numerical': 0.008532423208191127, 'mean_word_length': 2.412663755458515, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 19, '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': '7300738', 'n_tokens_mistral': 1254, 'n_tokens_neox': 1230, 'n_words': 444}