Sha256: ad8ca67e51b4740466e0b93fc7f1a4e63d686964abcd22c84298448503af0ef4

Contents?: true

Size: 473 Bytes

Versions: 1

Compression:

Stored size: 473 Bytes

Contents

require "clearbit_api/version"
require "httparty"

module ClearbitApi
  class Company
    def self.search(company)
      # get call on REST API
      base_url = "https://autocomplete.clearbit.com/v1/companies/suggest?query="
      response = HTTParty.get(base_url + company)

      # parse data
      begin
        data = JSON.parse(response.body, {symbolize_names: true})
      rescue JSON::ParserError
        data = {error: "Clearbit Error"}
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
clearbit_api-0.1.0 lib/clearbit_api.rb