<commit_before>require 'json'

module Yelp
  class Client
    module Search
      PATH = '/v2/search'

      BOUNDING_BOX = [:sw_latitude, :sw_longitude, :ne_latitude, :ne_longitude]
      COORDINATES  = [:latitude, :longitude]

      # Take a search_request and return the formatted/structured
      # response from the API
      def search(location, params = {}, locale = {})
        params.merge!(locale)
        params.merge!({location: location})

        DeepStruct.new(JSON.parse(search_request(params).body))
      end

      # Make a request against the search endpoint from the API
      # and return the raw response
      def search_request(params)
        @connection.get PATH, params
      end

      def search_by_bounding_box(sw_latitude, sw_longitude, ne_latitude, ne_longitude, params = {}, locale = {})
        options = { bounds: "#{sw_latitude},#{sw_longitude}|#{ne_latitude},#{ne_longitude}" }
        options.merge!(params)
        options.merge!(locale)

        DeepStruct.new(JSON.parse(search_request(options).body))
      end
    end
  end
end<commit_msg>Reorganize search methods and comment the bounding box search<commit_after>require 'json'

module Yelp
  class Client
    module Search
      PATH = '/v2/search'

      BOUNDING_BOX = [:sw_latitude, :sw_longitude, :ne_latitude, :ne_longitude]
      COORDINATES  = [:latitude, :longitude]

      # Take a search_request and return the formatted/structured
      # response from the API
      def search(location, params = {}, locale = {})
        params.merge!(locale)
        params.merge!({location: location})

        DeepStruct.new(JSON.parse(search_request(params).body))
      end

      # Search by a bounding box: specify a south west lat/long and a ne lat/long
      # along with regular parameters to make a request to the search endpoint
      # More info at: http://www.yelp.com/developers/documentation/v2/search_api#searchGBB
      def search_by_bounding_box(sw_latitude, sw_longitude, ne_latitude, ne_longitude, params = {}, locale = {})
        options = { bounds: "#{sw_latitude},#{sw_longitude}|#{ne_latitude},#{ne_longitude}" }
        options.merge!(params)
        options.merge!(locale)

        DeepStruct.new(JSON.parse(search_request(options).body))
      end

      # Make a request against the search endpoint from the API
      # and return the raw response
      def search_request(params)
        @connection.get PATH, params
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.10178426601784266, 'fraction_numerical': 0.0012165450121654502, 'mean_word_length': 3.057565789473684, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, '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': '3068967', 'n_tokens_mistral': 745, 'n_tokens_neox': 726, 'n_words': 189}