@Override public ActionPlan create(NewActionPlan newActionPlan) { HttpRequest request = requestFactory.post(NewActionPlan.BASE_URL, newActionPlan.urlParams()); if (!request.ok()) { throw new IllegalStateException( "Fail to create action plan. Bad HTTP response status: " + request.code()); } return createActionPlanResult(request); }
private HttpRequest executeSimpleAction(String actionPlanKey, String action) { HttpRequest request = requestFactory.post( "/api/action_plans/" + action, EncodingUtils.toMap("key", actionPlanKey)); if (!request.ok()) { throw new IllegalStateException( "Fail to " + action + " action plan. Bad HTTP response status: " + request.code()); } return request; }