use of io.codekvast.login.heroku.model.HerokuAppDetails in project codekvast by crispab.
the class HerokuApiWrapperImplTest method should_get_app_details.
@Test
void should_get_app_details() throws IOException {
// given
givenThat(get("/addons/some-external-id").withHeader("Authorization", new EqualToPattern("Bearer some-access-token")).withHeader("Accept", new EqualToPattern("application/vnd.heroku+json; version=3")).willReturn(okJson(readResource("/heroku/sample-heroku-addons-response.json"))));
givenThat(get("/apps/some-app-id").withHeader("Authorization", new EqualToPattern("Bearer some-access-token")).withHeader("Accept", new EqualToPattern("application/vnd.heroku+json; version=3")).willReturn(okJson(readResource("/heroku/sample-heroku-apps-response.json"))));
// when
HerokuAppDetails appDetails = herokuApiWrapper.getAppDetails("some-external-id", "some-access-token");
// then
assertThat(appDetails, is(HerokuAppDetails.builder().appName("some-app-name").ownerEmail("some-owner-email").build()));
}
use of io.codekvast.login.heroku.model.HerokuAppDetails in project codekvast by crispab.
the class HerokuServiceImpl method fetchAppDetails.
private void fetchAppDetails(String source, String externalId, String accessToken, Long customerId) {
if (accessToken == null) {
logger.info("Cannot get application details from {} for externalId '{}'", source, externalId);
return;
}
HerokuAppDetails appDetails = herokuApiWrapper.getAppDetails(externalId, accessToken);
customerService.updateAppDetails(appDetails.getAppName(), appDetails.getOwnerEmail(), customerId);
}
Aggregations