Class: Intercom::Service::BaseService

Inherits:
Object
  • Object
show all
Defined in:
lib/intercom/service/base_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ BaseService

Returns a new instance of BaseService.



10
11
12
# File 'lib/intercom/service/base_service.rb', line 10

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



8
9
10
# File 'lib/intercom/service/base_service.rb', line 8

def client
  @client
end

Instance Method Details

#collection_classObject

Raises:

  • (NotImplementedError)


14
15
16
# File 'lib/intercom/service/base_service.rb', line 14

def collection_class
  raise NotImplementedError
end

#collection_nameObject



22
23
24
# File 'lib/intercom/service/base_service.rb', line 22

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

#collection_proxy_classObject



18
19
20
# File 'lib/intercom/service/base_service.rb', line 18

def collection_proxy_class
  Intercom::ClientCollectionProxy
end

#from_api(api_response) ⇒ Object



26
27
28
29
30
31
# File 'lib/intercom/service/base_service.rb', line 26

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