Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.modymapp:modym-client-java:0.1.9.1-alpha'
}
dependencies {
implementation("com.github.modymapp:modym-client-java:0.1.9.1-alpha")
}
<dependency>
<groupId>com.github.modymapp</groupId>
<artifactId>modym-client-java</artifactId>
<version>0.1.9.1-alpha</version>
</dependency>
libraryDependencies += "com.github.modymapp" % "modym-client-java" % "0.1.9.1-alpha"
:dependencies [[com.github.modymapp/modym-client-java "0.1.9.1-alpha"]]
This is the official modym library for Java.
April 6th, 2017 - 0.1.9.1-alpha
This project uses JitPack as a maven repository.
Respository:
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
Dependency:
<dependency>
<groupId>com.github.modymapp</groupId>
<artifactId>modym-client-java</artifactId>
<version>0.1.9.1-alpha</version>
</dependency>
JitPack gradle repository.
Respository:
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
Dependency:
dependencies {
compile 'com.github.modymapp:modym-client-java:0.1.9.1-alpha'
}
The library is designed to provide data into and from https://api.modym.com, this library is intended to be used by modym clients. To be able to use this library you need an api key and api secret that can be genrated from the modym admin UI
//connect to modym api, replace {CLIENT_DOMAIN}, {CLIENT_KEY} and {CLIENT_KEY} with the ones from modym admin api settings page.
Modym modym = new Modym("{CLIENT_DOMAIN}", "{CLIENT_KEY}", "{CLIENT_KEY}");
// {reference_id} is the id of the customer in the client environment
String customerReferenceId = "{reference_id}";
ModymCustomer customer;
// retrieve customer details
customer = modym.customerOperations().getCustomerByReferenceId(customerReferenceId);
// Print customer name along with available and total points
System.out.println(String.format("customer: '%s %s'\navailable points: %f\ntotal points: %f",
customer.getFirstName(), customer.getLastName(), customer.getAvailablePoints(),
customer.getTotalPoints()));
// grant 100 points to the customer valid for 12 months
ModymPointTransaction credit = modym.rewardOperations().createCreditTransaction(customer.getCustomerId(),
new BigDecimal(100), 12, "Reward on visit");
// after adding the points print customer name along with available and total points
customer = modym.customerOperations().getCustomerByReferenceId(customerReferenceId);
System.out.println();
System.out.println(String.format(
"Before Approve:\ncustomer: '%s %s'\navailable points: %f\ntotal points: %f",
customer.getFirstName(), customer.getLastName(), customer.getAvailablePoints(),
customer.getTotalPoints()));
// approve the points granted to the customer
modym.rewardOperations().approveCreditTransaction(Long.parseLong(credit.getTransactionId()));
// after approving the points print customer name along with available and total points
customer = modym.customerOperations().getCustomerByReferenceId(customerReferenceId);
System.out.println();
System.out.println(String.format(
"After Approve:\ncustomer: '%s %s'\navailable points: %f\ntotal points: %f",
customer.getFirstName(), customer.getLastName(), customer.getAvailablePoints(),
customer.getTotalPoints()));
Modym API documentation is a great resource : http://www.modym.com/api/