Skip to content

Commit

Permalink
Lint a few more packages
Browse files Browse the repository at this point in the history
  • Loading branch information
remi-stripe committed Jul 3, 2018
1 parent 157f27f commit 558e93f
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 41 deletions.
7 changes: 7 additions & 0 deletions Makefile
Expand Up @@ -21,8 +21,15 @@ lint:
golint -set_exit_status ./applepaydomain
golint -set_exit_status ./balance
golint -set_exit_status ./bankaccount
golint -set_exit_status ./bitcoinreceiver
golint -set_exit_status ./bitcointransaction
golint -set_exit_status ./card
golint -set_exit_status ./charge
golint -set_exit_status ./countryspec
golint -set_exit_status ./coupon
golint -set_exit_status ./customer
golint -set_exit_status ./discount
golint -set_exit_status ./dispute

test:
go test -race ./...
Expand Down
10 changes: 5 additions & 5 deletions bitcoinreceiver/client.go
Expand Up @@ -17,24 +17,24 @@ type Client struct {
Key string
}

// New POSTs new bitcoin receivers.
// For more details see https://stripe.com/docs/api/#create_bitcoin_receiver
// New creates a new bitcoin receiver.
func New(params *stripe.BitcoinReceiverParams) (*stripe.BitcoinReceiver, error) {
return getC().New(params)
}

// New creates a new bitcoin receiver.
func (c Client) New(params *stripe.BitcoinReceiverParams) (*stripe.BitcoinReceiver, error) {
receiver := &stripe.BitcoinReceiver{}
err := c.B.Call(http.MethodPost, "/bitcoin/receivers", c.Key, params, receiver)
return receiver, err
}

// Get returns the details of a bitcoin receiver.
// For more details see https://stripe.com/docs/api/#retrieve_bitcoin_receiver
func Get(id string, params *stripe.BitcoinReceiverParams) (*stripe.BitcoinReceiver, error) {
return getC().Get(id, params)
}

// Get returns the details of a bitcoin receiver.
func (c Client) Get(id string, params *stripe.BitcoinReceiverParams) (*stripe.BitcoinReceiver, error) {
path := stripe.FormatURLPath("/bitcoin/receivers/%s", id)
bitcoinReceiver := &stripe.BitcoinReceiver{}
Expand All @@ -43,11 +43,11 @@ func (c Client) Get(id string, params *stripe.BitcoinReceiverParams) (*stripe.Bi
}

// Update updates a bitcoin receiver's properties.
// For more details see https://stripe.com/docs/api#update_bitcoin_receiver.
func Update(id string, params *stripe.BitcoinReceiverUpdateParams) (*stripe.BitcoinReceiver, error) {
return getC().Update(id, params)
}

// Update updates a bitcoin receiver's properties.
func (c Client) Update(id string, params *stripe.BitcoinReceiverUpdateParams) (*stripe.BitcoinReceiver, error) {
path := stripe.FormatURLPath("/bitcoin/receivers/%s", id)
receiver := &stripe.BitcoinReceiver{}
Expand All @@ -56,11 +56,11 @@ func (c Client) Update(id string, params *stripe.BitcoinReceiverUpdateParams) (*
}

// List returns a list of bitcoin receivers.
// For more details see https://stripe.com/docs/api/#list_bitcoin_receivers
func List(params *stripe.BitcoinReceiverListParams) *Iter {
return getC().List(params)
}

// List returns a list of bitcoin receivers.
func (c Client) List(listParams *stripe.BitcoinReceiverListParams) *Iter {
return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {
list := &stripe.BitcoinReceiverList{}
Expand Down
2 changes: 1 addition & 1 deletion bitcointransaction/client.go
Expand Up @@ -15,11 +15,11 @@ type Client struct {
}

// List returns a list of bitcoin transactions.
// For more details see https://stripe.com/docs/api#retrieve_bitcoin_receiver.
func List(params *stripe.BitcoinTransactionListParams) *Iter {
return getC().List(params)
}

// List returns a list of bitcoin transactions.
func (c Client) List(listParams *stripe.BitcoinTransactionListParams) *Iter {
return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {
path := stripe.FormatURLPath("/bitcoin/receivers/%s/transactions",
Expand Down
7 changes: 4 additions & 3 deletions countryspec/client.go
Expand Up @@ -14,24 +14,25 @@ type Client struct {
Key string
}

// Get returns a CountrySpec for a given country code
// For more details see https://stripe.com/docs/api/ruby#retrieve_country_spec
// Get returns a Country Spec for a given country code.
func Get(country string, params *stripe.CountrySpecParams) (*stripe.CountrySpec, error) {
return getC().Get(country, params)
}

// Get returns a Country Spec for a given country code.
func (c Client) Get(country string, params *stripe.CountrySpecParams) (*stripe.CountrySpec, error) {
path := stripe.FormatURLPath("/country_specs/%s", country)
countrySpec := &stripe.CountrySpec{}
err := c.B.Call(http.MethodGet, path, c.Key, params, countrySpec)
return countrySpec, err
}

// List lists available CountrySpecs.
// List lists available Country Specs.
func List(params *stripe.CountrySpecListParams) *Iter {
return getC().List(params)
}

// List lists available Country Specs.
func (c Client) List(listParams *stripe.CountrySpecListParams) *Iter {
return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {
list := &stripe.CountrySpecList{}
Expand Down
12 changes: 6 additions & 6 deletions coupon/client.go
Expand Up @@ -14,24 +14,24 @@ type Client struct {
Key string
}

// New POSTs new coupons.
// For more details see https://stripe.com/docs/api#create_coupon.
// New creates a new coupon.
func New(params *stripe.CouponParams) (*stripe.Coupon, error) {
return getC().New(params)
}

// New creates a new coupon.
func (c Client) New(params *stripe.CouponParams) (*stripe.Coupon, error) {
coupon := &stripe.Coupon{}
err := c.B.Call(http.MethodPost, "/coupons", c.Key, params, coupon)
return coupon, err
}

// Get returns the details of a coupon.
// For more details see https://stripe.com/docs/api#retrieve_coupon.
func Get(id string, params *stripe.CouponParams) (*stripe.Coupon, error) {
return getC().Get(id, params)
}

// Get returns the details of a coupon.
func (c Client) Get(id string, params *stripe.CouponParams) (*stripe.Coupon, error) {
path := stripe.FormatURLPath("/coupons/%s", id)
coupon := &stripe.Coupon{}
Expand All @@ -40,11 +40,11 @@ func (c Client) Get(id string, params *stripe.CouponParams) (*stripe.Coupon, err
}

// Update updates a coupon's properties.
// For more details see https://stripe.com/docs/api#update_coupon.
func Update(id string, params *stripe.CouponParams) (*stripe.Coupon, error) {
return getC().Update(id, params)
}

// Update updates a coupon's properties.
func (c Client) Update(id string, params *stripe.CouponParams) (*stripe.Coupon, error) {
path := stripe.FormatURLPath("/coupons/%s", id)
coupon := &stripe.Coupon{}
Expand All @@ -53,11 +53,11 @@ func (c Client) Update(id string, params *stripe.CouponParams) (*stripe.Coupon,
}

// Del removes a coupon.
// For more details see https://stripe.com/docs/api#delete_coupon.
func Del(id string, params *stripe.CouponParams) (*stripe.Coupon, error) {
return getC().Del(id, params)
}

// Del removes a coupon.
func (c Client) Del(id string, params *stripe.CouponParams) (*stripe.Coupon, error) {
path := stripe.FormatURLPath("/coupons/%s", id)
coupon := &stripe.Coupon{}
Expand All @@ -66,11 +66,11 @@ func (c Client) Del(id string, params *stripe.CouponParams) (*stripe.Coupon, err
}

// List returns a list of coupons.
// For more details see https://stripe.com/docs/api#list_coupons.
func List(params *stripe.CouponListParams) *Iter {
return getC().List(params)
}

// List returns a list of coupons.
func (c Client) List(listParams *stripe.CouponListParams) *Iter {
return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {
list := &stripe.CouponList{}
Expand Down
12 changes: 6 additions & 6 deletions customer/client.go
Expand Up @@ -14,24 +14,24 @@ type Client struct {
Key string
}

// New POSTs new customers.
// For more details see https://stripe.com/docs/api#create_customer.
// New creates a new customer.
func New(params *stripe.CustomerParams) (*stripe.Customer, error) {
return getC().New(params)
}

// New creates a new customer.
func (c Client) New(params *stripe.CustomerParams) (*stripe.Customer, error) {
cust := &stripe.Customer{}
err := c.B.Call(http.MethodPost, "/customers", c.Key, params, cust)
return cust, err
}

// Get returns the details of a customer.
// For more details see https://stripe.com/docs/api#retrieve_customer.
func Get(id string, params *stripe.CustomerParams) (*stripe.Customer, error) {
return getC().Get(id, params)
}

// Get returns the details of a customer.
func (c Client) Get(id string, params *stripe.CustomerParams) (*stripe.Customer, error) {
path := stripe.FormatURLPath("/customers/%s", id)
cust := &stripe.Customer{}
Expand All @@ -40,11 +40,11 @@ func (c Client) Get(id string, params *stripe.CustomerParams) (*stripe.Customer,
}

// Update updates a customer's properties.
// For more details see https://stripe.com/docs/api#update_customer.
func Update(id string, params *stripe.CustomerParams) (*stripe.Customer, error) {
return getC().Update(id, params)
}

// Update updates a customer's properties.
func (c Client) Update(id string, params *stripe.CustomerParams) (*stripe.Customer, error) {
path := stripe.FormatURLPath("/customers/%s", id)
cust := &stripe.Customer{}
Expand All @@ -53,11 +53,11 @@ func (c Client) Update(id string, params *stripe.CustomerParams) (*stripe.Custom
}

// Del removes a customer.
// For more details see https://stripe.com/docs/api#delete_customer.
func Del(id string, params *stripe.CustomerParams) (*stripe.Customer, error) {
return getC().Del(id, params)
}

// Del removes a customer.
func (c Client) Del(id string, params *stripe.CustomerParams) (*stripe.Customer, error) {
path := stripe.FormatURLPath("/customers/%s", id)
cust := &stripe.Customer{}
Expand All @@ -66,11 +66,11 @@ func (c Client) Del(id string, params *stripe.CustomerParams) (*stripe.Customer,
}

// List returns a list of customers.
// For more details see https://stripe.com/docs/api#list_customers.
func List(params *stripe.CustomerListParams) *Iter {
return getC().List(params)
}

// List returns a list of customers.
func (c Client) List(listParams *stripe.CustomerListParams) *Iter {
return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {
list := &stripe.CustomerList{}
Expand Down
6 changes: 3 additions & 3 deletions discount/client.go
Expand Up @@ -14,24 +14,24 @@ type Client struct {
}

// Del removes a discount from a customer.
// For more details see https://stripe.com/docs/api#delete_discount.
func Del(customerID string, params *stripe.DiscountParams) (*stripe.Discount, error) {
return getC().Del(customerID, params)
}

// Del removes a discount from a customer.
func (c Client) Del(customerID string, params *stripe.DiscountParams) (*stripe.Discount, error) {
path := stripe.FormatURLPath("/customers/%s/discount", customerID)
discount := &stripe.Discount{}
err := c.B.Call(http.MethodDelete, path, c.Key, params, discount)
return discount, err
}

// DelSub removes a discount from a customer's subscription.
// For more details see https://stripe.com/docs/api#delete_subscription_discount.
// DelSubscription removes a discount from a customer's subscription.
func DelSubscription(subscriptionID string, params *stripe.DiscountParams) (*stripe.Discount, error) {
return getC().DelSub(subscriptionID, params)
}

// DelSub removes a discount from a customer's subscription.
func (c Client) DelSub(subscriptionID string, params *stripe.DiscountParams) (*stripe.Discount, error) {
path := stripe.FormatURLPath("/subscriptions/%s/discount", subscriptionID)
discount := &stripe.Discount{}
Expand Down
34 changes: 17 additions & 17 deletions dispute/client.go
Expand Up @@ -14,11 +14,11 @@ type Client struct {
}

// Get returns the details of a dispute.
// For more details see https://stripe.com/docs/api#retrieve_dispute.
func Get(id string, params *stripe.DisputeParams) (*stripe.Dispute, error) {
return getC().Get(id, params)
}

// Get returns the details of a dispute.
func (c Client) Get(id string, params *stripe.DisputeParams) (*stripe.Dispute, error) {
path := stripe.FormatURLPath("/disputes/%s", id)
dispute := &stripe.Dispute{}
Expand All @@ -27,11 +27,11 @@ func (c Client) Get(id string, params *stripe.DisputeParams) (*stripe.Dispute, e
}

// List returns a list of disputes.
// For more details see https://stripe.com/docs/api#list_disputes.
func List(params *stripe.DisputeListParams) *Iter {
return getC().List(params)
}

// List returns a list of disputes.
func (c Client) List(listParams *stripe.DisputeListParams) *Iter {
return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {
list := &stripe.DisputeList{}
Expand All @@ -46,25 +46,12 @@ func (c Client) List(listParams *stripe.DisputeListParams) *Iter {
})}
}

// Iter is an iterator for lists of Disputes.
// The embedded Iter carries methods with it;
// see its documentation for details.
type Iter struct {
*stripe.Iter
}

// Dispute returns the most recent Dispute
// visited by a call to Next.
func (i *Iter) Dispute() *stripe.Dispute {
return i.Current().(*stripe.Dispute)
}

// Update updates a dispute.
// For more details see https://stripe.com/docs/api#update_dispute.
func Update(id string, params *stripe.DisputeParams) (*stripe.Dispute, error) {
return getC().Update(id, params)
}

// Update updates a dispute.
func (c Client) Update(id string, params *stripe.DisputeParams) (*stripe.Dispute, error) {
path := stripe.FormatURLPath("/disputes/%s", id)
dispute := &stripe.Dispute{}
Expand All @@ -73,18 +60,31 @@ func (c Client) Update(id string, params *stripe.DisputeParams) (*stripe.Dispute
}

// Close dismisses a dispute in the customer's favor.
// For more details see https://stripe.com/docs/api#close_dispute.
func Close(id string, params *stripe.DisputeParams) (*stripe.Dispute, error) {
return getC().Close(id, params)
}

// Close dismisses a dispute in the customer's favor.
func (c Client) Close(id string, params *stripe.DisputeParams) (*stripe.Dispute, error) {
path := stripe.FormatURLPath("/disputes/%s/close", id)
dispute := &stripe.Dispute{}
err := c.B.Call(http.MethodPost, path, c.Key, params, dispute)
return dispute, err
}

// Iter is an iterator for lists of Disputes.
// The embedded Iter carries methods with it;
// see its documentation for details.
type Iter struct {
*stripe.Iter
}

// Dispute returns the most recent Dispute
// visited by a call to Next.
func (i *Iter) Dispute() *stripe.Dispute {
return i.Current().(*stripe.Dispute)
}

func getC() Client {
return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}
}

0 comments on commit 558e93f

Please sign in to comment.