forked from blacklightcms/recurly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.go
49 lines (44 loc) · 1.45 KB
/
client.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package mock
import (
"github.com/blacklightcms/recurly"
)
// Client is a test wrapper for recurly.Client holding mocks for
// all of the services.
type Client struct {
*recurly.Client
Accounts AccountsService
AddOns AddOnsService
Adjustments AdjustmentsService
Billing BillingService
Coupons CouponsService
CreditPayments CreditPaymentsService
Redemptions RedemptionsService
Invoices InvoicesService
Plans PlansService
Purchases PurchasesService
ShippingAddresses ShippingAddressesService
ShippingMethods ShippingMethodsService
Subscriptions SubscriptionsService
Transactions TransactionsService
}
// NewClient returns a new instance of *Client with the
// services assigned to mocks.
func NewClient(subdomain, apiKey string) *Client {
c := &Client{Client: recurly.NewClient(subdomain, apiKey)}
// Attach mock implementations.
c.Client.Accounts = &c.Accounts
c.Client.AddOns = &c.AddOns
c.Client.Adjustments = &c.Adjustments
c.Client.Billing = &c.Billing
c.Client.Coupons = &c.Coupons
c.Client.CreditPayments = &c.CreditPayments
c.Client.Redemptions = &c.Redemptions
c.Client.Invoices = &c.Invoices
c.Client.Plans = &c.Plans
c.Client.Purchases = &c.Purchases
c.Client.ShippingAddresses = &c.ShippingAddresses
c.Client.ShippingMethods = &c.ShippingMethods
c.Client.Subscriptions = &c.Subscriptions
c.Client.Transactions = &c.Transactions
return c
}