Skip to content

Commit

Permalink
Use Util.convert_to_stripe_object instead of initialize_from
Browse files Browse the repository at this point in the history
  • Loading branch information
rattrayalex-stripe committed May 29, 2019
1 parent 0d465ce commit ea736eb
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion lib/stripe/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Account < APIResource

def reject(params = {}, opts = {})
resp, opts = request(:post, resource_url + "/reject", params, opts)
initialize_from(resp.data, opts)
Util.convert_to_stripe_object(resp.data, opts)
end

save_nested_resource :external_account
Expand Down
2 changes: 1 addition & 1 deletion lib/stripe/credit_note.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class CreditNote < APIResource

def void_credit_note(params = {}, opts = {})
resp, opts = request(:post, resource_url + "/void", params, opts)
initialize_from(resp.data, opts)
Util.convert_to_stripe_object(resp.data, opts)
end
end
end
2 changes: 1 addition & 1 deletion lib/stripe/dispute.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Dispute < APIResource

def close(params = {}, opts = {})
resp, opts = request(:post, resource_url + "/close", params, opts)
initialize_from(resp.data, opts)
Util.convert_to_stripe_object(resp.data, opts)
end

def close_url
Expand Down
10 changes: 5 additions & 5 deletions lib/stripe/invoice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,27 @@ class Invoice < APIResource

def finalize_invoice(params = {}, opts = {})
resp, opts = request(:post, resource_url + "/finalize", params, opts)
initialize_from(resp.data, opts)
Util.convert_to_stripe_object(resp.data, opts)
end

def mark_uncollectible(params = {}, opts = {})
resp, opts = request(:post, resource_url + "/mark_uncollectible", params, opts)
initialize_from(resp.data, opts)
Util.convert_to_stripe_object(resp.data, opts)
end

def pay(params = {}, opts = {})
resp, opts = request(:post, resource_url + "/pay", params, opts)
initialize_from(resp.data, opts)
Util.convert_to_stripe_object(resp.data, opts)
end

def send_invoice(params = {}, opts = {})
resp, opts = request(:post, resource_url + "/send", params, opts)
initialize_from(resp.data, opts)
Util.convert_to_stripe_object(resp.data, opts)
end

def void_invoice(params = {}, opts = {})
resp, opts = request(:post, resource_url + "/void", params, opts)
initialize_from(resp.data, opts)
Util.convert_to_stripe_object(resp.data, opts)
end

def self.upcoming(params, opts = {})
Expand Down
4 changes: 2 additions & 2 deletions lib/stripe/issuing/authorization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ class Authorization < APIResource

def approve(params = {}, opts = {})
resp, opts = request(:post, resource_url + "/approve", params, opts)
initialize_from(resp.data, opts)
Util.convert_to_stripe_object(resp.data, opts)
end

def decline(params = {}, opts = {})
resp, opts = request(:post, resource_url + "/decline", params, opts)
initialize_from(resp.data, opts)
Util.convert_to_stripe_object(resp.data, opts)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/stripe/issuing/card.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions lib/stripe/payment_intent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ class PaymentIntent < APIResource

def cancel(params = {}, opts = {})
resp, opts = request(:post, resource_url + "/cancel", params, opts)
initialize_from(resp.data, opts)
Util.convert_to_stripe_object(resp.data, opts)
end

def capture(params = {}, opts = {})
resp, opts = request(:post, resource_url + "/capture", params, opts)
initialize_from(resp.data, opts)
Util.convert_to_stripe_object(resp.data, opts)
end

def confirm(params = {}, opts = {})
resp, opts = request(:post, resource_url + "/confirm", params, opts)
initialize_from(resp.data, opts)
Util.convert_to_stripe_object(resp.data, opts)
end
end
end
4 changes: 2 additions & 2 deletions lib/stripe/payment_method.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ class PaymentMethod < APIResource

def attach(params = {}, opts = {})
resp, opts = request(:post, resource_url + "/attach", params, opts)
initialize_from(resp.data, opts)
Util.convert_to_stripe_object(resp.data, opts)
end

def detach(params = {}, opts = {})
resp, opts = request(:post, resource_url + "/detach", params, opts)
initialize_from(resp.data, opts)
Util.convert_to_stripe_object(resp.data, opts)
end
end
end
2 changes: 1 addition & 1 deletion lib/stripe/payout.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Payout < APIResource

def cancel(params = {}, opts = {})
resp, opts = request(:post, resource_url + "/cancel", params, opts)
initialize_from(resp.data, opts)
Util.convert_to_stripe_object(resp.data, opts)
end

def cancel_url
Expand Down
2 changes: 1 addition & 1 deletion lib/stripe/review.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Review < APIResource

def approve(params = {}, opts = {})
resp, opts = request(:post, resource_url + "/approve", params, opts)
initialize_from(resp.data, opts)
Util.convert_to_stripe_object(resp.data, opts)
end
end
end
2 changes: 1 addition & 1 deletion lib/stripe/source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Source < APIResource

def verify(params = {}, opts = {})
resp, opts = request(:post, resource_url + "/verify", params, opts)
initialize_from(resp.data, opts)
Util.convert_to_stripe_object(resp.data, opts)
end

def detach(params = {}, opts = {})
Expand Down
4 changes: 2 additions & 2 deletions lib/stripe/subscription_schedule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ class SubscriptionSchedule < APIResource

def cancel(params = {}, opts = {})
resp, opts = request(:post, resource_url + "/cancel", params, opts)
initialize_from(resp.data, opts)
Util.convert_to_stripe_object(resp.data, opts)
end

def release(params = {}, opts = {})
resp, opts = request(:post, resource_url + "/release", params, opts)
initialize_from(resp.data, opts)
Util.convert_to_stripe_object(resp.data, opts)
end

def revisions(params = {}, opts = {})
Expand Down
2 changes: 1 addition & 1 deletion lib/stripe/topup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Topup < APIResource

def cancel(params = {}, opts = {})
resp, opts = request(:post, resource_url + "/cancel", params, opts)
initialize_from(resp.data, opts)
Util.convert_to_stripe_object(resp.data, opts)
end
end
end
2 changes: 1 addition & 1 deletion lib/stripe/transfer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Transfer < APIResource

def cancel(params = {}, opts = {})
resp, opts = request(:post, resource_url + "/cancel", params, opts)
initialize_from(resp.data, opts)
Util.convert_to_stripe_object(resp.data, opts)
end

def cancel_url
Expand Down

0 comments on commit ea736eb

Please sign in to comment.