Class ApiResource

    • Field Detail

      • CHARSET

        public static final java.nio.charset.Charset CHARSET
      • GSON

        public static final com.google.gson.Gson GSON
    • Constructor Detail

      • ApiResource

        public ApiResource()
    • Method Detail

      • setStripeResponseGetter

        public static void setStripeResponseGetter​(StripeResponseGetter srg)
      • singleClassUrl

        protected static java.lang.String singleClassUrl​(java.lang.Class<?> clazz)
      • singleClassUrl

        protected static java.lang.String singleClassUrl​(java.lang.Class<?> clazz,
                                                         java.lang.String apiBase)
      • classUrl

        protected static java.lang.String classUrl​(java.lang.Class<?> clazz)
      • classUrl

        protected static java.lang.String classUrl​(java.lang.Class<?> clazz,
                                                   java.lang.String apiBase)
      • urlEncode

        public static java.lang.String urlEncode​(java.lang.String str)
        URL-encodes a string.
      • requestCollection

        public static <T extends StripeCollectionInterface<?>> T requestCollection​(java.lang.String url,
                                                                                   java.util.Map<java.lang.String,​java.lang.Object> params,
                                                                                   java.lang.Class<T> clazz,
                                                                                   RequestOptions options)
                                                                            throws StripeException
        Similar to #request, but specific for use with collection types that come from the API (i.e. lists of resources).

        Collections need a little extra work because we need to plumb request options and params through so that we can iterate to the next page if necessary.

        Throws:
        StripeException
      • requestSearchResult

        public static <T extends StripeSearchResultInterface<?>> T requestSearchResult​(java.lang.String url,
                                                                                       java.util.Map<java.lang.String,​java.lang.Object> params,
                                                                                       java.lang.Class<T> clazz,
                                                                                       RequestOptions options)
                                                                                throws StripeException
        Similar to #request, but specific for use with searchResult types that come from the API

        SearchResults, like collections need a little extra work because we need to plumb request options and params through so that we can iterate to the next page if necessary.

        Please note, requestSearchResult is beta functionality and is subject to charge or removal at any time.

        Throws:
        StripeException
      • checkNullTypedParams

        public static void checkNullTypedParams​(java.lang.String url,
                                                ApiRequestParams params)
        Invalidate null typed parameters.
        Parameters:
        url - request url associated with the given parameters.
        params - typed parameters to check for null value.
      • setExpandableFieldId

        public static <T extends HasIdExpandableField<T> setExpandableFieldId​(java.lang.String newId,
                                                                                ExpandableField<T> currentObject)
        When setting a String ID for an ExpandableField, we need to be careful about keeping the String ID and the expanded object in sync. If they specify a new String ID that is different from the ID within the expanded object, we don't keep the object.