Created
September 29, 2015 09:26
-
-
Save riwnodennyk/42b84f546b1f647575ba 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 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