Sha256: 92c9b52699054dfa99ee36f6171aa8ad34d94c5d6f786b3c85cb08335bbaf0dc

Contents?: true

Size: 498 Bytes

Versions: 8

Compression:

Stored size: 498 Bytes

Contents

# frozen_string_literal: true

require 'intercom/utils'

module Intercom
  module ApiOperations
    module Load
      def load(object)
        if object.id
          response = @client.get("/#{collection_name}/#{object.id}", {})
        else
          raise "Cannot load #{collection_class} as it does not have a valid id."
        end
        raise Intercom::HttpError, 'Http Error - No response entity returned' unless response

        object.from_response(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/load.rb
intercom-4.2.0 lib/intercom/api_operations/load.rb
intercom-4.1.3 lib/intercom/api_operations/load.rb
intercom-4.1.2 lib/intercom/api_operations/load.rb
intercom-4.1.1 lib/intercom/api_operations/load.rb
intercom-4.1.0 lib/intercom/api_operations/load.rb
intercom-4.0.1 lib/intercom/api_operations/load.rb
intercom-4.0.0 lib/intercom/api_operations/load.rb