Skip to content

Commit

Permalink
API Updates (#1053)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcr-stripe authored May 3, 2022
1 parent 2eb5422 commit 41066a4
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/stripe/object_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def self.object_names_to_classes
BitcoinTransaction::OBJECT_NAME => BitcoinTransaction,
Capability::OBJECT_NAME => Capability,
Card::OBJECT_NAME => Card,
CashBalance::OBJECT_NAME => CashBalance,
Charge::OBJECT_NAME => Charge,
Checkout::Session::OBJECT_NAME => Checkout::Session,
CountrySpec::OBJECT_NAME => CountrySpec,
Expand Down
1 change: 1 addition & 0 deletions lib/stripe/resources.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
require "stripe/resources/bitcoin_transaction"
require "stripe/resources/capability"
require "stripe/resources/card"
require "stripe/resources/cash_balance"
require "stripe/resources/charge"
require "stripe/resources/checkout/session"
require "stripe/resources/country_spec"
Expand Down
22 changes: 22 additions & 0 deletions lib/stripe/resources/cash_balance.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true

module Stripe
class CashBalance < APIResource
OBJECT_NAME = "cash_balance"

def resource_url
if !respond_to?(:customer) || customer.nil?
raise NotImplementedError,
"Customer Cash Balance cannot be accessed without a customer ID."
end
"#{Customer.resource_url}/#{CGI.escape(customer)}/cash_balance"
end

def self.retrieve(_id, _opts = {})
raise NotImplementedError,
"Customer Cash Balance cannot be retrieved without a customer ID. " \
"Retrieve a Customer Cash Balance using `Customer.retrieve_cash_balance('cus_123')`"
end
end
end
3 changes: 3 additions & 0 deletions lib/stripe/resources/customer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ class Customer < APIResource
custom_method :create_funding_instructions, http_verb: :post, http_path: "funding_instructions"
custom_method :list_payment_methods, http_verb: :get, http_path: "payment_methods"

nested_resource_class_methods :cash_balance,
operations: %i[retrieve update],
resource_plural: "cash_balance"
nested_resource_class_methods :balance_transaction,
operations: %i[create retrieve update list]
nested_resource_class_methods :tax_id,
Expand Down

0 comments on commit 41066a4

Please sign in to comment.