com.fitbit.api
Class APIUtil

java.lang.Object
  extended by com.fitbit.api.APIUtil

public class APIUtil
extends Object


Field Summary
protected static String[] DATE_FORMATS
           
static String SIGNATURE_HEADER_NAME
           
protected static int STREAM_BUFFER_SIZE
           
protected static int TYPICAL_URL_LENGTH
           
static String UNSPECIFIED_SUBSCRIPTION_ID
           
 
Constructor Summary
APIUtil()
           
 
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
 

Field Detail

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
Constructor Detail

APIUtil

public APIUtil()
Method Detail

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.