Skip to content

Instantly share code, notes, and snippets.

@riwnodennyk
Created September 29, 2015 09:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save riwnodennyk/42b84f546b1f647575ba to your computer and use it in GitHub Desktop.
Save riwnodennyk/42b84f546b1f647575ba to your computer and use it in GitHub Desktop.
package com.netpulse.mobile.training.client;
import android.support.annotation.Nullable;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.netpulse.mobile.core.client.NetpulseRequest;
import com.netpulse.mobile.core.exception.NetpulseException;
import com.netpulse.mobile.core.model.UserCredentials;
import com.netpulse.mobile.training.model.BrandDescription;
import org.json.JSONException;
import java.io.IOException;
import javax.inject.Inject;
public class BrandInfoClient implements BrandInfoApi {
private final UserCredentials credentials;
private final ObjectMapper objectMapper;
@Inject
public BrandInfoClient(@Nullable UserCredentials credentials, ObjectMapper objectMapper) {
this.credentials = credentials;
this.objectMapper = objectMapper;
}
@Override
public BrandDescription response() throws IOException, NetpulseException, JSONException {
String body = NetpulseRequest
.create(credentials)
.path("/np/brand/description")
.executeGet()
.verify()
.getBody();
return objectMapper.readValue(body, BrandDescription.class);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment