Sha256: 413d7f3ad8cc15e7d5a74be0b7a93370afe39385b01d7335a096f8d36173e7f8

Contents?: true

Size: 691 Bytes

Versions: 8

Compression:

Stored size: 691 Bytes

Contents

# frozen_string_literal: true

require 'intercom/client_collection_proxy'

module Intercom
  module Service
    class BaseService
      attr_reader :client

      def initialize(client)
        @client = client
      end

      def collection_class
        raise NotImplementedError
      end

      def collection_proxy_class
        Intercom::ClientCollectionProxy
      end

      def collection_name
        @collection_name ||= Utils.resource_class_to_collection_name(collection_class)
      end

      def from_api(api_response)
        object = collection_class.new
        object.client = @client
        object.from_response(api_response)
        object
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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