The My Rewards API requires you to have an api key/token.
All API calls are routed from the MyRewards
object.
MyRewards myrewards = MyRewards.make(apiKey);
The sdk is hosted on maven central so you can include it as a dependency in your projects as follows:
compile 'com.9ls:myrewards-java-sdk:3.0.6'
<dependency>
<groupId>com.9ls</groupId>
<artifactId>myrewards-java-sdk</artifactId>
<version>3.0.6</version>
</dependency>
<dependency org="com.9ls" name="myrewards-java-sdk" rev="3.0.6" />
You can also use ClientConfiguration
to configure the SDK. Apart
from the the api key all the other values have defaults.
MyRewards myrewards = MyRewards.make(new Configuration()
.withApiKey(apiKey)
.withSecretKey(secretKey)
.withEndpoint("https://api.my-rewards.co.uk")
.withMaxConnectionsPerRoute(20)
.withUserAgent("myrewards-sdk-java 3.0.6")
.withBlockTillRateLimitReset(false)
.withRequestsPerSecond(5)
.withRequestBurstSize(20);
Configuration Attribute | Description |
---|---|
Endpoint | The base api url. Defaults to https://staging.my-rewards.co.uk |
MaxConnectionsPerRoute | The effective maximum number of concurrent connections in the pool. Connections try to make use of the keep-alive directive. Defaults to 20 |
UserAgent | The user agent string sent in the request |
BlockTillRateLimitReset | If set to true then the client will block if the rate limit has been reached until the reset timestamp has expired. Defaults to false |
RequestsPerSecond | If rate limited is true then the maximum requests per second |
RequestBurstSize | If rate limited the number of consecutive requests allowed before rate limit is enforced |
Once you have checked out the project you can build and test the project with the following command:
gradlew check -x integrationTest -x jacocoTestReport