Sha256: f4586f53cdf05526373be04ee9f3b09c99867f7faaab43e066977b4b3721a8df

Contents?: true

Size: 638 Bytes

Versions: 8

Compression:

Stored size: 638 Bytes

Contents

# frozen_string_literal: true

require 'intercom/utils'

module Intercom
  module ApiOperations
    module Find
      def find(params)
        raise BadRequestError, "#{self}#find takes a hash as its parameter but you supplied #{params.inspect}" unless params.is_a? Hash

        if params[:id]
          id = params.delete(:id)
          response = @client.get("/#{collection_name}/#{id}", params)
        else
          response = @client.get("/#{collection_name}", params)
        end
        raise Intercom::HttpError, 'Http Error - No response entity returned' unless response

        from_api(response)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
intercom-4.2.1 lib/intercom/api_operations/find.rb
intercom-4.2.0 lib/intercom/api_operations/find.rb
intercom-4.1.3 lib/intercom/api_operations/find.rb
intercom-4.1.2 lib/intercom/api_operations/find.rb
intercom-4.1.1 lib/intercom/api_operations/find.rb
intercom-4.1.0 lib/intercom/api_operations/find.rb
intercom-4.0.1 lib/intercom/api_operations/find.rb
intercom-4.0.0 lib/intercom/api_operations/find.rb