Snuze

Snuze core classes

Namespace

The classes described here are in the \snuze namespace.

Snuze core class overview

The Snuze "core" classes are those that aren't part of a more specific component.

Most classes in the Snuze package share the SnuzeObject class as a common ancestor. This design is a little odd, but it serves to automatically give each object an internal unique ID, a standard way of identifying itself, and direct access to several logging methods.

The SnuzeObject class

The \snuze\SnuzeObject class is the ultimate ancestor of most objects in the Snuze package. It provides some debugging scaffolding, as described above. With the exception of SnuzeFactory, the other classes described in this section extend SnuzeObject.

The AuthenticationState class

The \snuze\AuthenticationState class holds information about the current authenticated session with the API server. This includes the Reddit account credentials, an AccessToken object, and a RateLimitBucket to track the status of the API's rate limit mechanism.

The RateLimitBucket class

The \snuze\RateLimitBucket class keeps track of the state of Reddit's rate limiter. The Reddit API allows users to make a certain number of requests in a given 10-minute period. When a request is made to the API, the response headers indicate how many requests remain in the current time slice, and when the bucket will be refilled.

The RequestSender class

The \snuze\RequestSender class is responsible for transmitting a given Request to Reddit's API server, updating the RateLimitBucket, and returning the server's JSON response to the caller.

The Snuze class

The \snuze\Snuze class is the public interface to Snuze. This is the object your script will create and interact with. See Using Snuze for a look at its methods and how to use them.

The SnuzeFactory class

The \snuze\SnuzeFactory class is responsible for accepting and validating an array of configuration parameters, setting up the environment, then building and returning a Snuze object. See Getting Started for an example of using SnuzeFactory to get a Snuze instance.