stripe-ruby/lib/stripe/invoice.rb
Brandur c1ff8bdc4c Integer-index encode all arrays
Changes all arrays from classic Rack encoding:

``` sh
arr[]=...&arr[]=...&arr[]=...
```

To integer-indexed encoding:

``` sh
arr[0]=...&arr[1]=...&arr[2]=...
```

We think that this should be tractable now that we've fully converted
all endpoints over to the new AbstractAPIMethod infrastructure on the
backend (although we should do a little more testing to make sure that
all endpoints still work).

As part of the conversion, we also remove any places that we were "spot
encoding" to get required integer-indexed syntax. This should now all be
built in.
2018-08-14 14:44:43 -07:00

32 lines
727 B
Ruby

# frozen_string_literal: true
module Stripe
class Invoice < APIResource
extend Stripe::APIOperations::List
include Stripe::APIOperations::Save
extend Stripe::APIOperations::Create
OBJECT_NAME = "invoice".freeze
def self.upcoming(params, opts = {})
resp, opts = request(:get, upcoming_url, params, opts)
Util.convert_to_stripe_object(resp.data, opts)
end
def pay(params = {}, opts = {})
resp, opts = request(:post, pay_url, params, opts)
initialize_from(resp.data, opts)
end
def self.upcoming_url
resource_url + "/upcoming"
end
private_class_method :upcoming_url
def pay_url
resource_url + "/pay"
end
private :pay_url
end
end