Sha256: 1ee24bc1de673668118d0712e46ad5729bfc2782674b0bccdd2d42f94a36d37f
Contents?: true
Size: 984 Bytes
Versions: 1
Compression:
Stored size: 984 Bytes
Contents
# frozen_string_literal: true require 'faraday' require 'faraday_middleware' module Crunchbase # Utilities module Utilities # API Request module Request module_function def entity(uri, *args) response = Faraday.new(url: BASE_URI, headers: headers) do |faraday| faraday.adapter Faraday.default_adapter faraday.response :json end.get(uri, *args) return response.body if response.status == 200 raise Error, response.reason_phrase end def search(uri, args) response = Faraday.new(url: BASE_URI, headers: headers) do |faraday| faraday.adapter Faraday.default_adapter faraday.response :json end.post(uri, args) return response.body if response.status == 200 raise Error, response.reason_phrase end private def headers { 'X-cb-user-key' => Crunchbase.config.user_key } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
crunchbase4-0.1.0 | lib/crunchbase/utilities/request.rb |