Skip to content

Commit

Permalink
Codegen for openapi v183 (#1116)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamil-stripe authored Aug 19, 2022
1 parent c5af3ad commit 73324f2
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 58 deletions.
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v174
v183
1 change: 1 addition & 0 deletions lib/stripe/object_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def self.object_names_to_classes
CreditNoteLineItem::OBJECT_NAME => CreditNoteLineItem,
Customer::OBJECT_NAME => Customer,
CustomerBalanceTransaction::OBJECT_NAME => CustomerBalanceTransaction,
CustomerCashBalanceTransaction::OBJECT_NAME => CustomerCashBalanceTransaction,
Discount::OBJECT_NAME => Discount,
Dispute::OBJECT_NAME => Dispute,
EphemeralKey::OBJECT_NAME => EphemeralKey,
Expand Down
1 change: 1 addition & 0 deletions lib/stripe/resources.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
require "stripe/resources/credit_note_line_item"
require "stripe/resources/customer"
require "stripe/resources/customer_balance_transaction"
require "stripe/resources/customer_cash_balance_transaction"
require "stripe/resources/discount"
require "stripe/resources/dispute"
require "stripe/resources/ephemeral_key"
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/resources/customer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class Customer < APIResource

nested_resource_class_methods :balance_transaction,
operations: %i[create retrieve update list]
nested_resource_class_methods :cash_balance_transaction,
operations: %i[retrieve list]
nested_resource_class_methods :tax_id,
operations: %i[create retrieve delete list]

Expand Down
10 changes: 10 additions & 0 deletions lib/stripe/resources/customer_cash_balance_transaction.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true

module Stripe
class CustomerCashBalanceTransaction < APIResource
extend Stripe::APIOperations::List

OBJECT_NAME = "customer_cash_balance_transaction"
end
end
57 changes: 0 additions & 57 deletions test/stripe/generated_examples_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1070,63 +1070,6 @@ class CodegennedExampleTest < Test::Unit::TestCase
assert_requested :get, "#{Stripe.api_base}/v1/mandates/mandate_xxxxxxxxxxxxx?"
end
end
context "Order.cancel" do
should "support requests with args: order" do
Stripe::Order.cancel("order_xyz")
assert_requested :post, "#{Stripe.api_base}/v1/orders/order_xyz/cancel?"
end
end
context "Order.create" do
should "support requests with args: description, currency, line_items" do
Stripe::Order.create(
{
description: "description",
currency: "usd",
line_items: [{ description: "my line item" }],
}
)
assert_requested :post, "#{Stripe.api_base}/v1/orders"
end
end
context "Order.list" do
should "support requests with args: limit" do
Stripe::Order.list({ limit: 3 })
assert_requested :get, "#{Stripe.api_base}/v1/orders?limit=3"
end
end
context "Order.list_line_items" do
should "support requests with args: order" do
Stripe::Order.list_line_items("order_xyz")
assert_requested :get, "#{Stripe.api_base}/v1/orders/order_xyz/line_items?"
end
end
context "Order.reopen" do
should "support requests with args: order" do
Stripe::Order.reopen("order_xyz")
assert_requested :post, "#{Stripe.api_base}/v1/orders/order_xyz/reopen?"
end
end
context "Order.retrieve" do
should "support requests with args: order" do
Stripe::Order.retrieve("order_xyz")
assert_requested :get, "#{Stripe.api_base}/v1/orders/order_xyz?"
end
end
context "Order.submit" do
should "support requests with args: order, expected_total" do
Stripe::Order.submit("order_xyz", { expected_total: 100 })
assert_requested :post, "#{Stripe.api_base}/v1/orders/order_xyz/submit"
end
end
context "Order.update" do
should "support requests with args: order, metadata, ip_address" do
Stripe::Order.update(
"order_xyz",
{ metadata: { reference_number: "123" }, ip_address: "0.0.0.0" }
)
assert_requested :post, "#{Stripe.api_base}/v1/orders/order_xyz"
end
end
context "PaymentIntent.apply_customer_balance" do
should "support requests with args: id" do
Stripe::PaymentIntent.apply_customer_balance("pi_xxxxxxxxxxxxx")
Expand Down

0 comments on commit 73324f2

Please sign in to comment.