/// <summary>
        /// Execute a manual REST request
        /// </summary>
        /// <typeparam name="T">The type of object to create and populate with the returned data.</typeparam>
        /// <param name="request">The RestRequest to execute (will use client credentials)</param>
        public StripeObject ExecuteObject(RestRequest request)
        {
            request.OnBeforeDeserialization = (resp) => {
                // for individual resources when there's an error to make
                // sure that RestException props are populated
                if (((int)resp.StatusCode) >= 400)
                {
                    request.RootElement = "";
                }
            };

            var response = _client.Execute(request);
            var json     = Deserialize(response.Content);
            var obj      = new StripeObject();

            obj.SetModel(json);

            return(obj);
        }
Beispiel #2
0
        /// <summary>
        /// Execute a manual REST request
        /// </summary>
        /// <typeparam name="T">The type of object to create and populate with the returned data.</typeparam>
        /// <param name="request">The RestRequest to execute (will use client credentials)</param>
        public StripeObject ExecuteObject(RestRequest request)
        {
            request.OnBeforeDeserialization = (resp) => {
                // for individual resources when there's an error to make
                // sure that RestException props are populated
                if (((int)resp.StatusCode) >= 400)
                    request.RootElement = "";
            };

            var response = _client.Execute(request);
            var json = Deserialize(response.Content);
            var obj = new StripeObject();
            obj.SetModel(json);

            return obj;
        }