Amazon and eBay Buy/Sell APIs

This commit is contained in:
Marvin Scham
2023-06-22 16:31:54 +00:00
parent a86ed4c5e0
commit 0be5a5ad40
21 changed files with 980 additions and 7 deletions

View File

@@ -0,0 +1,52 @@
package de.rwu.easydrop.api.client;
import java.net.MalformedURLException;
import java.net.URL;
/**
* Sends a buy request to the eBay API.
*
* @since 0.3.0
*/
public final class EbayPurchaser extends AbstractPurchaser {
/**
* Name of this data source.
*/
private static final String DATA_TARGET = "eBay";
/**
* Base URL to the eBay Purchase API.
*/
private String baseUrl;
/**
* Access credential.
*/
private String apiKey;
/**
* Sets up instance with Base URL and API Key.
*
* @param newBaseUrl
* @param newApiKey
*/
public EbayPurchaser(final String newBaseUrl, final String newApiKey) {
this.baseUrl = newBaseUrl;
this.apiKey = newApiKey;
}
@Override
protected URL createApiUrl(final String searchQuery) throws MalformedURLException {
return new URL(baseUrl
+ "/buy/"
+ searchQuery);
}
@Override
protected String getApiKey() {
return apiKey;
}
@Override
protected String getDataTarget() {
return DATA_TARGET;
}
}