com.synedge.oss.client.customer.JerseyCustomerClient.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of synedge-java-client Show documentation
Show all versions of synedge-java-client Show documentation
This client allows you to easily connect to the Synedge API with any language running on the JDK
The newest version!
package com.synedge.oss.client.customer
import com.synedge.oss.client.CustomerClient
import com.synedge.oss.client.SynedgeClient
import com.synedge.oss.client.authentication.AuthenticatedClient
import groovy.transform.PackageScope
final class JerseyCustomerClient extends AuthenticatedClient implements CustomerClient {
@PackageScope
JerseyCustomerClient(String username, String password, String endpoint = SynedgeClient.DEFAULT_ENDPOINT) {
super(username, password, endpoint)
}
/**
* {@inheritDoc}
*
* @see com.synedge.oss.client.CustomerClient#getCustomers()
*/
@Override
Collection getCustomers() {
def responseJson = signAndGet(client.target(endpoint).path('customers').request())
responseJson.collect { it -> new Customer(id: it.id, name: it.name) }
}
/**
* {@inheritDoc}
*
* @see com.synedge.oss.client.CustomerClient#getCustomer(java.lang.String)
*/
@Override
Customer getCustomer(String customerId) {
def responseJson = signAndGet(client.target(endpoint).path('customers').path(customerId).request())
new Customer(id: responseJson.id, name: responseJson.name)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy