From ec24fe2a6b50b4af44eccc57c13c4be62190ac99 Mon Sep 17 00:00:00 2001 From: Alex Rattray Date: Wed, 3 Jul 2019 20:00:19 -0700 Subject: [PATCH 1/3] Revert "Use Util.convert_to_stripe_object instead of initialize_from" This reverts commit ea736eba1b8f33d8febbf0b1be0957f34f7b04db. --- lib/stripe/resources/account.rb | 2 +- lib/stripe/resources/credit_note.rb | 2 +- lib/stripe/resources/dispute.rb | 2 +- lib/stripe/resources/invoice.rb | 10 +++++----- lib/stripe/resources/issuing/authorization.rb | 4 ++-- lib/stripe/resources/issuing/card.rb | 2 +- lib/stripe/resources/payment_intent.rb | 6 +++--- lib/stripe/resources/payment_method.rb | 4 ++-- lib/stripe/resources/payout.rb | 2 +- lib/stripe/resources/review.rb | 2 +- lib/stripe/resources/source.rb | 2 +- lib/stripe/resources/subscription_schedule.rb | 4 ++-- lib/stripe/resources/topup.rb | 2 +- lib/stripe/resources/transfer.rb | 2 +- 14 files changed, 23 insertions(+), 23 deletions(-) diff --git a/lib/stripe/resources/account.rb b/lib/stripe/resources/account.rb index bb8b3e5d9..b28cb0a6f 100644 --- a/lib/stripe/resources/account.rb +++ b/lib/stripe/resources/account.rb @@ -21,7 +21,7 @@ class Account < APIResource def reject(params = {}, opts = {}) resp, opts = request(:post, resource_url + "/reject", params, opts) - Util.convert_to_stripe_object(resp.data, opts) + initialize_from(resp.data, opts) end save_nested_resource :external_account diff --git a/lib/stripe/resources/credit_note.rb b/lib/stripe/resources/credit_note.rb index 11c27bc8e..0b369f590 100644 --- a/lib/stripe/resources/credit_note.rb +++ b/lib/stripe/resources/credit_note.rb @@ -12,7 +12,7 @@ class CreditNote < APIResource def void_credit_note(params = {}, opts = {}) resp, opts = request(:post, resource_url + "/void", params, opts) - Util.convert_to_stripe_object(resp.data, opts) + initialize_from(resp.data, opts) end end end diff --git a/lib/stripe/resources/dispute.rb b/lib/stripe/resources/dispute.rb index 987900cb0..2541a3387 100644 --- a/lib/stripe/resources/dispute.rb +++ b/lib/stripe/resources/dispute.rb @@ -11,7 +11,7 @@ class Dispute < APIResource def close(params = {}, opts = {}) resp, opts = request(:post, resource_url + "/close", params, opts) - Util.convert_to_stripe_object(resp.data, opts) + initialize_from(resp.data, opts) end def close_url diff --git a/lib/stripe/resources/invoice.rb b/lib/stripe/resources/invoice.rb index b0c85224b..dfee9f9a5 100644 --- a/lib/stripe/resources/invoice.rb +++ b/lib/stripe/resources/invoice.rb @@ -17,27 +17,27 @@ class Invoice < APIResource def finalize_invoice(params = {}, opts = {}) resp, opts = request(:post, resource_url + "/finalize", params, opts) - Util.convert_to_stripe_object(resp.data, opts) + initialize_from(resp.data, opts) end def mark_uncollectible(params = {}, opts = {}) resp, opts = request(:post, resource_url + "/mark_uncollectible", params, opts) - Util.convert_to_stripe_object(resp.data, opts) + initialize_from(resp.data, opts) end def pay(params = {}, opts = {}) resp, opts = request(:post, resource_url + "/pay", params, opts) - Util.convert_to_stripe_object(resp.data, opts) + initialize_from(resp.data, opts) end def send_invoice(params = {}, opts = {}) resp, opts = request(:post, resource_url + "/send", params, opts) - Util.convert_to_stripe_object(resp.data, opts) + initialize_from(resp.data, opts) end def void_invoice(params = {}, opts = {}) resp, opts = request(:post, resource_url + "/void", params, opts) - Util.convert_to_stripe_object(resp.data, opts) + initialize_from(resp.data, opts) end def self.upcoming(params, opts = {}) diff --git a/lib/stripe/resources/issuing/authorization.rb b/lib/stripe/resources/issuing/authorization.rb index 718be0f62..eb13be217 100644 --- a/lib/stripe/resources/issuing/authorization.rb +++ b/lib/stripe/resources/issuing/authorization.rb @@ -13,12 +13,12 @@ class Authorization < APIResource def approve(params = {}, opts = {}) resp, opts = request(:post, resource_url + "/approve", params, opts) - Util.convert_to_stripe_object(resp.data, opts) + initialize_from(resp.data, opts) end def decline(params = {}, opts = {}) resp, opts = request(:post, resource_url + "/decline", params, opts) - Util.convert_to_stripe_object(resp.data, opts) + initialize_from(resp.data, opts) end end end diff --git a/lib/stripe/resources/issuing/card.rb b/lib/stripe/resources/issuing/card.rb index ba38e5dd8..c24ee6625 100644 --- a/lib/stripe/resources/issuing/card.rb +++ b/lib/stripe/resources/issuing/card.rb @@ -13,7 +13,7 @@ class Card < APIResource def details(params = {}, opts = {}) resp, opts = request(:get, resource_url + "/details", params, opts) - Util.convert_to_stripe_object(resp.data, opts) + initialize_from(resp.data, opts) end end end diff --git a/lib/stripe/resources/payment_intent.rb b/lib/stripe/resources/payment_intent.rb index 2cf9c9987..5bbf8fbeb 100644 --- a/lib/stripe/resources/payment_intent.rb +++ b/lib/stripe/resources/payment_intent.rb @@ -14,17 +14,17 @@ class PaymentIntent < APIResource def cancel(params = {}, opts = {}) resp, opts = request(:post, resource_url + "/cancel", params, opts) - Util.convert_to_stripe_object(resp.data, opts) + initialize_from(resp.data, opts) end def capture(params = {}, opts = {}) resp, opts = request(:post, resource_url + "/capture", params, opts) - Util.convert_to_stripe_object(resp.data, opts) + initialize_from(resp.data, opts) end def confirm(params = {}, opts = {}) resp, opts = request(:post, resource_url + "/confirm", params, opts) - Util.convert_to_stripe_object(resp.data, opts) + initialize_from(resp.data, opts) end end end diff --git a/lib/stripe/resources/payment_method.rb b/lib/stripe/resources/payment_method.rb index c2d126255..4dd3fad15 100644 --- a/lib/stripe/resources/payment_method.rb +++ b/lib/stripe/resources/payment_method.rb @@ -13,12 +13,12 @@ class PaymentMethod < APIResource def attach(params = {}, opts = {}) resp, opts = request(:post, resource_url + "/attach", params, opts) - Util.convert_to_stripe_object(resp.data, opts) + initialize_from(resp.data, opts) end def detach(params = {}, opts = {}) resp, opts = request(:post, resource_url + "/detach", params, opts) - Util.convert_to_stripe_object(resp.data, opts) + initialize_from(resp.data, opts) end end end diff --git a/lib/stripe/resources/payout.rb b/lib/stripe/resources/payout.rb index 351b8c334..d9e1d4800 100644 --- a/lib/stripe/resources/payout.rb +++ b/lib/stripe/resources/payout.rb @@ -12,7 +12,7 @@ class Payout < APIResource def cancel(params = {}, opts = {}) resp, opts = request(:post, resource_url + "/cancel", params, opts) - Util.convert_to_stripe_object(resp.data, opts) + initialize_from(resp.data, opts) end def cancel_url diff --git a/lib/stripe/resources/review.rb b/lib/stripe/resources/review.rb index de7570a1c..8eb0e62b6 100644 --- a/lib/stripe/resources/review.rb +++ b/lib/stripe/resources/review.rb @@ -10,7 +10,7 @@ class Review < APIResource def approve(params = {}, opts = {}) resp, opts = request(:post, resource_url + "/approve", params, opts) - Util.convert_to_stripe_object(resp.data, opts) + initialize_from(resp.data, opts) end end end diff --git a/lib/stripe/resources/source.rb b/lib/stripe/resources/source.rb index 8e960b9ad..ec897b87e 100644 --- a/lib/stripe/resources/source.rb +++ b/lib/stripe/resources/source.rb @@ -11,7 +11,7 @@ class Source < APIResource def verify(params = {}, opts = {}) resp, opts = request(:post, resource_url + "/verify", params, opts) - Util.convert_to_stripe_object(resp.data, opts) + initialize_from(resp.data, opts) end def detach(params = {}, opts = {}) diff --git a/lib/stripe/resources/subscription_schedule.rb b/lib/stripe/resources/subscription_schedule.rb index 6516b99e7..2c24e784d 100644 --- a/lib/stripe/resources/subscription_schedule.rb +++ b/lib/stripe/resources/subscription_schedule.rb @@ -16,12 +16,12 @@ class SubscriptionSchedule < APIResource def cancel(params = {}, opts = {}) resp, opts = request(:post, resource_url + "/cancel", params, opts) - Util.convert_to_stripe_object(resp.data, opts) + initialize_from(resp.data, opts) end def release(params = {}, opts = {}) resp, opts = request(:post, resource_url + "/release", params, opts) - Util.convert_to_stripe_object(resp.data, opts) + initialize_from(resp.data, opts) end def revisions(params = {}, opts = {}) diff --git a/lib/stripe/resources/topup.rb b/lib/stripe/resources/topup.rb index 76defd7f4..5468a9c89 100644 --- a/lib/stripe/resources/topup.rb +++ b/lib/stripe/resources/topup.rb @@ -12,7 +12,7 @@ class Topup < APIResource def cancel(params = {}, opts = {}) resp, opts = request(:post, resource_url + "/cancel", params, opts) - Util.convert_to_stripe_object(resp.data, opts) + initialize_from(resp.data, opts) end end end diff --git a/lib/stripe/resources/transfer.rb b/lib/stripe/resources/transfer.rb index cd6655a37..3918a5cd4 100644 --- a/lib/stripe/resources/transfer.rb +++ b/lib/stripe/resources/transfer.rb @@ -16,7 +16,7 @@ class Transfer < APIResource def cancel(params = {}, opts = {}) resp, opts = request(:post, resource_url + "/cancel", params, opts) - Util.convert_to_stripe_object(resp.data, opts) + initialize_from(resp.data, opts) end def cancel_url From e642fbd98345c60c21093987fe2c593929835beb Mon Sep 17 00:00:00 2001 From: Alex Rattray Date: Wed, 3 Jul 2019 20:02:57 -0700 Subject: [PATCH 2/3] Make SetupIntents use initialize_from instead of Util.convert_to_stripe_object --- lib/stripe/resources/setup_intent.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/stripe/resources/setup_intent.rb b/lib/stripe/resources/setup_intent.rb index 542e74736..3b3815fdb 100644 --- a/lib/stripe/resources/setup_intent.rb +++ b/lib/stripe/resources/setup_intent.rb @@ -13,12 +13,12 @@ class SetupIntent < APIResource def cancel(params = {}, opts = {}) resp, opts = request(:post, resource_url + "/cancel", params, opts) - Util.convert_to_stripe_object(resp.data, opts) + initialize_from(resp.data, opts) end def confirm(params = {}, opts = {}) resp, opts = request(:post, resource_url + "/confirm", params, opts) - Util.convert_to_stripe_object(resp.data, opts) + initialize_from(resp.data, opts) end end end From 52dd05af67aadf498edb8f706d0e213fb438f5c5 Mon Sep 17 00:00:00 2001 From: Alex Rattray Date: Wed, 3 Jul 2019 20:14:53 -0700 Subject: [PATCH 3/3] Fix issuing card details, which must have been broken prior to ea736eb --- lib/stripe/resources/issuing/card.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/stripe/resources/issuing/card.rb b/lib/stripe/resources/issuing/card.rb index c24ee6625..ba38e5dd8 100644 --- a/lib/stripe/resources/issuing/card.rb +++ b/lib/stripe/resources/issuing/card.rb @@ -13,7 +13,7 @@ class Card < APIResource def details(params = {}, opts = {}) resp, opts = request(:get, resource_url + "/details", params, opts) - initialize_from(resp.data, opts) + Util.convert_to_stripe_object(resp.data, opts) end end end