Master mergerd
This commit is contained in:
commit
1506270dec
0
buisnesslogic/src/main/java/com/plannaplan/entities/Exchange.java
Normal file → Executable file
0
buisnesslogic/src/main/java/com/plannaplan/entities/Exchange.java
Normal file → Executable file
0
buisnesslogic/src/main/java/com/plannaplan/models/MatchData.java
Normal file → Executable file
0
buisnesslogic/src/main/java/com/plannaplan/models/MatchData.java
Normal file → Executable file
0
buisnesslogic/src/main/java/com/plannaplan/repositories/ExchangeRepository.java
Normal file → Executable file
0
buisnesslogic/src/main/java/com/plannaplan/repositories/ExchangeRepository.java
Normal file → Executable file
0
buisnesslogic/src/main/java/com/plannaplan/services/ExchangeService.java
Normal file → Executable file
0
buisnesslogic/src/main/java/com/plannaplan/services/ExchangeService.java
Normal file → Executable file
@ -48,27 +48,28 @@ public class UsosApiService {
|
|||||||
* @return UserApiResponse modle contatining desired values
|
* @return UserApiResponse modle contatining desired values
|
||||||
*/
|
*/
|
||||||
public UserApiResponse getUserData(String usosId) {
|
public UserApiResponse getUserData(String usosId) {
|
||||||
final UserApiResponse apiResponse = new UserApiResponse();
|
final UserApiResponse apiResponse = new UserApiResponse();
|
||||||
try {
|
try {
|
||||||
final OAuth10aService service = new ServiceBuilder(apikey).apiSecret(apisecret)
|
final OAuth10aService service = new ServiceBuilder(apikey).apiSecret(apisecret)
|
||||||
.build(UsosOauth1Service.instance());
|
.build(UsosOauth1Service.instance());
|
||||||
|
|
||||||
final OAuthRequest request = new OAuthRequest(Verb.GET, apiUrl + "/services/users/user?user_id=" + usosId);
|
final OAuthRequest request = new OAuthRequest(Verb.GET, apiUrl + "/services/users/user?user_id=" + usosId);
|
||||||
service.signRequest(new OAuth1AccessToken("", ""), request);
|
service.signRequest(new OAuth1AccessToken("", ""), request);
|
||||||
|
try (Response response = service.execute(request)) {
|
||||||
|
final String json = response.getBody();
|
||||||
|
if (!json.equals("null")){
|
||||||
|
final ObjectMapper mapper = new ObjectMapper();
|
||||||
|
Map<String, String> map = mapper.readValue(json, new TypeReference<Map<String, String>>() {
|
||||||
|
});
|
||||||
|
apiResponse.setName(map.get(NAME_FIELD));
|
||||||
|
apiResponse.setSurname(map.get(SURNAME_FIELD));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException | InterruptedException | ExecutionException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
try (Response response = service.execute(request)) {
|
return apiResponse;
|
||||||
final String json = response.getBody();
|
|
||||||
final ObjectMapper mapper = new ObjectMapper();
|
|
||||||
Map<String, String> map = mapper.readValue(json, new TypeReference<Map<String, String>>() {
|
|
||||||
});
|
|
||||||
apiResponse.setName(map.get(NAME_FIELD));
|
|
||||||
apiResponse.setSurname(map.get(SURNAME_FIELD));
|
|
||||||
}
|
|
||||||
} catch (IOException | InterruptedException | ExecutionException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return apiResponse;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
0
buisnesslogic/src/test/java/com/plannaplan/repositories/ExchangeRepositoryTest.java
Normal file → Executable file
0
buisnesslogic/src/test/java/com/plannaplan/repositories/ExchangeRepositoryTest.java
Normal file → Executable file
0
buisnesslogic/src/test/java/com/plannaplan/services/ExchangeServiceTest.java
Normal file → Executable file
0
buisnesslogic/src/test/java/com/plannaplan/services/ExchangeServiceTest.java
Normal file → Executable file
0
restservice/src/main/java/com/plannaplan/controllers/ExchangeController.java
Normal file → Executable file
0
restservice/src/main/java/com/plannaplan/controllers/ExchangeController.java
Normal file → Executable file
0
restservice/src/main/java/com/plannaplan/responses/mappers/ExchangeResponseMappers.java
Normal file → Executable file
0
restservice/src/main/java/com/plannaplan/responses/mappers/ExchangeResponseMappers.java
Normal file → Executable file
0
restservice/src/main/java/com/plannaplan/responses/models/ExchangeResponse.java
Normal file → Executable file
0
restservice/src/main/java/com/plannaplan/responses/models/ExchangeResponse.java
Normal file → Executable file
0
restservice/src/test/java/com/plannaplan/controllers/ExchangeControllerTest.java
Normal file → Executable file
0
restservice/src/test/java/com/plannaplan/controllers/ExchangeControllerTest.java
Normal file → Executable file
Loading…
x
Reference in New Issue
Block a user