net.degreedays.api
Class RateLimit

java.lang.Object
  extended by net.degreedays.api.RateLimit
All Implemented Interfaces:
java.io.Serializable

public final class RateLimit
extends java.lang.Object
implements java.io.Serializable

A snapshot of an API account's rate limit.

The real state of an account's rate limit changes over time and as more requests are made to the API. So a RateLimit object, which is a snapshot, is best checked soon after it is received. It is accessible through the metadata that is included with each API Response and with each RequestFailureException.

Instances of this class are immutable. You can safely reuse them and call them from multiple threads at once.


Nested Class Summary
static class RateLimit.Builder
          A builder class for creating immutable RateLimit objects e.g. for testing purposes.
 
Method Summary
 boolean equals(java.lang.Object o)
          Returns true if o is a RateLimit object with equal properties.
 int hashCode()
          Overridden to ensure consistency with equals.
 int minutesToReset()
          Returns the number of minutes until the rate limit is reset, at the time that this snapshot of the rate-limit state was taken.
 int requestUnitsAvailable()
          Returns the number of request units available for use before the next reset, at the time that this snapshot of the rate-limit state was taken.
 java.lang.String toString()
          Returns a non-null, non-empty string representation of this object for logging and debugging purposes.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

requestUnitsAvailable

public int requestUnitsAvailable()
Returns the number of request units available for use before the next reset, at the time that this snapshot of the rate-limit state was taken.


minutesToReset

public int minutesToReset()
Returns the number of minutes until the rate limit is reset, at the time that this snapshot of the rate-limit state was taken.


equals

public boolean equals(java.lang.Object o)
Returns true if o is a RateLimit object with equal properties.

Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Returns a non-null, non-empty string representation of this object for logging and debugging purposes.

The exact details of the representation are unspecified and subject to change.

Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overridden to ensure consistency with equals.

Overrides:
hashCode in class java.lang.Object


www.degreedays.net/api/