Amazon and eBay Buy/Sell APIs
This commit is contained in:
52
src/main/java/de/rwu/easydrop/api/client/EbayPurchaser.java
Normal file
52
src/main/java/de/rwu/easydrop/api/client/EbayPurchaser.java
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user