Class: Forem::Services::BaseService Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/forem/services/base_service.rb

Overview

This class is abstract.

Subclass and add public methods that delegate to the appropriate model class.

Abstract base class for all Forem API service objects.

Each service wraps a specific area of the Forem API and delegates method calls to the corresponding model class, automatically injecting the client's APIRequestor so that the correct credentials and base URL are used for every request.

Concrete subclasses (e.g. ArticleService, UserService) are accessed through the reader methods on Client and should not be instantiated directly.

Instance Method Summary collapse

Constructor Details

#initialize(requestor) ⇒ BaseService

Create a new service instance bound to the given requestor.

Parameters:

  • requestor (APIRequestor)

    the HTTP requestor that carries the client's configuration (API key, base URL, etc.)



25
26
27
# File 'lib/forem/services/base_service.rb', line 25

def initialize(requestor)
  @requestor = requestor
end