Last active
June 25, 2016 17:02
-
-
Save tapanpandita/3d5d31a96c2c39f80148c650280a25f7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.hypertrack.examples; | |
import io.hypertrack.factory.CustomerFactory; | |
import io.hypertrack.factory.DestinationFactory; | |
import io.hypertrack.model.Customer; | |
import io.hypertrack.model.Destination; | |
import io.hypertrack.net.HyperTrackClient; | |
import java.util.*; | |
public class SimpleExample { | |
public static void main( String[] args ) throws Exception | |
{ | |
/* Create client with key. */ | |
HyperTrackClient client = new HyperTrackClient("<SECRET_KEY>"); | |
/* Create new customer. */ | |
CustomerFactory customerFactory = new CustomerFactory(client); | |
Map<String, Object> customerParams = new HashMap<>(); | |
customerParams.put("name", "Tapan Pandita"); | |
customerParams.put("email", "support@hypertrack.io"); | |
Customer customer = customerFactory.create(customerParams); | |
/* Create new destination. */ | |
DestinationFactory destinationFactory = new DestinationFactory(client); | |
Map<String, Object> destinationParams = new HashMap<>(); | |
destinationParams.put("customer_id", customer.getId()); | |
destinationParams.put("address", "270 Linden Street"); | |
destinationParams.put("city", "San Francisco"); | |
destinationParams.put("country", "US"); | |
Destination destination = destinationFactory.create(destinationParams); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Umm... Builder Pattern?