Sha256: 766ea789395278a8a699decddeb901d5c9cc46e9936cc8592fd6c4deb14f58fd

Contents?: true

Size: 653 Bytes

Versions: 3

Compression:

Stored size: 653 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

3 entries across 3 versions & 1 rubygems

Version Path
fullcontact-0.5.0 lib/fullcontact/request.rb
fullcontact-0.4.4 lib/fullcontact/request.rb
fullcontact-0.4.1 lib/fullcontact/request.rb