public final class RateLimit
extends java.lang.Object
implements java.io.Serializable
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.
Modifier and Type | Class and Description |
---|---|
static class |
RateLimit.Builder
A builder class for creating immutable
RateLimit objects
e.g. for testing purposes. |
Modifier and Type | Method and Description |
---|---|
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.
|
public int requestUnitsAvailable()
public int minutesToReset()
public boolean equals(java.lang.Object o)
true
if o
is a RateLimit
object with equal properties.equals
in class java.lang.Object
public java.lang.String toString()
The exact details of the representation are unspecified and subject to change.
toString
in class java.lang.Object
public int hashCode()
equals
.hashCode
in class java.lang.Object
See www.degreedays.net/api/ for more about the Degree Days.net API.
You can sign up for a Degree Days.net API account and read the integration guide that is useful and applicable whether you are using Java or not.