com.fitbit.api
Class APIUtil
java.lang.Object
com.fitbit.api.APIUtil
public class APIUtil
- extends Object
|
Method Summary |
static String |
capitalize(String s)
|
static String |
constructFullSubscriptionUrl(String baseUrl,
APIVersion version,
FitbitResourceOwner owner,
APICollectionType collectionType,
APIFormat format)
|
static String |
constructFullSubscriptionUrl(String baseUrl,
APIVersion version,
FitbitResourceOwner owner,
APICollectionType collectionType,
String subscriptionId,
APIFormat format)
|
static String |
constructFullUrl(String baseUrl,
APIVersion version,
FitbitResourceOwner owner,
APICollectionType collectionType,
ApiCollectionProperty collectionProperty,
APIFormat format)
|
static String |
constructFullUrl(String baseUrl,
APIVersion version,
FitbitResourceOwner owner,
APICollectionType collectionType,
org.joda.time.LocalDate date,
APIFormat format)
|
static String |
constructRelativeUrl(FitbitResourceOwner owner,
APICollectionType collectionType,
org.joda.time.LocalDate date)
|
static String |
constructTimeSeriesUrl(String baseUrl,
APIVersion version,
FitbitResourceOwner owner,
TimeSeriesResourceType resourceType,
String startDate,
String endDateOrPeriod,
APIFormat format)
|
static String |
constructTimeSeriesUrl(String baseUrl,
APIVersion version,
FitbitResourceOwner owner,
TimeSeriesResourceType resourceType,
String startDate,
String endDateOrPeriod,
String startTime,
String endTime,
APIFormat format)
|
static String |
contextualizeUrl(String baseUrl,
APIVersion version,
String relativeUrl,
APIFormat format)
|
static String |
generateSignature(String data,
String secret)
|
static String |
inputStreamToString(InputStream is)
|
protected static String |
nullSafeConstructRelativeUrl(FitbitResourceOwner owner,
APICollectionType collectionType,
org.joda.time.LocalDate date,
String subscriptionId)
|
protected static String |
nullSafeConstructUrl(String baseUrl,
APIVersion version,
FitbitResourceOwner owner,
APICollectionType collectionType,
ApiCollectionProperty collectionProperty,
APIFormat format)
|
protected static String |
nullSafeConstructUrl(String baseUrl,
APIVersion version,
FitbitResourceOwner owner,
APICollectionType collectionType,
org.joda.time.LocalDate date,
String subscriptionId,
APIFormat format)
|
protected static String |
nullSafeContextualizeUrl(String baseUrl,
APIVersion version,
String relativeUrl,
APIFormat format)
|
static org.joda.time.LocalDate |
parseDate(String date)
Parses the given date string into a valid LocalDate object,
suitable for passing into many API methods. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SIGNATURE_HEADER_NAME
public static final String SIGNATURE_HEADER_NAME
- See Also:
- Constant Field Values
UNSPECIFIED_SUBSCRIPTION_ID
public static final String UNSPECIFIED_SUBSCRIPTION_ID
- See Also:
- Constant Field Values
TYPICAL_URL_LENGTH
protected static final int TYPICAL_URL_LENGTH
- See Also:
- Constant Field Values
DATE_FORMATS
protected static final String[] DATE_FORMATS
STREAM_BUFFER_SIZE
protected static final int STREAM_BUFFER_SIZE
- See Also:
- Constant Field Values
APIUtil
public APIUtil()
constructFullUrl
public static String constructFullUrl(String baseUrl,
APIVersion version,
FitbitResourceOwner owner,
APICollectionType collectionType,
org.joda.time.LocalDate date,
APIFormat format)
constructFullUrl
public static String constructFullUrl(String baseUrl,
APIVersion version,
FitbitResourceOwner owner,
APICollectionType collectionType,
ApiCollectionProperty collectionProperty,
APIFormat format)
constructFullSubscriptionUrl
public static String constructFullSubscriptionUrl(String baseUrl,
APIVersion version,
FitbitResourceOwner owner,
APICollectionType collectionType,
APIFormat format)
constructFullSubscriptionUrl
public static String constructFullSubscriptionUrl(String baseUrl,
APIVersion version,
FitbitResourceOwner owner,
APICollectionType collectionType,
String subscriptionId,
APIFormat format)
constructRelativeUrl
public static String constructRelativeUrl(FitbitResourceOwner owner,
APICollectionType collectionType,
org.joda.time.LocalDate date)
contextualizeUrl
public static String contextualizeUrl(String baseUrl,
APIVersion version,
String relativeUrl,
APIFormat format)
parseDate
public static org.joda.time.LocalDate parseDate(String date)
- Parses the given date string into a valid
LocalDate object,
suitable for passing into many API methods.
- Parameters:
date -
- Returns:
-
- Throws:
IllegalArgumentException - if the given date can not be parsed
inputStreamToString
public static String inputStreamToString(InputStream is)
throws IOException
- Throws:
IOException
generateSignature
public static String generateSignature(String data,
String secret)
nullSafeConstructUrl
protected static String nullSafeConstructUrl(String baseUrl,
APIVersion version,
FitbitResourceOwner owner,
APICollectionType collectionType,
org.joda.time.LocalDate date,
String subscriptionId,
APIFormat format)
nullSafeConstructUrl
protected static String nullSafeConstructUrl(String baseUrl,
APIVersion version,
FitbitResourceOwner owner,
APICollectionType collectionType,
ApiCollectionProperty collectionProperty,
APIFormat format)
nullSafeConstructRelativeUrl
protected static String nullSafeConstructRelativeUrl(FitbitResourceOwner owner,
APICollectionType collectionType,
org.joda.time.LocalDate date,
String subscriptionId)
nullSafeContextualizeUrl
protected static String nullSafeContextualizeUrl(String baseUrl,
APIVersion version,
String relativeUrl,
APIFormat format)
constructTimeSeriesUrl
public static String constructTimeSeriesUrl(String baseUrl,
APIVersion version,
FitbitResourceOwner owner,
TimeSeriesResourceType resourceType,
String startDate,
String endDateOrPeriod,
APIFormat format)
constructTimeSeriesUrl
public static String constructTimeSeriesUrl(String baseUrl,
APIVersion version,
FitbitResourceOwner owner,
TimeSeriesResourceType resourceType,
String startDate,
String endDateOrPeriod,
String startTime,
String endTime,
APIFormat format)
capitalize
public static String capitalize(String s)
Copyright © 2012. All Rights Reserved.