Skip to content

Commit

Permalink
Codegen for openapi 056745c
Browse files Browse the repository at this point in the history
  • Loading branch information
richardm-stripe committed May 19, 2022
1 parent 629cd30 commit 8d358b0
Show file tree
Hide file tree
Showing 15 changed files with 1,037 additions and 51 deletions.
10 changes: 10 additions & 0 deletions lib/stripe/object_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,16 @@ def self.object_names_to_classes
Token::OBJECT_NAME => Token,
Topup::OBJECT_NAME => Topup,
Transfer::OBJECT_NAME => Transfer,
Treasury::CreditReversal::OBJECT_NAME => Treasury::CreditReversal,
Treasury::DebitReversal::OBJECT_NAME => Treasury::DebitReversal,
Treasury::FinancialAccount::OBJECT_NAME => Treasury::FinancialAccount,
Treasury::InboundTransfer::OBJECT_NAME => Treasury::InboundTransfer,
Treasury::OutboundPayment::OBJECT_NAME => Treasury::OutboundPayment,
Treasury::OutboundTransfer::OBJECT_NAME => Treasury::OutboundTransfer,
Treasury::ReceivedCredit::OBJECT_NAME => Treasury::ReceivedCredit,
Treasury::ReceivedDebit::OBJECT_NAME => Treasury::ReceivedDebit,
Treasury::Transaction::OBJECT_NAME => Treasury::Transaction,
Treasury::TransactionEntry::OBJECT_NAME => Treasury::TransactionEntry,
UsageRecord::OBJECT_NAME => UsageRecord,
UsageRecordSummary::OBJECT_NAME => UsageRecordSummary,
WebhookEndpoint::OBJECT_NAME => WebhookEndpoint,
Expand Down
10 changes: 10 additions & 0 deletions lib/stripe/resources.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@
require "stripe/resources/token"
require "stripe/resources/topup"
require "stripe/resources/transfer"
require "stripe/resources/treasury/credit_reversal"
require "stripe/resources/treasury/debit_reversal"
require "stripe/resources/treasury/financial_account"
require "stripe/resources/treasury/inbound_transfer"
require "stripe/resources/treasury/outbound_payment"
require "stripe/resources/treasury/outbound_transfer"
require "stripe/resources/treasury/received_credit"
require "stripe/resources/treasury/received_debit"
require "stripe/resources/treasury/transaction"
require "stripe/resources/treasury/transaction_entry"
require "stripe/resources/usage_record"
require "stripe/resources/usage_record_summary"
require "stripe/resources/webhook_endpoint"
10 changes: 10 additions & 0 deletions lib/stripe/resources/customer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ 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"
custom_method :retrieve_payment_method, http_verb: :get, http_path: "{payment_method}"

nested_resource_class_methods :cash_balance,
operations: %i[retrieve update],
Expand Down Expand Up @@ -41,6 +42,15 @@ def list_payment_methods(params = {}, opts = {})
)
end

def retrieve_payment_method(params = {}, opts = {})
request_stripe_object(
method: :get,
path: resource_url + "/{payment_method}",
params: params,
opts: opts
)
end

custom_method :delete_discount, http_verb: :delete, http_path: "discount"

save_nested_resource :source
Expand Down
12 changes: 12 additions & 0 deletions lib/stripe/resources/financial_connections/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
module Stripe
module FinancialConnections
class Account < APIResource
extend Stripe::APIOperations::List

OBJECT_NAME = "financial_connections.account"

custom_method :disconnect, http_verb: :post
custom_method :list_owners, http_verb: :get, http_path: "owners"
custom_method :refresh_account, http_verb: :post, http_path: "refresh"

def disconnect(params = {}, opts = {})
Expand All @@ -18,6 +21,15 @@ def disconnect(params = {}, opts = {})
)
end

def list_owners(params = {}, opts = {})
request_stripe_object(
method: :get,
path: resource_url + "/owners",
params: params,
opts: opts
)
end

def refresh_account(params = {}, opts = {})
request_stripe_object(
method: :post,
Expand Down
13 changes: 13 additions & 0 deletions lib/stripe/resources/treasury/credit_reversal.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
module Treasury
class CreditReversal < APIResource
extend Stripe::APIOperations::Create
extend Stripe::APIOperations::List

OBJECT_NAME = "treasury.credit_reversal"
end
end
end
13 changes: 13 additions & 0 deletions lib/stripe/resources/treasury/debit_reversal.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
module Treasury
class DebitReversal < APIResource
extend Stripe::APIOperations::Create
extend Stripe::APIOperations::List

OBJECT_NAME = "treasury.debit_reversal"
end
end
end
35 changes: 35 additions & 0 deletions lib/stripe/resources/treasury/financial_account.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true

module Stripe
module Treasury
class FinancialAccount < APIResource
extend Stripe::APIOperations::Create
extend Stripe::APIOperations::List
include Stripe::APIOperations::Save

OBJECT_NAME = "treasury.financial_account"

custom_method :retrieve_features, http_verb: :get, http_path: "features"
custom_method :update_features, http_verb: :post, http_path: "features"

def retrieve_features(params = {}, opts = {})
request_stripe_object(
method: :get,
path: resource_url + "/features",
params: params,
opts: opts
)
end

def update_features(params = {}, opts = {})
request_stripe_object(
method: :post,
path: resource_url + "/features",
params: params,
opts: opts
)
end
end
end
end
63 changes: 63 additions & 0 deletions lib/stripe/resources/treasury/inbound_transfer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true

module Stripe
module Treasury
class InboundTransfer < APIResource
extend Stripe::APIOperations::Create
extend Stripe::APIOperations::List

OBJECT_NAME = "treasury.inbound_transfer"

custom_method :cancel, http_verb: :post

def cancel(params = {}, opts = {})
request_stripe_object(
method: :post,
path: resource_url + "/cancel",
params: params,
opts: opts
)
end

def test_helpers
TestHelpers.new(self)
end

class TestHelpers < APIResourceTestHelpers
RESOURCE_CLASS = InboundTransfer

custom_method :fail, http_verb: :post
custom_method :return_inbound_transfer, http_verb: :post, http_path: "return"
custom_method :succeed, http_verb: :post

def fail(params = {}, opts = {})
@resource.request_stripe_object(
method: :post,
path: resource_url + "/fail",
params: params,
opts: opts
)
end

def return_inbound_transfer(params = {}, opts = {})
@resource.request_stripe_object(
method: :post,
path: resource_url + "/return",
params: params,
opts: opts
)
end

def succeed(params = {}, opts = {})
@resource.request_stripe_object(
method: :post,
path: resource_url + "/succeed",
params: params,
opts: opts
)
end
end
end
end
end
63 changes: 63 additions & 0 deletions lib/stripe/resources/treasury/outbound_payment.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true

module Stripe
module Treasury
class OutboundPayment < APIResource
extend Stripe::APIOperations::Create
extend Stripe::APIOperations::List

OBJECT_NAME = "treasury.outbound_payment"

custom_method :cancel, http_verb: :post

def cancel(params = {}, opts = {})
request_stripe_object(
method: :post,
path: resource_url + "/cancel",
params: params,
opts: opts
)
end

def test_helpers
TestHelpers.new(self)
end

class TestHelpers < APIResourceTestHelpers
RESOURCE_CLASS = OutboundPayment

custom_method :fail, http_verb: :post
custom_method :post, http_verb: :post
custom_method :return_outbound_payment, http_verb: :post, http_path: "return"

def fail(params = {}, opts = {})
@resource.request_stripe_object(
method: :post,
path: resource_url + "/fail",
params: params,
opts: opts
)
end

def post(params = {}, opts = {})
@resource.request_stripe_object(
method: :post,
path: resource_url + "/post",
params: params,
opts: opts
)
end

def return_outbound_payment(params = {}, opts = {})
@resource.request_stripe_object(
method: :post,
path: resource_url + "/return",
params: params,
opts: opts
)
end
end
end
end
end
63 changes: 63 additions & 0 deletions lib/stripe/resources/treasury/outbound_transfer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true

module Stripe
module Treasury
class OutboundTransfer < APIResource
extend Stripe::APIOperations::Create
extend Stripe::APIOperations::List

OBJECT_NAME = "treasury.outbound_transfer"

custom_method :cancel, http_verb: :post

def cancel(params = {}, opts = {})
request_stripe_object(
method: :post,
path: resource_url + "/cancel",
params: params,
opts: opts
)
end

def test_helpers
TestHelpers.new(self)
end

class TestHelpers < APIResourceTestHelpers
RESOURCE_CLASS = OutboundTransfer

custom_method :fail, http_verb: :post
custom_method :post, http_verb: :post
custom_method :return_outbound_transfer, http_verb: :post, http_path: "return"

def fail(params = {}, opts = {})
@resource.request_stripe_object(
method: :post,
path: resource_url + "/fail",
params: params,
opts: opts
)
end

def post(params = {}, opts = {})
@resource.request_stripe_object(
method: :post,
path: resource_url + "/post",
params: params,
opts: opts
)
end

def return_outbound_transfer(params = {}, opts = {})
@resource.request_stripe_object(
method: :post,
path: resource_url + "/return",
params: params,
opts: opts
)
end
end
end
end
end
30 changes: 30 additions & 0 deletions lib/stripe/resources/treasury/received_credit.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true

module Stripe
module Treasury
class ReceivedCredit < APIResource
extend Stripe::APIOperations::List

OBJECT_NAME = "treasury.received_credit"

def test_helpers
TestHelpers.new(self)
end

class TestHelpers < APIResourceTestHelpers
RESOURCE_CLASS = ReceivedCredit

def self.create(params = {}, opts = {})
resp, opts = execute_resource_request(
:post,
resource_url + "/received_credits",
params,
opts
)
Util.convert_to_stripe_object(resp.data, opts)
end
end
end
end
end
Loading

0 comments on commit 8d358b0

Please sign in to comment.