mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-10-05 00:02:50 -04:00
As seen in #928, the `refresh` method doesn't work for an event class. This is because event has a field called `request`, and it ends up replacing the `request` method that it inherited from being an API resource, so when `refresh` tries to make a request, it fails because it tries to invoke it on the accessor added for the event's property. Here we give `request` a much more unique name so that it will never conflict with a property field again, and update all internal references to use the new name. We use `alias` to make the old name available for backwards compatibility reasons because its been around for so long that people are probably calling it. Fixes #928.
75 lines
2.0 KiB
Ruby
75 lines
2.0 KiB
Ruby
# File generated from our OpenAPI spec
|
|
# frozen_string_literal: true
|
|
|
|
module Stripe
|
|
class Invoice < APIResource
|
|
extend Stripe::APIOperations::Create
|
|
include Stripe::APIOperations::Delete
|
|
extend Stripe::APIOperations::List
|
|
include Stripe::APIOperations::Save
|
|
|
|
OBJECT_NAME = "invoice"
|
|
|
|
custom_method :finalize_invoice, http_verb: :post, http_path: "finalize"
|
|
custom_method :mark_uncollectible, http_verb: :post
|
|
custom_method :pay, http_verb: :post
|
|
custom_method :send_invoice, http_verb: :post, http_path: "send"
|
|
custom_method :void_invoice, http_verb: :post, http_path: "void"
|
|
|
|
def finalize_invoice(params = {}, opts = {})
|
|
request_stripe_object(
|
|
method: :post,
|
|
path: resource_url + "/finalize",
|
|
params: params,
|
|
opts: opts
|
|
)
|
|
end
|
|
|
|
def mark_uncollectible(params = {}, opts = {})
|
|
request_stripe_object(
|
|
method: :post,
|
|
path: resource_url + "/mark_uncollectible",
|
|
params: params,
|
|
opts: opts
|
|
)
|
|
end
|
|
|
|
def pay(params = {}, opts = {})
|
|
request_stripe_object(
|
|
method: :post,
|
|
path: resource_url + "/pay",
|
|
params: params,
|
|
opts: opts
|
|
)
|
|
end
|
|
|
|
def send_invoice(params = {}, opts = {})
|
|
request_stripe_object(
|
|
method: :post,
|
|
path: resource_url + "/send",
|
|
params: params,
|
|
opts: opts
|
|
)
|
|
end
|
|
|
|
def void_invoice(params = {}, opts = {})
|
|
request_stripe_object(
|
|
method: :post,
|
|
path: resource_url + "/void",
|
|
params: params,
|
|
opts: opts
|
|
)
|
|
end
|
|
|
|
def self.upcoming(params, opts = {})
|
|
resp, opts = execute_resource_request(:get, resource_url + "/upcoming", params, opts)
|
|
Util.convert_to_stripe_object(resp.data, opts)
|
|
end
|
|
|
|
def self.list_upcoming_line_items(params, opts = {})
|
|
resp, opts = execute_resource_request(:get, resource_url + "/upcoming/lines", params, opts)
|
|
Util.convert_to_stripe_object(resp.data, opts)
|
|
end
|
|
end
|
|
end
|