Class for the Recurly client library.
예제 #1
0
        static void Main(string[] args)
        {
            var client = new Recurly.Client("e9922993342845dbbc583c145b2ab811");

            var subscriptionUuid = "50b8aee7610eefeb55374a4996838338";
            var change           = new SubscriptionChange
            {
                TimeFrame = SubscriptionChange.ChangeTimeframe.Now,
                // or TimeFrame = SubscriptionChange.ChangeTimeframe.Renewal
                // or TimeFrame = SubscriptionChange.ChangeTimeframe.BillDate
                PlanCode = "silver",
                Quantity = 2
            };

            // perform the update operation
            Subscription.ChangeSubscription(subscriptionUuid, change);
        }
예제 #2
0
        static void Main(string[] args)
        {
            var client = new Recurly.Client("e9922993342845dbbc583c145b2ab811");

            try
            {
                var accountReq = new AccountCreate()
                {
                    Code      = "76a5f681-5754-4760-932d-ba6d17b50147",
                    FirstName = "Frodo",
                    LastName  = "Baggins",
                    Company   = "76a5f681-5754-4760-932d-ba6d17b50147",
                    Address   = new Address()
                    {
                        City       = "New Orleans",
                        Region     = "LA",
                        Country    = "US",
                        PostalCode = "70115",
                        Street1    = "900 Camp St."
                    }
                };
                Account account = client.CreateAccount(accountReq);
                Console.WriteLine($"Created account {account.Code}");
            }
            catch (Recurly.Errors.Validation ex)
            {
                // If the request was not valid, you may want to tell your user
                // why. You can find the invalid params and reasons in ex.Error.Params
                Console.WriteLine($"Failed validation: {ex.Error.Message}");
            }
            catch (Recurly.Errors.ApiError ex)
            {
                // Use ApiError to catch a generic error from the API
                Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
            }

            Console.WriteLine("Press enter to close...");
            Console.ReadLine();
        }
예제 #3
0
 internal static void ChangeInstance(Client client)
 {
     _instance = client;
 }
예제 #4
0
        public void RespondsWithAValidApiVersion()
        {
            var client = new Recurly.Client(apiKey);

            Assert.Matches(new Regex("v\\d{4}-\\d{2}-\\d{2}"), client.ApiVersion);
        }
예제 #5
0
        internal static Pager <T> Build(string url, Dictionary <string, object> queryParams, Client client)
        {
            if (queryParams != null)
            {
                url += Utils.QueryString(queryParams);
            }

            return(new Pager <T>()
            {
                HasMore = true,
                Data = null,
                Next = url,
                RecurlyClient = client,
            });
        }