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 for beta #1363

Merged
merged 8 commits into from
Mar 21, 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 @@
v879
v896
2 changes: 1 addition & 1 deletion lib/stripe/api_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
module Stripe
module ApiVersion
CURRENT = "2023-10-16"
PREVIEW = "2024-02-15.preview-v2"
PREVIEW = "2024-03-20.preview-v2"
end
end
5 changes: 3 additions & 2 deletions lib/stripe/object_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,10 @@ def self.object_names_to_classes
Customer.object_name => Customer,
CustomerBalanceTransaction.object_name => CustomerBalanceTransaction,
CustomerCashBalanceTransaction.object_name => CustomerCashBalanceTransaction,
CustomerEntitlement.object_name => CustomerEntitlement,
CustomerEntitlementSummary.object_name => CustomerEntitlementSummary,
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,
Expand All @@ -67,6 +66,7 @@ def self.object_names_to_classes
FinancialConnections::AccountOwnership.object_name => FinancialConnections::AccountOwnership,
FinancialConnections::Session.object_name => FinancialConnections::Session,
FinancialConnections::Transaction.object_name => FinancialConnections::Transaction,
Forwarding::Request.object_name => Forwarding::Request,
FundingInstructions.object_name => FundingInstructions,
GiftCards::Card.object_name => GiftCards::Card,
GiftCards::Transaction.object_name => GiftCards::Transaction,
Expand Down Expand Up @@ -100,6 +100,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,
QuotePhase.object_name => QuotePhase,
Expand Down
5 changes: 3 additions & 2 deletions lib/stripe/resources.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@
require "stripe/resources/customer"
require "stripe/resources/customer_balance_transaction"
require "stripe/resources/customer_cash_balance_transaction"
require "stripe/resources/customer_entitlement"
require "stripe/resources/customer_entitlement_summary"
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"
Expand All @@ -54,6 +53,7 @@
require "stripe/resources/financial_connections/account_ownership"
require "stripe/resources/financial_connections/session"
require "stripe/resources/financial_connections/transaction"
require "stripe/resources/forwarding/request"
require "stripe/resources/funding_instructions"
require "stripe/resources/gift_cards/card"
require "stripe/resources/gift_cards/transaction"
Expand Down Expand Up @@ -87,6 +87,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/quote_phase"
Expand Down
11 changes: 0 additions & 11 deletions lib/stripe/resources/customer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ def self.object_name
nested_resource_class_methods :cash_balance_transaction, operations: %i[retrieve list]
nested_resource_class_methods :source, operations: %i[create retrieve update delete list]
nested_resource_class_methods :tax_id, operations: %i[create retrieve delete list]
nested_resource_class_methods :entitlement, operations: %i[list]

# Creates a new customer object.
def self.create(params = {}, opts = {})
Expand Down Expand Up @@ -128,16 +127,6 @@ def self.retrieve_cash_balance(customer, params = {}, opts = {})
)
end

# Retrieve the entitlement summary for a customer
def self.retrieve_entitlement_summary(customer, params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/customers/%<customer>s/entitlement_summary", { customer: CGI.escape(customer) }),
params: params,
opts: opts
)
end

# Retrieves a PaymentMethod object for a given Customer.
def retrieve_payment_method(payment_method, params = {}, opts = {})
request_stripe_object(
Expand Down
12 changes: 0 additions & 12 deletions lib/stripe/resources/customer_entitlement.rb

This file was deleted.

12 changes: 0 additions & 12 deletions lib/stripe/resources/customer_entitlement_summary.rb

This file was deleted.

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
50 changes: 50 additions & 0 deletions lib/stripe/resources/forwarding/request.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true

module Stripe
module Forwarding
# Instructs Stripe to make a request on your behalf using the destination URL and HTTP method in the config.
# A config is set up for each destination URL by Stripe at the time of onboarding. Stripe verifies requests with
# your credentials in the config, and injects card details from the payment_method into the request.
#
# Stripe redacts all sensitive fields and headers, including authentication credentials and card numbers,
# before storing the request and response data in the forwarding Request object, which are subject to a
# 30-day retention period.
#
# You can provide a Stripe idempotency key to make sure that requests with the same key result in only one
# outbound request. The Stripe idempotency key provided should be unique and different from any idempotency
# keys provided on the underlying third-party request.
#
# Forwarding Requests are synchronous requests that return a response or time out according to
# Stripe's limits.
class Request < APIResource
extend Stripe::APIOperations::Create
extend Stripe::APIOperations::List

OBJECT_NAME = "forwarding.request"
def self.object_name
"forwarding.request"
end

# Creates a ForwardingRequest object.
def self.create(params = {}, opts = {})
request_stripe_object(
method: :post,
path: "/v1/forwarding/requests",
params: params,
opts: opts
)
end

# Lists all ForwardingRequest objects.
def self.list(filters = {}, opts = {})
request_stripe_object(
method: :get,
path: "/v1/forwarding/requests",
params: filters,
opts: opts
)
end
end
end
end
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 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
4 changes: 2 additions & 2 deletions lib/stripe/resources/quote.rb
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def self.mark_stale(quote, params = {}, opts = {})
)
end

# Download the PDF for a finalized quote
# Download the PDF for a finalized quote. Explanation for special handling can be found [here](https://docs.corp.stripe.com/quotes/overview#quote_pdf)
def pdf(params = {}, opts = {}, &read_body_chunk_block)
config = opts[:client]&.config || Stripe.config
opts = { api_base: config.uploads_base }.merge(opts)
Expand All @@ -221,7 +221,7 @@ def pdf(params = {}, opts = {}, &read_body_chunk_block)
)
end

# Download the PDF for a finalized quote
# Download the PDF for a finalized quote. Explanation for special handling can be found [here](https://docs.corp.stripe.com/quotes/overview#quote_pdf)
def self.pdf(quote, params = {}, opts = {}, &read_body_chunk_block)
config = opts[:client]&.config || Stripe.config
opts = { api_base: config.uploads_base }.merge(opts)
Expand Down
3 changes: 3 additions & 0 deletions stripe.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@ Gem::Specification.new do |s|
/\A\.rubocop/,
/\A\.travis.yml/,
/\A\.vscode/,
%r{\A(bin/tapioca)},
/\Asorbet/,
/\Atest/
)
s.files = `git ls-files`.split("\n").reject { |f| ignored.match(f) }
s.executables = `git ls-files -- bin/*`.split("\n")
.map { |f| File.basename(f) }
.reject { |f| f == "tapioca" }
s.require_paths = ["lib"]
end