Skip to content

Instantly share code, notes, and snippets.

@tapanpandita
Last active June 25, 2016 17:02
Show Gist options
  • Save tapanpandita/3d5d31a96c2c39f80148c650280a25f7 to your computer and use it in GitHub Desktop.
Save tapanpandita/3d5d31a96c2c39f80148c650280a25f7 to your computer and use it in GitHub Desktop.
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);
}
}
@varunachar
Copy link

Umm... Builder Pattern?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment