Sha256: 6110896f2cecee1c4f3e143b06a0c57e360ea02445b1c3e31edb07c04ddbd7ca

Contents?: true

Size: 669 Bytes

Versions: 7

Compression:

Stored size: 669 Bytes

Contents

module FullContact
  # Defines HTTP request methods
  module Request
    # Perform an HTTP GET request
    def get(path, options={}, raw=false, faraday_options={})
      request(:get, path, options, raw, faraday_options)
    end

    private

    # Perform an HTTP request
    def request(method, path, options, raw=false, faraday_options={})
      options[:apiKey] = FullContact.options[:api_key]

      response = connection(raw, faraday_options).send(method) do |request|
        request.url(formatted_path(path), options)
      end

      raw ? response : response.body
    end

    def formatted_path(path)
      [path, format].compact.join('.')
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fullcontact-0.14.0 lib/fullcontact/request.rb
fullcontact-0.13.0 lib/fullcontact/request.rb
fullcontact-0.12.0 lib/fullcontact/request.rb
fullcontact-0.11.0 lib/fullcontact/request.rb
fullcontact-0.10.0 lib/fullcontact/request.rb
fullcontact-0.9.0 lib/fullcontact/request.rb
fullcontact-0.8.2 lib/fullcontact/request.rb