Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update generated code #1372

Merged
merged 8 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v908
v938
3 changes: 3 additions & 0 deletions lib/stripe/object_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ def self.object_names_to_classes
CustomerSession.object_name => CustomerSession,
Discount.object_name => Discount,
Dispute.object_name => Dispute,
Entitlements::ActiveEntitlement.object_name => Entitlements::ActiveEntitlement,
Entitlements::Feature.object_name => Entitlements::Feature,
EphemeralKey.object_name => EphemeralKey,
Event.object_name => Event,
ExchangeRate.object_name => ExchangeRate,
Expand Down Expand Up @@ -86,6 +88,7 @@ def self.object_names_to_classes
Plan.object_name => Plan,
Price.object_name => Price,
Product.object_name => Product,
ProductFeature.object_name => ProductFeature,
PromotionCode.object_name => PromotionCode,
Quote.object_name => Quote,
Radar::EarlyFraudWarning.object_name => Radar::EarlyFraudWarning,
Expand Down
3 changes: 3 additions & 0 deletions lib/stripe/resources.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
require "stripe/resources/customer_session"
require "stripe/resources/discount"
require "stripe/resources/dispute"
require "stripe/resources/entitlements/active_entitlement"
require "stripe/resources/entitlements/feature"
require "stripe/resources/ephemeral_key"
require "stripe/resources/event"
require "stripe/resources/exchange_rate"
Expand Down Expand Up @@ -74,6 +76,7 @@
require "stripe/resources/plan"
require "stripe/resources/price"
require "stripe/resources/product"
require "stripe/resources/product_feature"
require "stripe/resources/promotion_code"
require "stripe/resources/quote"
require "stripe/resources/radar/early_fraud_warning"
Expand Down
26 changes: 26 additions & 0 deletions lib/stripe/resources/entitlements/active_entitlement.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true

module Stripe
module Entitlements
# An active entitlement describes access to a feature for a customer.
class ActiveEntitlement < APIResource
extend Stripe::APIOperations::List

OBJECT_NAME = "entitlements.active_entitlement"
def self.object_name
"entitlements.active_entitlement"
end

# Retrieve a list of active entitlements for a customer
def self.list(filters = {}, opts = {})
request_stripe_object(
method: :get,
path: "/v1/entitlements/active_entitlements",
params: filters,
opts: opts
)
end
end
end
end
49 changes: 49 additions & 0 deletions lib/stripe/resources/entitlements/feature.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true

module Stripe
module Entitlements
# A feature represents a monetizable ability or functionality in your system.
# Features can be assigned to products, and when those products are purchased, Stripe will create an entitlement to the feature for the purchasing customer.
class Feature < APIResource
extend Stripe::APIOperations::Create
extend Stripe::APIOperations::List
include Stripe::APIOperations::Save

OBJECT_NAME = "entitlements.feature"
def self.object_name
"entitlements.feature"
end

# Creates a feature
def self.create(params = {}, opts = {})
request_stripe_object(
method: :post,
path: "/v1/entitlements/features",
params: params,
opts: opts
)
end

# Retrieve a list of features
def self.list(filters = {}, opts = {})
request_stripe_object(
method: :get,
path: "/v1/entitlements/features",
params: filters,
opts: opts
)
end

# Update a feature's metadata or permanently deactivate it.
def self.update(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/entitlements/features/%<id>s", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
end
end
end
2 changes: 1 addition & 1 deletion lib/stripe/resources/invoice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def self.send_invoice(invoice, params = {}, opts = {})
#
# Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the invoice has not yet been created. As such, the upcoming invoice will not show up in invoice listing calls, and you cannot use the API to pay or edit the invoice. If you want to change the amount that your customer will be billed, you can add, remove, or update pending invoice items, or update the customer's discount.
#
# You can preview the effects of updating a subscription, including a preview of what proration will take place. To ensure that the actual proration is calculated exactly the same as the previewed proration, you should pass a proration_date parameter when doing the actual subscription update. The value passed in should be the same as the subscription_proration_date returned on the upcoming invoice resource. The recommended way to get only the prorations being previewed is to consider only proration line items where period[start] is equal to the subscription_proration_date on the upcoming invoice resource.
# You can preview the effects of updating a subscription, including a preview of what proration will take place. To ensure that the actual proration is calculated exactly the same as the previewed proration, you should pass the subscription_proration_date parameter when doing the actual subscription update. The recommended way to get only the prorations being previewed is to consider only proration line items where period[start] is equal to the subscription_proration_date value passed in the request.
def self.upcoming(params = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/invoices/upcoming", params: params, opts: opts)
end
Expand Down
3 changes: 3 additions & 0 deletions lib/stripe/resources/product.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class Product < APIResource
extend Stripe::APIOperations::Create
include Stripe::APIOperations::Delete
extend Stripe::APIOperations::List
extend Stripe::APIOperations::NestedResource
extend Stripe::APIOperations::Search
include Stripe::APIOperations::Save

Expand All @@ -22,6 +23,8 @@ def self.object_name
"product"
end

nested_resource_class_methods :feature, operations: %i[create retrieve delete list]

# Creates a new product object.
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/products", params: params, opts: opts)
Expand Down
13 changes: 13 additions & 0 deletions lib/stripe/resources/product_feature.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true

module Stripe
# A product_feature represents an attachment between a feature and a product.
# When a product is purchased that has a feature attached, Stripe will create an entitlement to the feature for the purchasing customer.
class ProductFeature < APIResource
OBJECT_NAME = "product_feature"
def self.object_name
"product_feature"
end
end
end